diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/websocket | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/websocket')
-rw-r--r-- | dom/websocket/WebSocket.cpp | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/dom/websocket/WebSocket.cpp b/dom/websocket/WebSocket.cpp index d0be6e1778..04b28798ae 100644 --- a/dom/websocket/WebSocket.cpp +++ b/dom/websocket/WebSocket.cpp @@ -1612,6 +1612,19 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure, nsresult rv = mWebSocket->CheckCurrentGlobalCorrectness(); NS_ENSURE_SUCCESS(rv, rv); + // Assign the sub protocol list and scan it for illegal values + for (uint32_t index = 0; index < aProtocolArray.Length(); ++index) { + if (!WebSocket::IsValidProtocolString(aProtocolArray[index])) { + return NS_ERROR_DOM_SYNTAX_ERR; + } + + if (!mRequestedProtocolList.IsEmpty()) { + mRequestedProtocolList.AppendLiteral(", "); + } + + AppendUTF16toUTF8(aProtocolArray[index], mRequestedProtocolList); + } + // Shut down websocket if window is frozen or destroyed (only needed for // "ghost" websockets--see bug 696085) RefPtr<WebSocketImplProxy> proxy; @@ -1795,19 +1808,6 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure, } } - // Assign the sub protocol list and scan it for illegal values - for (uint32_t index = 0; index < aProtocolArray.Length(); ++index) { - if (!WebSocket::IsValidProtocolString(aProtocolArray[index])) { - return NS_ERROR_DOM_SYNTAX_ERR; - } - - if (!mRequestedProtocolList.IsEmpty()) { - mRequestedProtocolList.AppendLiteral(", "); - } - - AppendUTF16toUTF8(aProtocolArray[index], mRequestedProtocolList); - } - if (mIsMainThread) { mImplProxy = std::move(proxy); } @@ -2639,8 +2639,7 @@ namespace { class CancelRunnable final : public MainThreadWorkerRunnable { public: CancelRunnable(ThreadSafeWorkerRef* aWorkerRef, WebSocketImpl* aImpl) - : MainThreadWorkerRunnable(aWorkerRef->Private(), "CancelRunnable"), - mImpl(aImpl) {} + : MainThreadWorkerRunnable("CancelRunnable"), mImpl(aImpl) {} bool WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override { aWorkerPrivate->AssertIsOnWorkerThread(); @@ -2675,7 +2674,7 @@ WebSocketImpl::Cancel(nsresult aStatus) { if (!mIsMainThread) { MOZ_ASSERT(mWorkerRef); RefPtr<CancelRunnable> runnable = new CancelRunnable(mWorkerRef, this); - if (!runnable->Dispatch()) { + if (!runnable->Dispatch(mWorkerRef->Private())) { return NS_ERROR_FAILURE; } @@ -2785,15 +2784,14 @@ WebSocketImpl::SetTRRMode(nsIRequest::TRRMode aTRRMode) { namespace { -class WorkerRunnableDispatcher final : public WorkerRunnable { +class WorkerRunnableDispatcher final : public WorkerThreadRunnable { RefPtr<WebSocketImpl> mWebSocketImpl; public: WorkerRunnableDispatcher(WebSocketImpl* aImpl, ThreadSafeWorkerRef* aWorkerRef, already_AddRefed<nsIRunnable> aEvent) - : WorkerRunnable(aWorkerRef->Private(), "WorkerRunnableDispatcher", - WorkerThread), + : WorkerThreadRunnable("WorkerRunnableDispatcher"), mWebSocketImpl(aImpl), mEvent(std::move(aEvent)) {} @@ -2861,7 +2859,7 @@ WebSocketImpl::Dispatch(already_AddRefed<nsIRunnable> aEvent, uint32_t aFlags) { RefPtr<WorkerRunnableDispatcher> event = new WorkerRunnableDispatcher(this, mWorkerRef, event_ref.forget()); - if (!event->Dispatch()) { + if (!event->Dispatch(mWorkerRef->Private())) { return NS_ERROR_FAILURE; } |