From df8950c7af930ed6e17a5e25f307f399a36b6d74 Mon Sep 17 00:00:00 2001 From: Kannan Vijayan Date: Fri, 9 Sep 2016 13:41:32 -0400 Subject: [PATCH] Bug 1301091 - Make FlyWeb not use gNeckoParent. Fix WebSocketChannel handling of incoming requests to server-websocket. r=billm r=michal --- dom/flyweb/FlyWebPublishedServer.cpp | 8 +++++++- .../websocket/WebSocketChannelParent.cpp | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/dom/flyweb/FlyWebPublishedServer.cpp b/dom/flyweb/FlyWebPublishedServer.cpp index 610c070eaed9..382581402bc5 100644 --- a/dom/flyweb/FlyWebPublishedServer.cpp +++ b/dom/flyweb/FlyWebPublishedServer.cpp @@ -541,9 +541,15 @@ FlyWebPublishedServerParent::HandleEvent(nsIDOMEvent* aEvent) uint64_t id = mNextRequestId++; mPendingRequests.Put(id, request); + nsTArray neckoParents; + Manager()->ManagedPNeckoParent(neckoParents); + if (neckoParents.Length() != 1) { + MOZ_CRASH("Expected exactly 1 PNeckoParent instance per PNeckoChild"); + } + RefPtr provider = static_cast( - mozilla::net::gNeckoParent->SendPTransportProviderConstructor()); + neckoParents[0]->SendPTransportProviderConstructor()); IPCInternalRequest ipcReq; request->ToIPC(&ipcReq); diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.cpp b/netwerk/protocol/websocket/WebSocketChannelParent.cpp index e4a84bc6db9b..d58db4489c6a 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp @@ -85,12 +85,19 @@ WebSocketChannelParent::RecvAsyncOpen(const OptionalURIParams& aURI, goto fail; } - rv = loadInfo->GetOriginAttributes(&attrs); - if (NS_FAILED(rv)) { - goto fail; - } + if (loadInfo) { + rv = loadInfo->GetOriginAttributes(&attrs); + if (NS_FAILED(rv)) { + goto fail; + } - appId = attrs.mAppId; + appId = attrs.mAppId; + } else { + // If the WebSocket is a server-side socket, then + // loadInfo will be null (since it's an incoming connection). + // AppID is irrelevant in these circumstances. + appId = NECKO_UNKNOWN_APP_ID; + } if (appId != NECKO_UNKNOWN_APP_ID && appId != NECKO_NO_APP_ID) { gIOService->IsAppOffline(appId, &appOffline);