Bug 1744561, check that mESImpl is still non-null after dispatching a WorkerMainThreadRunnable (InitRunnable), r=jstutte
Differential Revision: https://phabricator.services.mozilla.com/D133132
This commit is contained in:
@@ -2038,13 +2038,17 @@ already_AddRefed<EventSource> EventSource::Constructor(
|
|||||||
|
|
||||||
// In workers we have to keep the worker alive using a WorkerRef in order
|
// In workers we have to keep the worker alive using a WorkerRef in order
|
||||||
// to dispatch messages correctly.
|
// to dispatch messages correctly.
|
||||||
if (!eventSource->mESImpl->CreateWorkerRef(workerPrivate)) {
|
// Note, initRunnable->Dispatch may have cleared mESImpl.
|
||||||
|
if (!eventSource->mESImpl ||
|
||||||
|
!eventSource->mESImpl->CreateWorkerRef(workerPrivate)) {
|
||||||
// The worker is already shutting down. Let's return an already closed
|
// The worker is already shutting down. Let's return an already closed
|
||||||
// object, but marked as Connecting.
|
// object, but marked as Connecting.
|
||||||
|
if (eventSource->mESImpl) {
|
||||||
// mESImpl is nulled by this call such that EventSourceImpl is
|
// mESImpl is nulled by this call such that EventSourceImpl is
|
||||||
// released before returning the object, otherwise
|
// released before returning the object, otherwise
|
||||||
// it will set EventSource to a CLOSED state in its DTOR..
|
// it will set EventSource to a CLOSED state in its DTOR..
|
||||||
eventSource->mESImpl->Close();
|
eventSource->mESImpl->Close();
|
||||||
|
}
|
||||||
eventSource->mReadyState = EventSourceImpl::CONNECTING;
|
eventSource->mReadyState = EventSourceImpl::CONNECTING;
|
||||||
|
|
||||||
return eventSource.forget();
|
return eventSource.forget();
|
||||||
|
|||||||
Reference in New Issue
Block a user