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

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

Issue 442183003: FetchEvent should not forcibly reject an unresolved Promise when destructed (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/RespondWithObserver.h" 6 #include "modules/serviceworkers/RespondWithObserver.h"
7 7
8 #include "bindings/core/v8/ScriptFunction.h" 8 #include "bindings/core/v8/ScriptFunction.h"
9 #include "bindings/core/v8/ScriptPromise.h" 9 #include "bindings/core/v8/ScriptPromise.h"
10 #include "bindings/core/v8/ScriptValue.h" 10 #include "bindings/core/v8/ScriptValue.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ResolveType m_resolveType; 55 ResolveType m_resolveType;
56 }; 56 };
57 57
58 PassRefPtr<RespondWithObserver> RespondWithObserver::create(ExecutionContext* co ntext, int eventID) 58 PassRefPtr<RespondWithObserver> RespondWithObserver::create(ExecutionContext* co ntext, int eventID)
59 { 59 {
60 return adoptRef(new RespondWithObserver(context, eventID)); 60 return adoptRef(new RespondWithObserver(context, eventID));
61 } 61 }
62 62
63 RespondWithObserver::~RespondWithObserver() 63 RespondWithObserver::~RespondWithObserver()
64 { 64 {
65 if (m_state == Pending)
66 sendResponse(nullptr);
67 } 65 }
68 66
69 void RespondWithObserver::contextDestroyed() 67 void RespondWithObserver::contextDestroyed()
70 { 68 {
71 ContextLifecycleObserver::contextDestroyed(); 69 ContextLifecycleObserver::contextDestroyed();
72 m_state = Done; 70 m_state = Done;
73 } 71 }
74 72
75 void RespondWithObserver::didDispatchEvent() 73 void RespondWithObserver::didDispatchEvent()
76 { 74 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 114 }
117 115
118 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID) 116 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID)
119 : ContextLifecycleObserver(context) 117 : ContextLifecycleObserver(context)
120 , m_eventID(eventID) 118 , m_eventID(eventID)
121 , m_state(Initial) 119 , m_state(Initial)
122 { 120 {
123 } 121 }
124 122
125 } // namespace blink 123 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/serviceworker/resources/fetch-event-test-worker.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698