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

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: 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 return existingServiceWorker; 150 return existingServiceWorker;
151 } 151 }
152 152
153 return create(executionContext, adoptPtr(worker)); 153 return create(executionContext, adoptPtr(worker));
154 } 154 }
155 155
156 PassRefPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolverWithContext* resolver, WebType* worker) 156 PassRefPtr<ServiceWorker> ServiceWorker::from(ScriptPromiseResolverWithContext* resolver, WebType* worker)
157 { 157 {
158 RefPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolver->scriptSt ate()->executionContext(), worker); 158 RefPtr<ServiceWorker> serviceWorker = ServiceWorker::from(resolver->scriptSt ate()->executionContext(), worker);
159 ScriptState::Scope scope(resolver->scriptState()); 159 ScriptState::Scope scope(resolver->scriptState());
160 serviceWorker->waitOnPromise(resolver->promise()); 160 if (!resolver->promise().isEmpty())
haraken 2014/06/17 00:51:55 Shall we move this check into ServiceWorker::waitO
falken 2014/06/17 01:07:51 Good idea, I've done this.
161 serviceWorker->waitOnPromise(resolver->promise());
161 return serviceWorker; 162 return serviceWorker;
162 } 163 }
163 164
164 void ServiceWorker::onPromiseResolved() 165 void ServiceWorker::onPromiseResolved()
165 { 166 {
166 ASSERT(m_isPromisePending); 167 ASSERT(m_isPromisePending);
167 m_isPromisePending = false; 168 m_isPromisePending = false;
168 m_outerWorker->proxyReadyChanged(); 169 m_outerWorker->proxyReadyChanged();
169 } 170 }
170 171
(...skipping 17 matching lines...) Expand all
188 , WebServiceWorkerProxy(this) 189 , WebServiceWorkerProxy(this)
189 , m_outerWorker(worker) 190 , m_outerWorker(worker)
190 , m_isPromisePending(false) 191 , m_isPromisePending(false)
191 { 192 {
192 ScriptWrappable::init(this); 193 ScriptWrappable::init(this);
193 ASSERT(m_outerWorker); 194 ASSERT(m_outerWorker);
194 m_outerWorker->setProxy(this); 195 m_outerWorker->setProxy(this);
195 } 196 }
196 197
197 } // namespace WebCore 198 } // namespace WebCore
OLDNEW
« Source/bindings/v8/ScriptPromise.cpp ('K') | « Source/bindings/v8/ScriptPromise.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698