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

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

Issue 1321723009: Protocol handlers should be able to register a service worker. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 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
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_request_handler.cc
diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc
index 6d7d04b2e0a1b99a9101916faee3f4dd1612a9fb..2702e62b5fc5ee9bda37a9037d2a5349f80aa450 100644
--- a/content/browser/service_worker/service_worker_request_handler.cc
+++ b/content/browser/service_worker/service_worker_request_handler.cc
@@ -11,9 +11,11 @@
#include "content/browser/service_worker/service_worker_provider_host.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_url_request_job.h"
+#include "content/browser/storage_partition_impl.h"
#include "content/common/resource_request_body.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/common/service_worker/service_worker_utils.h"
+#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/resource_context.h"
#include "content/public/common/origin_util.h"
#include "net/base/net_util.h"
@@ -65,10 +67,19 @@ void ServiceWorkerRequestHandler::InitializeHandler(
RequestContextType request_context_type,
RequestContextFrameType frame_type,
scoped_refptr<ResourceRequestBody> body) {
+ BrowserContext* browser_context =
+ context_wrapper->storage_partition()
+ ? context_wrapper->storage_partition()->browser_context()
+ : nullptr;
+
// Create the handler even for insecure HTTP since it's used in the
// case of redirect to HTTPS.
if (!request->url().SchemeIsHTTPOrHTTPS() &&
- !OriginCanAccessServiceWorkers(request->url())) {
+ !OriginCanAccessServiceWorkers(request->url()) &&
+ !GetContentClient()
+ ->browser()
+ ->GetHandlerFor(browser_context, request->url())
+ .SchemeIsHTTPOrHTTPS()) {
return;
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | content/public/browser/content_browser_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698