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)); |
} |