1
0
mirror of https://github.com/roytam1/UXP.git synced 2026-05-26 13:58:49 +00:00

WebSocketChannel::CleanupConnection should run on the socket thread

This commit is contained in:
Moonchild
2022-11-19 14:06:18 +00:00
committed by roytam1
parent 37f0199c79
commit 7fab5ebd11
@@ -2313,6 +2313,16 @@ WebSocketChannel::CleanupConnection()
{
LOG(("WebSocketChannel::CleanupConnection() %p", this));
// This should run on the Socket Thread to prevent potential races.
bool onSocketThread;
nsresult rv = mSocketThread->IsOnCurrentThread(&onSocketThread);
if (NS_SUCCEEDED(rv) && !onSocketThread) {
mSocketThread->Dispatch(
NewRunnableMethod(this, &WebSocketChannel::CleanupConnection),
NS_DISPATCH_NORMAL);
return;
}
if (mLingeringCloseTimer) {
mLingeringCloseTimer->Cancel();
mLingeringCloseTimer = nullptr;