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

Unified Diff: LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js

Issue 732003002: Use the request URL as the URL of the resources which are fetched ServiceWorker [3/3 blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add comment Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js b/LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..5405562dd3436777bb1ddd96a84f2ad412bcd476
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/resources/fetch-request-css-base-url-worker.js
@@ -0,0 +1,26 @@
+importScripts('test-helpers.js');
+
+var port = undefined;
+
+self.onmessage = function(e) {
+ var message = e.data;
+ if ('port' in message) {
+ port = message.port;
+ port.postMessage({ready: true});
+ }
+};
+
+self.addEventListener('fetch', function(event) {
+ var url = event.request.url;
+ if (url.indexOf('fetch-request-css-base-url-style.css') != -1) {
+ event.respondWith(fetch(
+ get_host_info()['HTTP_REMOTE_ORIGIN'] + base_path() +
+ 'fetch-request-css-base-url-style.css',
+ {mode: 'no-cors'}));
+ } else if (url.indexOf('dummy.png') != -1) {
+ port.postMessage({
+ url: event.request.url,
+ referrer: event.request.referrer
+ });
+ }
+ });

Powered by Google App Engine
This is Rietveld 408576698