Skip to content

Commit 1bcdae0

Browse files
committed
Backed out changeset 537608d1e4cc (bug 1621345) for many ns related crashes CLOSED TREE
1 parent 475b531 commit 1bcdae0

File tree

7 files changed

+5
-74
lines changed

7 files changed

+5
-74
lines changed

dom/websocket/WebSocket.cpp

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
#include "nsIWebSocketListener.h"
6767
#include "nsProxyRelease.h"
6868
#include "nsWeakReference.h"
69-
#include "nsIWebSocketImpl.h"
7069

7170
#define OPEN_EVENT_STRING NS_LITERAL_STRING("open")
7271
#define MESSAGE_EVENT_STRING NS_LITERAL_STRING("message")
@@ -83,16 +82,14 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
8382
public nsIObserver,
8483
public nsSupportsWeakReference,
8584
public nsIRequest,
86-
public nsIEventTarget,
87-
public nsIWebSocketImpl {
85+
public nsIEventTarget {
8886
public:
8987
NS_DECL_NSIINTERFACEREQUESTOR
9088
NS_DECL_NSIWEBSOCKETLISTENER
9189
NS_DECL_NSIOBSERVER
9290
NS_DECL_NSIREQUEST
9391
NS_DECL_THREADSAFE_ISUPPORTS
9492
NS_DECL_NSIEVENTTARGET_FULL
95-
NS_DECL_NSIWEBSOCKETIMPL
9693

9794
explicit WebSocketImpl(WebSocket* aWebSocket)
9895
: mWebSocket(aWebSocket),
@@ -240,7 +237,7 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
240237

241238
NS_IMPL_ISUPPORTS(WebSocketImpl, nsIInterfaceRequestor, nsIWebSocketListener,
242239
nsIObserver, nsISupportsWeakReference, nsIRequest,
243-
nsIEventTarget, nsIWebSocketImpl)
240+
nsIEventTarget)
244241

245242
class CallDispatchConnectionCloseEvents final : public CancelableRunnable {
246243
public:
@@ -616,22 +613,6 @@ void WebSocketImpl::DisconnectInternal() {
616613
}
617614
}
618615

619-
//-----------------------------------------------------------------------------
620-
// WebSocketImpl::nsIWebSocketImpl
621-
//-----------------------------------------------------------------------------
622-
623-
NS_IMETHODIMP
624-
WebSocketImpl::SendMessage(const nsAString& aMessage) {
625-
nsString message(aMessage);
626-
nsCOMPtr<nsIRunnable> runnable = NS_NewRunnableFunction(
627-
"WebSocketImpl::SendMessage",
628-
[self = RefPtr<WebSocketImpl>(this), message = std::move(message)]() {
629-
ErrorResult IgnoredErrorResult;
630-
self->mWebSocket->Send(message, IgnoredErrorResult);
631-
});
632-
return Dispatch(runnable.forget(), NS_DISPATCH_NORMAL);
633-
}
634-
635616
//-----------------------------------------------------------------------------
636617
// WebSocketImpl::nsIWebSocketListener methods:
637618
//-----------------------------------------------------------------------------
@@ -1798,11 +1779,6 @@ nsresult WebSocketImpl::InitializeConnection(
17981779

17991780
mChannel = wsChannel;
18001781

1801-
nsWeakPtr mWeakWebSocketImpl = do_GetWeakReference(this);
1802-
1803-
mService->AssociateWebSocketImplWithSerialID(mWeakWebSocketImpl,
1804-
mChannel->Serial());
1805-
18061782
if (mIsMainThread && doc) {
18071783
mMainThreadEventTarget = doc->EventTargetFor(TaskCategory::Other);
18081784
}

netwerk/protocol/websocket/WebSocketEventService.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "nsSocketTransportService2.h"
1717
#include "nsThreadUtils.h"
1818
#include "mozilla/Services.h"
19-
#include "nsIWebSocketImpl.h"
2019

2120
namespace mozilla {
2221
namespace net {
@@ -335,24 +334,6 @@ void WebSocketEventService::FrameSent(uint32_t aWebSocketSerialID,
335334
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "NS_DispatchToMainThread failed");
336335
}
337336

338-
void WebSocketEventService::AssociateWebSocketImplWithSerialID(
339-
nsWeakPtr aWeakWebSocketImplPtr, uint32_t aWebSocketSerialID) {
340-
this->mWeakWebSocketImpl.Put(aWebSocketSerialID, &aWeakWebSocketImplPtr);
341-
}
342-
343-
NS_IMETHODIMP
344-
WebSocketEventService::SendMessage(uint32_t aWebSocketSerialID,
345-
const nsAString& aMessage) {
346-
nsresult rv = NS_OK;
347-
348-
nsWeakPtr WeakWebSocketImpl = *(mWeakWebSocketImpl.Get(aWebSocketSerialID));
349-
nsCOMPtr<nsIWebSocketImpl> mWebSocketImpl =
350-
do_QueryReferent(WeakWebSocketImpl);
351-
352-
rv = mWebSocketImpl->SendMessage(aMessage);
353-
return rv;
354-
}
355-
356337
NS_IMETHODIMP
357338
WebSocketEventService::AddListener(uint64_t aInnerWindowID,
358339
nsIWebSocketEventListener* aListener) {

netwerk/protocol/websocket/WebSocketEventService.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ class WebSocketEventService final : public nsIWebSocketEventService,
6262
already_AddRefed<WebSocketFrame> aFrame,
6363
nsIEventTarget* aTarget = nullptr);
6464

65-
void AssociateWebSocketImplWithSerialID(nsWeakPtr aWeakWebSocketImplPtr,
66-
uint32_t aWebSocketSerialID);
67-
6865
already_AddRefed<WebSocketFrame> CreateFrameIfNeeded(
6966
bool aFinBit, bool aRsvBit1, bool aRsvBit2, bool aRsvBit3,
7067
uint8_t aOpCode, bool aMaskBit, uint32_t aMask,
@@ -89,8 +86,6 @@ class WebSocketEventService final : public nsIWebSocketEventService,
8986

9087
typedef nsTArray<nsCOMPtr<nsIWebSocketEventListener>> WindowListeners;
9188

92-
nsClassHashtable<nsUint32HashKey, nsWeakPtr> mWeakWebSocketImpl;
93-
9489
struct WindowListener {
9590
WindowListeners mListeners;
9691
RefPtr<WebSocketEventListenerChild> mActor;

netwerk/protocol/websocket/moz.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ XPIDL_SOURCES += [
1111
'nsITransportProvider.idl',
1212
'nsIWebSocketChannel.idl',
1313
'nsIWebSocketEventService.idl',
14-
'nsIWebSocketImpl.idl',
1514
'nsIWebSocketListener.idl',
1615
]
1716

netwerk/protocol/websocket/nsIWebSocketEventService.idl

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#include "domstubs.idl"
77
#include "nsISupports.idl"
88

9-
interface nsIWeakReference;
10-
119
[scriptable, builtinclass, uuid(6714a6be-2265-4f73-a988-d78a12416037)]
1210
interface nsIWebSocketFrame : nsISupports
1311
{
@@ -74,9 +72,6 @@ interface nsIWebSocketEventListener : nsISupports
7472
[scriptable, builtinclass, uuid(b89d1b90-2cf3-4d8f-ac21-5aedfb25c760)]
7573
interface nsIWebSocketEventService : nsISupports
7674
{
77-
[must_use] void sendMessage(in unsigned long aWebSocketSerialID,
78-
in AString aMessage);
79-
8075
[must_use] void addListener(in unsigned long long aInnerWindowID,
8176
in nsIWebSocketEventListener aListener);
8277

netwerk/protocol/websocket/nsIWebSocketImpl.idl

Lines changed: 0 additions & 18 deletions
This file was deleted.

netwerk/protocol/websocket/nsIWebSocketListener.idl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,7 @@ interface nsIWebSocketListener : nsISupports
8484
[must_use] void onServerClose(in nsISupports aContext,
8585
in unsigned short aCode,
8686
in AUTF8String aReason);
87+
8788
};
89+
90+

0 commit comments

Comments
 (0)