Bug 1323425 - WebSocket::CreateAndDispatchCloseEvent must check if mImpl has been nullified, r=smaug

This commit is contained in:
Andrea Marchesini 2017-01-05 16:16:30 +01:00
parent 91b032beba
commit 250fc8ec0c

View File

@ -2022,10 +2022,11 @@ WebSocket::CreateAndDispatchCloseEvent(bool aWasClean,
uint16_t aCode,
const nsAString& aReason)
{
MOZ_ASSERT(mImpl);
AssertIsOnTargetThread();
if (mImpl->mChannel) {
// This method is called by a runnable and it can happen that, in the
// meantime, GC unlinked this object, so mImpl could be null.
if (mImpl && mImpl->mChannel) {
mImpl->mService->WebSocketClosed(mImpl->mChannel->Serial(),
mImpl->mInnerWindowID,
aWasClean, aCode, aReason);