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

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

Issue 337053004: Don't assert when ServiceWorker::from is passed an empty promise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: set state ContextStopped Created 6 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
« no previous file with comments | « Source/bindings/v8/V8GarbageCollected.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/serviceworkers/ServiceWorker.cpp
diff --git a/Source/modules/serviceworkers/ServiceWorker.cpp b/Source/modules/serviceworkers/ServiceWorker.cpp
index 84bca65e79e81427d9d0f4b574245993cbde3738..1e3163b9e171f5993ed22fba43f81e61c907bda5 100644
--- a/Source/modules/serviceworkers/ServiceWorker.cpp
+++ b/Source/modules/serviceworkers/ServiceWorker.cpp
@@ -195,6 +195,12 @@ void ServiceWorker::onPromiseResolved()
void ServiceWorker::waitOnPromise(ScriptPromise promise)
{
+ if (promise.isEmpty()) {
+ // The document was detached during registration. The state doesn't really
+ // matter since this ServiceWorker will immediately die.
+ setProxyState(ContextStopped);
+ return;
+ }
setProxyState(RegisterPromisePending);
promise.then(ThenFunction::create(this));
}
« no previous file with comments | « Source/bindings/v8/V8GarbageCollected.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698