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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/foreign-fetch-worker.js

Issue 2332023002: Correctly set requestor origin for worker initiated requests. (Closed)
Patch Set: 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/serviceworker/resources/foreign-fetch-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/foreign-fetch-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/foreign-fetch-worker.js
index 1450dabb577dd72d6badcd94a83f53826eb31950..49a6d3ef33ee65ab964174e70d9331edf8217a04 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/foreign-fetch-worker.js
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/foreign-fetch-worker.js
@@ -26,6 +26,11 @@ function handle_fallback(event) {
// Do nothing.
}
+function handle_fetch(event) {
+ event.respondWith(
+ fetch(event.request).then(response => ({response, origin: event.origin})));
+}
+
function handle_meta(event) {
var data = {
origin: event.origin,
@@ -45,6 +50,7 @@ self.addEventListener('foreignfetch', function(event) {
var handlers = [
{ pattern: '?basic', fn: handle_basic },
{ pattern: '?fallback', fn: handle_fallback },
+ { pattern: '?fetch', fn: handle_fetch },
{ pattern: '?onmessage', fn: handle_onmessage },
{ pattern: '?meta', fn: handle_meta },
{ pattern: '?script', fn: handle_script }

Powered by Google App Engine
This is Rietveld 408576698