But, I think https://searchfox.org/mozilla-central/rev/033cc91cd088a992ab8728bab9821624cee62ce5/dom/websocket/WebSocket.cpp#1423 can be problematic. Not because mImpl is raw pointer, but because nothing keeps WebSocketImpl alive on _stack_. We need a RefPtr there since in FailConnection() ConsoleError() call may (I think) trigger deletion of WebSocketImpl, and then we keep executing FailConnection() and there is CloseConnection() call which uses Dispatch.
Bug 1846328 Comment 20 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
But, I think https://searchfox.org/mozilla-central/rev/033cc91cd088a992ab8728bab9821624cee62ce5/dom/websocket/WebSocket.cpp#1423 can be problematic. Not because mImpl is a raw pointer, but because nothing keeps WebSocketImpl alive on _stack_. We need a RefPtr there since in FailConnection() ConsoleError() call may (I think) trigger deletion of WebSocketImpl, and then we keep executing FailConnection() and there is CloseConnection() call which uses Dispatch. There might be some other issues too.
But, I think https://searchfox.org/mozilla-central/rev/033cc91cd088a992ab8728bab9821624cee62ce5/dom/websocket/WebSocket.cpp#2523 can be problematic. Not because mImpl is a raw pointer, but because nothing keeps WebSocketImpl alive on _stack_. We need a RefPtr there since in FailConnection() ConsoleError() call may (I think) trigger deletion of WebSocketImpl, and then we keep executing FailConnection() and there is CloseConnection() call which uses Dispatch. There might be some other issues too.
But, I think https://searchfox.org/mozilla-central/rev/033cc91cd088a992ab8728bab9821624cee62ce5/dom/websocket/WebSocket.cpp#2523 can be problematic. Not because mImpl is a raw pointer, but because nothing keeps WebSocketImpl alive on _stack_. We need a RefPtr there since in FailConnection() ConsoleError() call may (I think) trigger deletion of WebSocketImpl, and then we keep executing FailConnection() and there is CloseConnection() call which uses Dispatch. (Need to check all the similar impl->Foo() calls) There might be some other unrelated issues too.