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

Unified Diff: Source/modules/serviceworkers/ServiceWorkerContainer.cpp

Issue 1142043002: Add NULL check of ExecutionContext in ServiceWorkerContainer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/ServiceWorkerContainer.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
index 612d37b84959a9cb12573e8e280c148853c39798..4c7d6684f6bd67128e83460171c0d329f8915563 100644
--- a/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
+++ b/Source/modules/serviceworkers/ServiceWorkerContainer.cpp
@@ -134,6 +134,10 @@ ScriptPromise ServiceWorkerContainer::registerServiceWorker(ScriptState* scriptS
}
ExecutionContext* executionContext = scriptState->executionContext();
+ // FIXME: May be null due to worker termination: http://crbug.com/413518.
+ if (!executionContext)
+ return ScriptPromise();
+
RefPtr<SecurityOrigin> documentOrigin = executionContext->securityOrigin();
String errorMessage;
if (!executionContext->isPrivilegedContext(errorMessage)) {
@@ -193,6 +197,10 @@ ScriptPromise ServiceWorkerContainer::getRegistration(ScriptState* scriptState,
}
ExecutionContext* executionContext = scriptState->executionContext();
+ // FIXME: May be null due to worker termination: http://crbug.com/413518.
+ if (!executionContext)
+ return ScriptPromise();
+
RefPtr<SecurityOrigin> documentOrigin = executionContext->securityOrigin();
String errorMessage;
if (!executionContext->isPrivilegedContext(errorMessage)) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698