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

Unified Diff: content/browser/service_worker/foreign_fetch_request_handler.cc

Issue 1656933003: Add origins argument to registerForeignFetchScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add url::Origin::operator== to make tests simpler Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_database.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/foreign_fetch_request_handler.cc
diff --git a/content/browser/service_worker/foreign_fetch_request_handler.cc b/content/browser/service_worker/foreign_fetch_request_handler.cc
index aa085bd53a0ecb317da16981dddb42845b58d7b9..b4cce4a23957305531afe61adac8eafab1bf1334 100644
--- a/content/browser/service_worker/foreign_fetch_request_handler.cc
+++ b/content/browser/service_worker/foreign_fetch_request_handler.cc
@@ -180,7 +180,14 @@ void ForeignFetchRequestHandler::DidFindRegistration(
}
}
- if (!scope_matches) {
+ const url::Origin& request_origin = job->request()->initiator();
+ bool origin_matches = active_version->foreign_fetch_origins().empty();
+ for (const url::Origin& origin : active_version->foreign_fetch_origins()) {
+ if (request_origin.IsSameOriginWith(origin))
+ origin_matches = true;
+ }
+
+ if (!scope_matches || !origin_matches) {
job->FallbackToNetwork();
return;
}
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698