author | Andrea Marchesini <amarchesini@mozilla.com> |
Mon, 10 Jul 2017 15:19:36 -0400 | |
changeset 368046 | bc535203a6eff61f308eb8ddf13afe8268cccb9f |
parent 368045 | 288575a7c30a8eff32249fd4ac557d0f7829de4e |
child 368047 | 9c4bf59ab966a8ec17181d85cc1fc4be7450cca3 |
push id | 92392 |
push user | ryanvm@gmail.com |
push date | Mon, 10 Jul 2017 19:21:57 +0000 |
treeherder | mozilla-inbound@bc535203a6ef [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | smaug |
bugs | 1374047 |
milestone | 56.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -615,16 +615,20 @@ void WebSocketImpl::Disconnect() { if (mDisconnectingOrDisconnected) { return; } AssertIsOnTargetThread(); + // DontKeepAliveAnyMore() and DisconnectInternal() can release the object. So + // hold a reference to this until the end of the method. + RefPtr<WebSocketImpl> kungfuDeathGrip = this; + // Disconnect can be called from some control event (such as Notify() of // WorkerHolder). This will be schedulated before any other sync/async // runnable. In order to prevent some double Disconnect() calls, we use this // boolean. mDisconnectingOrDisconnected = true; // DisconnectInternal touches observers and nsILoadGroup and it must run on // the main thread. @@ -636,20 +640,16 @@ WebSocketImpl::Disconnect() new DisconnectInternalRunnable(this); ErrorResult rv; runnable->Dispatch(Killing, rv); // XXXbz this seems totally broken. We should be propagating this out, but // where to, exactly? rv.SuppressException(); } - // DontKeepAliveAnyMore() can release the object. So hold a reference to this - // until the end of the method. - RefPtr<WebSocketImpl> kungfuDeathGrip = this; - NS_ReleaseOnMainThread("WebSocketImpl::mChannel", mChannel.forget()); NS_ReleaseOnMainThread("WebSocketImpl::mService", mService.forget()); mWebSocket->DontKeepAliveAnyMore(); mWebSocket->mImpl = nullptr; if (mWorkerPrivate && mWorkerHolder) { UnregisterWorkerHolder();