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

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

Issue 2867023002: [ServiceWorker] waitUntil() should wait until all promises got resolved/rejected. (Closed)
Patch Set: Remove old FIXME 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/WaitUntilObserver.cpp
diff --git a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp
index 839f336a2d17707a5f95b998d9b2cb2cfe5e688f..acd4129b4806a9f08ff4335354c29046cc805ec9 100644
--- a/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp
+++ b/third_party/WebKit/Source/modules/serviceworkers/WaitUntilObserver.cpp
@@ -65,7 +65,7 @@ class WaitUntilObserver::ThenFunction final : public ScriptFunction {
ASSERT(observer_);
ASSERT(resolve_type_ == kFulfilled || resolve_type_ == kRejected);
if (resolve_type_ == kRejected) {
- observer_->ReportError(value);
+ observer_->ReportPromiseRejected(value);
value =
ScriptPromise::Reject(value.GetScriptState(), value).GetScriptValue();
}
@@ -143,11 +143,8 @@ WaitUntilObserver::WaitUntilObserver(ExecutionContext* context,
this,
&WaitUntilObserver::ConsumeWindowInteraction) {}
-void WaitUntilObserver::ReportError(const ScriptValue& value) {
- // FIXME: Propagate error message to the client for onerror handling.
- NOTIMPLEMENTED();
-
- has_error_ = true;
+void WaitUntilObserver::ReportPromiseRejected(const ScriptValue& value) {
+ has_rejected_promise_ = true;
}
void WaitUntilObserver::IncrementPendingActivity() {
@@ -162,8 +159,9 @@ void WaitUntilObserver::DecrementPendingActivity() {
ServiceWorkerGlobalScopeClient* client =
ServiceWorkerGlobalScopeClient::From(execution_context_);
WebServiceWorkerEventResult result =
- has_error_ ? kWebServiceWorkerEventResultRejected
- : kWebServiceWorkerEventResultCompleted;
+ (has_error_ || has_rejected_promise_)
+ ? kWebServiceWorkerEventResultRejected
+ : kWebServiceWorkerEventResultCompleted;
switch (type_) {
case kActivate:
client->DidHandleActivateEvent(event_id_, result, event_dispatch_time_);

Powered by Google App Engine
This is Rietveld 408576698