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

Unified Diff: content/child/service_worker/web_service_worker_provider_impl.cc

Issue 1191293002: Don't create ServiceWorkerProviderHost for sandboxed frames without allow-same-origin flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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: content/child/service_worker/web_service_worker_provider_impl.cc
diff --git a/content/child/service_worker/web_service_worker_provider_impl.cc b/content/child/service_worker/web_service_worker_provider_impl.cc
index 70285faa2abc43eea9401114a48a325e3c5f167a..6bb1e8a6829eac3ac431f7aed61b5025bff588b8 100644
--- a/content/child/service_worker/web_service_worker_provider_impl.cc
+++ b/content/child/service_worker/web_service_worker_provider_impl.cc
@@ -34,6 +34,8 @@ void WebServiceWorkerProviderImpl::setClient(
RemoveProviderClient();
return;
}
+ if (!context_)
kinuko 2015/06/23 10:55:56 Can we add a comment about when context_ is null,
horo 2015/06/23 13:55:13 After https://codereview.chromium.org/1199183002/,
+ return;
// TODO(kinuko): Here we could also register the current thread ID
// on the provider context so that multiple WebServiceWorkerProviderImpl
@@ -53,6 +55,8 @@ void WebServiceWorkerProviderImpl::registerServiceWorker(
const WebURL& pattern,
const WebURL& script_url,
WebServiceWorkerRegistrationCallbacks* callbacks) {
+ if (!context_)
+ return;
kinuko 2015/06/23 10:55:56 Hmm, we'll leak callbacks. Also is it ok not to f
horo 2015/06/23 13:55:14 Same as the former
GetDispatcher()->RegisterServiceWorker(
context_->provider_id(), pattern, script_url, callbacks);
}
@@ -60,26 +64,36 @@ void WebServiceWorkerProviderImpl::registerServiceWorker(
void WebServiceWorkerProviderImpl::getRegistration(
const blink::WebURL& document_url,
WebServiceWorkerRegistrationCallbacks* callbacks) {
+ if (!context_)
+ return;
GetDispatcher()->GetRegistration(
context_->provider_id(), document_url, callbacks);
}
void WebServiceWorkerProviderImpl::getRegistrations(
WebServiceWorkerGetRegistrationsCallbacks* callbacks) {
+ if (!context_)
+ return;
GetDispatcher()->GetRegistrations(
context_->provider_id(), callbacks);
}
void WebServiceWorkerProviderImpl::getRegistrationForReady(
WebServiceWorkerGetRegistrationForReadyCallbacks* callbacks) {
+ if (!context_)
+ return;
GetDispatcher()->GetRegistrationForReady(context_->provider_id(), callbacks);
}
int WebServiceWorkerProviderImpl::provider_id() const {
+ if (!context_)
+ return kInvalidServiceWorkerProviderId;
return context_->provider_id();
}
void WebServiceWorkerProviderImpl::RemoveProviderClient() {
+ if (!context_)
+ return;
// Remove the provider client, but only if the dispatcher is still there.
// (For cleanup path we don't need to bother creating a new dispatcher)
ServiceWorkerDispatcher* dispatcher =

Powered by Google App Engine
This is Rietveld 408576698