| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |