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

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

Issue 337053004: Don't assert when ServiceWorker::from is passed an empty promise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix V8GarbageCollected ASSERT 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 void ServiceWorker::onPromiseResolved() 189 void ServiceWorker::onPromiseResolved()
190 { 190 {
191 if (m_proxyState == ContextStopped) 191 if (m_proxyState == ContextStopped)
192 return; 192 return;
193 setProxyState(Ready); 193 setProxyState(Ready);
194 } 194 }
195 195
196 void ServiceWorker::waitOnPromise(ScriptPromise promise) 196 void ServiceWorker::waitOnPromise(ScriptPromise promise)
197 { 197 {
198 setProxyState(RegisterPromisePending); 198 setProxyState(RegisterPromisePending);
199 promise.then(ThenFunction::create(this)); 199 if (promise.isEmpty())
200 onPromiseResolved();
201 else
202 promise.then(ThenFunction::create(this));
200 } 203 }
201 204
202 bool ServiceWorker::hasPendingActivity() const 205 bool ServiceWorker::hasPendingActivity() const
203 { 206 {
204 if (AbstractWorker::hasPendingActivity()) 207 if (AbstractWorker::hasPendingActivity())
205 return true; 208 return true;
206 if (m_proxyState == ContextStopped) 209 if (m_proxyState == ContextStopped)
207 return false; 210 return false;
208 return m_outerWorker->state() != blink::WebServiceWorkerStateDeactivated; 211 return m_outerWorker->state() != blink::WebServiceWorkerStateDeactivated;
209 } 212 }
(...skipping 15 matching lines...) Expand all
225 , WebServiceWorkerProxy(this) 228 , WebServiceWorkerProxy(this)
226 , m_outerWorker(worker) 229 , m_outerWorker(worker)
227 , m_proxyState(Initial) 230 , m_proxyState(Initial)
228 { 231 {
229 ScriptWrappable::init(this); 232 ScriptWrappable::init(this);
230 ASSERT(m_outerWorker); 233 ASSERT(m_outerWorker);
231 m_outerWorker->setProxy(this); 234 m_outerWorker->setProxy(this);
232 } 235 }
233 236
234 } // namespace WebCore 237 } // namespace WebCore
OLDNEW
« Source/bindings/v8/V8GarbageCollected.h ('K') | « Source/bindings/v8/V8GarbageCollected.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698