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

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

Issue 326853002: Revert of Add an ASSERT about cross-world wrapper leakage into ScriptValue (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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/RespondWithObserver.h" 6 #include "modules/serviceworkers/RespondWithObserver.h"
7 7
8 #include "V8Response.h" 8 #include "V8Response.h"
9 #include "bindings/v8/ScriptFunction.h" 9 #include "bindings/v8/ScriptFunction.h"
10 #include "bindings/v8/ScriptPromise.h" 10 #include "bindings/v8/ScriptPromise.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 ContextLifecycleObserver::contextDestroyed(); 70 ContextLifecycleObserver::contextDestroyed();
71 m_state = Done; 71 m_state = Done;
72 } 72 }
73 73
74 void RespondWithObserver::didDispatchEvent() 74 void RespondWithObserver::didDispatchEvent()
75 { 75 {
76 if (m_state == Initial) 76 if (m_state == Initial)
77 sendResponse(nullptr); 77 sendResponse(nullptr);
78 } 78 }
79 79
80 void RespondWithObserver::respondWith(ScriptState* scriptState, const ScriptValu e& value) 80 void RespondWithObserver::respondWith(const ScriptValue& value)
81 { 81 {
82 if (m_state != Initial) 82 if (m_state != Initial)
83 return; 83 return;
84 84
85 m_state = Pending; 85 m_state = Pending;
86 ScriptPromise::cast(scriptState, value).then( 86 ScriptPromise::cast(value).then(
87 ThenFunction::create(this, ThenFunction::Fulfilled), 87 ThenFunction::create(this, ThenFunction::Fulfilled),
88 ThenFunction::create(this, ThenFunction::Rejected)); 88 ThenFunction::create(this, ThenFunction::Rejected));
89 } 89 }
90 90
91 void RespondWithObserver::sendResponse(PassRefPtr<Response> response) 91 void RespondWithObserver::sendResponse(PassRefPtr<Response> response)
92 { 92 {
93 if (!executionContext()) 93 if (!executionContext())
94 return; 94 return;
95 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven t(m_eventID, response); 95 ServiceWorkerGlobalScopeClient::from(executionContext())->didHandleFetchEven t(m_eventID, response);
96 m_state = Done; 96 m_state = Done;
(...skipping 18 matching lines...) Expand all
115 } 115 }
116 116
117 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID) 117 RespondWithObserver::RespondWithObserver(ExecutionContext* context, int eventID)
118 : ContextLifecycleObserver(context) 118 : ContextLifecycleObserver(context)
119 , m_eventID(eventID) 119 , m_eventID(eventID)
120 , m_state(Initial) 120 , m_state(Initial)
121 { 121 {
122 } 122 }
123 123
124 } // namespace WebCore 124 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/serviceworkers/RespondWithObserver.h ('k') | Source/modules/serviceworkers/WaitUntilObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698