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

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

Issue 1870743002: Foreign fetch should not intercept same origin or main resource requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix function name style Created 4 years, 8 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 | third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html » ('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 ee9aa4b49dd84b0de863f1e8be851310680bd719..2034266deb008f00ac5cfd24906801543e05a250 100644
--- a/content/browser/service_worker/foreign_fetch_request_handler.cc
+++ b/content/browser/service_worker/foreign_fetch_request_handler.cc
@@ -67,6 +67,11 @@ void ForeignFetchRequestHandler::InitializeHandler(
return;
}
+ if (request->initiator().IsSameOriginWith(url::Origin(request->url())))
+ return;
+ if (ServiceWorkerUtils::IsMainResourceType(resource_type))
+ return;
+
// Any more precise checks to see if the request should be intercepted are
// asynchronous, so just create our handler in all cases.
std::unique_ptr<ForeignFetchRequestHandler> handler(
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/foreign-fetch-basics.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698