Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/dummy-worker-interceptor.js

Issue 2695813009: Import wpt@503f5b5f78ec4e87d144f78609f363f0ed0ea8db (Closed)
Patch Set: Skip some tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 importScripts('get-host-info.sub.js'); 1 importScripts('/common/get-host-info.sub.js');
2 2
3 var worker_text = 'postMessage("worker loading intercepted by service worker"); '; 3 var worker_text = 'postMessage("worker loading intercepted by service worker"); ';
4 4
5 self.onfetch = function(event) { 5 self.onfetch = function(event) {
6 if (event.request.url.indexOf('synthesized') != -1) { 6 if (event.request.url.indexOf('synthesized') != -1) {
7 event.respondWith(new Response(worker_text)); 7 event.respondWith(new Response(worker_text));
8 } else if (event.request.url.indexOf('same-origin') != -1) { 8 } else if (event.request.url.indexOf('same-origin') != -1) {
9 event.respondWith(fetch('dummy-worker-script.py')); 9 event.respondWith(fetch('dummy-worker-script.py'));
10 } else if (event.request.url.indexOf('cors') != -1) { 10 } else if (event.request.url.indexOf('cors') != -1) {
11 var path = (new URL('dummy-worker-script.py', self.location)).pathname; 11 var path = (new URL('dummy-worker-script.py', self.location)).pathname;
12 var url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + path; 12 var url = get_host_info()['HTTPS_REMOTE_ORIGIN'] + path;
13 var mode = "no-cors"; 13 var mode = "no-cors";
14 if (event.request.url.indexOf('no-cors') == -1) { 14 if (event.request.url.indexOf('no-cors') == -1) {
15 url += '?ACAOrigin=*'; 15 url += '?ACAOrigin=*';
16 mode = "cors"; 16 mode = "cors";
17 } 17 }
18 event.respondWith(fetch(url, { mode: mode })); 18 event.respondWith(fetch(url, { mode: mode }));
19 } 19 }
20 }; 20 };
21 21
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698