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

Unified Diff: third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp

Issue 2877543003: [ServiceWorker] Allow waitUntil to be called multiple times asynchronously (Closed)
Patch Set: Address comments from falken@ Created 3 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
Index: third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp b/third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp
index b3aa4da5d83590e6461c62480be5fd65ebe31d13..4d9fad63ccb75b678d2177655b7f235932dd9094 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/ExtendableEvent.cpp
@@ -52,8 +52,14 @@ ExtendableEvent::~ExtendableEvent() {}
void ExtendableEvent::waitUntil(ScriptState* script_state,
ScriptPromise script_promise,
ExceptionState& exception_state) {
- if (observer_)
- observer_->WaitUntil(script_state, script_promise, exception_state);
+ if (!observer_) {
+ exception_state.ThrowDOMException(
+ kInvalidStateError,
+ "Can not call waitUntil on a script constructed ExtendableEvent.");
+ return;
+ }
+
+ observer_->WaitUntil(script_state, script_promise, exception_state);
}
ExtendableEvent::ExtendableEvent(const AtomicString& type,

Powered by Google App Engine
This is Rietveld 408576698