blob: 9cb8d2d61f2abd192ca849ab1c0adae19c5d8f8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
var prefix = "http://example.com/tests/dom/serviceworkers/test/eventsource/";
self.importScripts("eventsource_worker_helper.js");
self.addEventListener("fetch", function (event) {
var request = event.request;
var url = new URL(request.url);
if (
url.pathname !==
"/tests/dom/serviceworkers/test/eventsource/eventsource.resource"
) {
return;
}
ok(request.mode === "cors", "EventSource should make a CORS request");
ok(
request.cache === "no-store",
"EventSource should make a no-store request"
);
var fetchRequest = new Request(prefix + "eventsource.resource", {
mode: "cors",
});
event.respondWith(
fetch(fetchRequest).then(fetchResponse => {
return fetchResponse;
})
);
});
|