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

Side by Side Diff: Source/modules/serviceworkers/WaitUntilObserver.cpp

Issue 210833004: Inform the client when the Service Worker rejects an install event (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: use m_hasError in WaitUntilObserver Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "modules/serviceworkers/WaitUntilObserver.h" 6 #include "modules/serviceworkers/WaitUntilObserver.h"
7 7
8 #include "bindings/v8/ScriptFunction.h" 8 #include "bindings/v8/ScriptFunction.h"
9 #include "bindings/v8/ScriptPromise.h" 9 #include "bindings/v8/ScriptPromise.h"
10 #include "bindings/v8/ScriptValue.h" 10 #include "bindings/v8/ScriptValue.h"
11 #include "core/dom/ExecutionContext.h" 11 #include "core/dom/ExecutionContext.h"
12 #include "platform/NotImplemented.h" 12 #include "platform/NotImplemented.h"
13 #include "public/platform/WebServiceWorkerEventResult.h"
13 #include "wtf/Assertions.h" 14 #include "wtf/Assertions.h"
14 #include "wtf/RefCounted.h" 15 #include "wtf/RefCounted.h"
15 #include "wtf/RefPtr.h" 16 #include "wtf/RefPtr.h"
16 17
17 namespace WebCore { 18 namespace WebCore {
18 19
19 class WaitUntilObserver::ThenFunction FINAL : public ScriptFunction { 20 class WaitUntilObserver::ThenFunction FINAL : public ScriptFunction {
20 public: 21 public:
21 enum ResolveType { 22 enum ResolveType {
22 Fulfilled, 23 Fulfilled,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 incrementPendingActivity(); 78 incrementPendingActivity();
78 ScriptPromise::cast(value).then( 79 ScriptPromise::cast(value).then(
79 ThenFunction::create(this, ThenFunction::Fulfilled), 80 ThenFunction::create(this, ThenFunction::Fulfilled),
80 ThenFunction::create(this, ThenFunction::Rejected)); 81 ThenFunction::create(this, ThenFunction::Rejected));
81 } 82 }
82 83
83 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID) 84 WaitUntilObserver::WaitUntilObserver(ExecutionContext* context, int eventID)
84 : ContextLifecycleObserver(context) 85 : ContextLifecycleObserver(context)
85 , m_eventID(eventID) 86 , m_eventID(eventID)
86 , m_pendingActivity(0) 87 , m_pendingActivity(0)
88 , m_hasError(false)
87 { 89 {
88 } 90 }
89 91
90 void WaitUntilObserver::reportError(const ScriptValue& value) 92 void WaitUntilObserver::reportError(const ScriptValue& value)
91 { 93 {
92 // FIXME: Propagate error message to the client for onerror handling. 94 // FIXME: Propagate error message to the client for onerror handling.
93 notImplemented(); 95 notImplemented();
96
97 m_hasError = true;
94 } 98 }
95 99
96 void WaitUntilObserver::incrementPendingActivity() 100 void WaitUntilObserver::incrementPendingActivity()
97 { 101 {
98 ++m_pendingActivity; 102 ++m_pendingActivity;
99 } 103 }
100 104
101 void WaitUntilObserver::decrementPendingActivity() 105 void WaitUntilObserver::decrementPendingActivity()
102 { 106 {
103 ASSERT(m_pendingActivity > 0); 107 ASSERT(m_pendingActivity > 0);
104 if (--m_pendingActivity || !executionContext()) 108 if (--m_pendingActivity || !executionContext())
105 return; 109 return;
106 110
107 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv ent(m_eventID); 111 blink::WebServiceWorkerEventResult result = m_hasError ? blink::WebServiceWo rkerEventResultRejected : blink::WebServiceWorkerEventResultCompleted;
112 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleInstallEv ent(m_eventID, result);
108 observeContext(0); 113 observeContext(0);
109 } 114 }
110 115
111 } // namespace WebCore 116 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/WaitUntilObserver.h ('k') | Source/web/ServiceWorkerGlobalScopeClientImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698