diff --git a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp index 67a578a828..88c691cdf0 100644 --- a/netwerk/protocol/websocket/BaseWebSocketChannel.cpp +++ b/netwerk/protocol/websocket/BaseWebSocketChannel.cpp @@ -62,6 +62,11 @@ BaseWebSocketChannel::BaseWebSocketChannel() mSerial = (processBits << kWebSocketIDWebSocketBits) | webSocketBits; } +BaseWebSocketChannel::~BaseWebSocketChannel() { + NS_ReleaseOnMainThread(mLoadGroup.forget()); + NS_ReleaseOnMainThread(mLoadInfo.forget()); +} + //----------------------------------------------------------------------------- // BaseWebSocketChannel::nsIWebSocketChannel //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/websocket/BaseWebSocketChannel.h b/netwerk/protocol/websocket/BaseWebSocketChannel.h index 7498ae0bf6..154f5c80a7 100644 --- a/netwerk/protocol/websocket/BaseWebSocketChannel.h +++ b/netwerk/protocol/websocket/BaseWebSocketChannel.h @@ -79,6 +79,7 @@ class BaseWebSocketChannel : public nsIWebSocketChannel, }; protected: + virtual ~BaseWebSocketChannel(); nsCOMPtr mOriginalURI; nsCOMPtr mURI; RefPtr mListenerMT; diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index 679252500f..058dc46417 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -1243,8 +1243,6 @@ WebSocketChannel::~WebSocketChannel() mListenerMT = nullptr; - NS_ReleaseOnMainThread(mLoadGroup.forget()); - NS_ReleaseOnMainThread(mLoadInfo.forget()); NS_ReleaseOnMainThread(mService.forget()); } diff --git a/netwerk/protocol/websocket/WebSocketChannel.h b/netwerk/protocol/websocket/WebSocketChannel.h index 94a50fd958..bd75ca3a81 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.h +++ b/netwerk/protocol/websocket/WebSocketChannel.h @@ -124,7 +124,7 @@ public: const static uint8_t kPayloadLengthBitsMask = 0x7F; protected: - virtual ~WebSocketChannel(); + ~WebSocketChannel() override; private: friend class OutboundEnqueuer;