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

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: set state ContextStopped 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
« no previous file with comments | « Source/bindings/v8/V8GarbageCollected.h ('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 /* 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 188
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 if (promise.isEmpty()) {
199 // The document was detached during registration. The state doesn't real ly
200 // matter since this ServiceWorker will immediately die.
201 setProxyState(ContextStopped);
202 return;
203 }
198 setProxyState(RegisterPromisePending); 204 setProxyState(RegisterPromisePending);
199 promise.then(ThenFunction::create(this)); 205 promise.then(ThenFunction::create(this));
200 } 206 }
201 207
202 bool ServiceWorker::hasPendingActivity() const 208 bool ServiceWorker::hasPendingActivity() const
203 { 209 {
204 if (AbstractWorker::hasPendingActivity()) 210 if (AbstractWorker::hasPendingActivity())
205 return true; 211 return true;
206 if (m_proxyState == ContextStopped) 212 if (m_proxyState == ContextStopped)
207 return false; 213 return false;
(...skipping 17 matching lines...) Expand all
225 , WebServiceWorkerProxy(this) 231 , WebServiceWorkerProxy(this)
226 , m_outerWorker(worker) 232 , m_outerWorker(worker)
227 , m_proxyState(Initial) 233 , m_proxyState(Initial)
228 { 234 {
229 ScriptWrappable::init(this); 235 ScriptWrappable::init(this);
230 ASSERT(m_outerWorker); 236 ASSERT(m_outerWorker);
231 m_outerWorker->setProxy(this); 237 m_outerWorker->setProxy(this);
232 } 238 }
233 239
234 } // namespace WebCore 240 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/V8GarbageCollected.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698