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

Unified Diff: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp

Issue 1390943003: Bypass ServiceWorker when the request originates from isolated world. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to .js file. Created 5 years, 2 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 | « chrome/test/data/extensions/api_test/service_worker/content_script_fetch/manifest.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index adb2523a114ca4adb00eedd0998559d3eaa2e2df..b8f8f69f972bf9b70f90d5bd53d8c719b0599d9a 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -182,6 +182,17 @@ DocumentThreadableLoader::DocumentThreadableLoader(Document& document, Threadabl
page->chromeClient().didObserveNonGetFetchFromScript();
}
+ // When the request is from different isolated world such as Chrome
+ // extension's content script, we don't send the request to the Service
+ // Worker of the document.
+ if (!m_document.securityOrigin()->isSameSchemeHostPort(securityOrigin())) {
Mike West 2015/10/19 11:55:18 1. This doesn't have anything to do with isolated
horo 2015/10/19 12:49:32 I thought that if the fetch (and XHR) is called fr
kinuko (google) 2015/10/19 14:57:30 Drive-by... I don't think isolated world has anyth
+ ResourceRequest newRequest(request);
+ newRequest.setSkipServiceWorker(true);
+ dispatchInitialRequest(newRequest);
+ // |this| may be dead here in async mode.
+ return;
+ }
+
// If the fetch request will be handled by the ServiceWorker, the
// FetchRequestMode of the request must be FetchRequestModeCORS or
// FetchRequestModeCORSWithForcedPreflight. Otherwise the ServiceWorker can
« no previous file with comments | « chrome/test/data/extensions/api_test/service_worker/content_script_fetch/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698