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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/security/suborigins/resources/sw-reject-all-with-error.js

Issue 2343053002: Service worker bypass for resource requests from suborigins (Closed)
Patch Set: More nits from falken Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/security/suborigins/resources/sw-reject-all-with-error.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/security/suborigins/resources/sw-reject-all-with-error.js b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/resources/sw-reject-all-with-error.js
new file mode 100644
index 0000000000000000000000000000000000000000..46849cb7b191db2d5baee37aa14649ada93221de
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/security/suborigins/resources/sw-reject-all-with-error.js
@@ -0,0 +1,8 @@
+// This service worker, once installed, will reject all resource requests,
+// unless the resource has 'bypass' in the URL. For those URLs, it simply
+// passes through the request.
+self.addEventListener('fetch', function(event) {
+ if (event.request.url.indexOf('bypass') != -1)
+ event.respondWith(fetch.event.request);
+ event.respondWith(Promise.reject(Error('Rejecting all requests')));
+});

Powered by Google App Engine
This is Rietveld 408576698