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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/resources/fetch-request-html-imports-worker.js

Issue 2858093002: Upstream service worker `fetch` test to WPT (Closed)
Patch Set: Incorporate review feedback Created 3 years, 7 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('../../resources/get-host-info.js'); 1 importScripts('/common/get-host-info.sub.js');
2 var host_info = get_host_info(); 2 var host_info = get_host_info();
3 3
4 self.addEventListener('fetch', function(event) { 4 self.addEventListener('fetch', function(event) {
5 var url = event.request.url; 5 var url = event.request.url;
6 if (url.indexOf('dummy-dir') == -1) { 6 if (url.indexOf('dummy-dir') == -1) {
7 return; 7 return;
8 } 8 }
9 var result = 'mode=' + event.request.mode + 9 var result = 'mode=' + event.request.mode +
10 ' credentials=' + event.request.credentials; 10 ' credentials=' + event.request.credentials;
11 if (url == host_info.HTTP_ORIGIN + '/dummy-dir/same.html') { 11 if (url == host_info.HTTPS_ORIGIN + '/dummy-dir/same.html') {
12 event.respondWith(new Response( 12 event.respondWith(new Response(
13 result + 13 result +
14 '<link id="same-same" rel="import" ' + 14 '<link id="same-same" rel="import" ' +
15 'href="' + host_info.HTTP_ORIGIN + '/dummy-dir/same-same.html">' + 15 'href="' + host_info.HTTPS_ORIGIN + '/dummy-dir/same-same.html">' +
16 '<link id="same-other" rel="import" ' + 16 '<link id="same-other" rel="import" ' +
17 ' href="' + host_info.HTTP_REMOTE_ORIGIN + 17 ' href="' + host_info.HTTPS_REMOTE_ORIGIN +
18 '/dummy-dir/same-other.html">')); 18 '/dummy-dir/same-other.html">'));
19 } else if (url == host_info.HTTP_REMOTE_ORIGIN + '/dummy-dir/other.html') { 19 } else if (url == host_info.HTTPS_REMOTE_ORIGIN + '/dummy-dir/other.html') {
20 event.respondWith(new Response( 20 event.respondWith(new Response(
21 result + 21 result +
22 '<link id="other-same" rel="import" ' + 22 '<link id="other-same" rel="import" ' +
23 ' href="' + host_info.HTTP_ORIGIN + '/dummy-dir/other-same.html">' + 23 ' href="' + host_info.HTTPS_ORIGIN + '/dummy-dir/other-same.html">' +
24 '<link id="other-other" rel="import" ' + 24 '<link id="other-other" rel="import" ' +
25 ' href="' + host_info.HTTP_REMOTE_ORIGIN + 25 ' href="' + host_info.HTTPS_REMOTE_ORIGIN +
26 '/dummy-dir/other-other.html">')); 26 '/dummy-dir/other-other.html">'));
27 } else { 27 } else {
28 event.respondWith(new Response(result)); 28 event.respondWith(new Response(result));
29 } 29 }
30 }); 30 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698