Bug 1623039 Replace URIParams with nsIURI in PWebSocket.ipdl r=valentin
authoranjali1903 <anjali.jha1903@gmail.com>
Wed, 25 Mar 2020 19:49:59 +0000
changeset 520428 e2ebf5fb7ae6ea2893a082b8022943d94735d176
parent 520427 c333f6f9d1bd5839658b6dd0b8459de9d24a6b9c
child 520429 8d0e79c4d8c41b49e5f5ce68d701503924aa4d47
push id37250
push userdvarga@mozilla.com
push dateThu, 26 Mar 2020 04:04:15 +0000
treeherdermozilla-central@85bae8580dde [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvalentin
bugs1623039
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1623039 Replace URIParams with nsIURI in PWebSocket.ipdl r=valentin Differential Revision: https://phabricator.services.mozilla.com/D68016
netwerk/protocol/websocket/PWebSocket.ipdl
netwerk/protocol/websocket/WebSocketChannelChild.cpp
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
--- a/netwerk/protocol/websocket/PWebSocket.ipdl
+++ b/netwerk/protocol/websocket/PWebSocket.ipdl
@@ -4,35 +4,35 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 include protocol PNecko;
 include protocol PBrowser;
 include protocol PTransportProvider;
 include IPCStream;
-include URIParams;
 include NeckoChannelParams;
 
 include protocol PFileDescriptorSet; //FIXME: bug #792908
 include protocol PChildToParentStream; //FIXME: bug #792908
 include protocol PParentToChildStream; //FIXME: bug #792908
 
 using class IPC::SerializedLoadContext from "SerializedLoadContext.h";
+using refcounted class nsIURI from "mozilla/ipc/URIUtils.h";
 
 namespace mozilla {
 namespace net {
 
 async protocol PWebSocket
 {
   manager PNecko;
 
 parent:
   // Forwarded methods corresponding to methods on nsIWebSocketChannel
-  async AsyncOpen(URIParams? aURI,
+  async AsyncOpen(nsIURI aURI,
                   nsCString aOrigin,
                   uint64_t aInnerWindowID,
                   nsCString aProtocol,
                   bool aSecure,
                   // ping values only meaningful if client set them
                   uint32_t aPingInterval,
                   bool aClientSetPingInterval,
                   uint32_t aPingTimeout,
--- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp
@@ -450,23 +450,22 @@ WebSocketChannelChild::AsyncOpen(nsIURI*
   ContentChild* cc = static_cast<ContentChild*>(gNeckoChild->Manager());
   if (cc->IsShuttingDown()) {
     return NS_ERROR_FAILURE;
   }
 
   // Corresponding release in DeallocPWebSocket
   AddIPDLReference();
 
-  Maybe<URIParams> uri;
+  nsCOMPtr<nsIURI> uri;
   Maybe<LoadInfoArgs> loadInfoArgs;
   Maybe<PTransportProviderChild*> transportProvider;
 
   if (!mIsServerSide) {
-    uri.emplace(URIParams());
-    SerializeURI(aURI, uri.ref());
+    uri = aURI;
     nsresult rv = LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
     NS_ENSURE_SUCCESS(rv, rv);
 
     transportProvider = Nothing();
   } else {
     MOZ_ASSERT(mServerTransportProvider);
     PTransportProviderChild* ipcChild;
     nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild);
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -42,28 +42,28 @@ mozilla::ipc::IPCResult WebSocketChannel
   IProtocol* mgr = Manager();
   if (CanRecv() && !Send__delete__(this)) {
     return IPC_FAIL_NO_REASON(mgr);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult WebSocketChannelParent::RecvAsyncOpen(
-    const Maybe<URIParams>& aURI, const nsCString& aOrigin,
-    const uint64_t& aInnerWindowID, const nsCString& aProtocol,
-    const bool& aSecure, const uint32_t& aPingInterval,
-    const bool& aClientSetPingInterval, const uint32_t& aPingTimeout,
-    const bool& aClientSetPingTimeout, const Maybe<LoadInfoArgs>& aLoadInfoArgs,
+    nsIURI* aURI, const nsCString& aOrigin, const uint64_t& aInnerWindowID,
+    const nsCString& aProtocol, const bool& aSecure,
+    const uint32_t& aPingInterval, const bool& aClientSetPingInterval,
+    const uint32_t& aPingTimeout, const bool& aClientSetPingTimeout,
+    const Maybe<LoadInfoArgs>& aLoadInfoArgs,
     const Maybe<PTransportProviderParent*>& aTransportProvider,
     const nsCString& aNegotiatedExtensions) {
   LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
 
   nsresult rv;
+  nsCOMPtr<nsILoadInfo> loadInfo;
   nsCOMPtr<nsIURI> uri;
-  nsCOMPtr<nsILoadInfo> loadInfo;
 
   rv = LoadInfoArgsToLoadInfo(aLoadInfoArgs, getter_AddRefs(loadInfo));
   if (NS_FAILED(rv)) {
     goto fail;
   }
 
   if (aSecure) {
     mChannel =
@@ -93,17 +93,17 @@ mozilla::ipc::IPCResult WebSocketChannel
   if (aTransportProvider.isSome()) {
     RefPtr<TransportProviderParent> provider =
         static_cast<TransportProviderParent*>(aTransportProvider.value());
     rv = mChannel->SetServerParameters(provider, aNegotiatedExtensions);
     if (NS_FAILED(rv)) {
       goto fail;
     }
   } else {
-    uri = DeserializeURI(aURI);
+    uri = aURI;
     if (!uri) {
       rv = NS_ERROR_FAILURE;
       goto fail;
     }
   }
 
   // only use ping values from child if they were overridden by client code.
   if (aClientSetPingInterval) {
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -34,21 +34,20 @@ class WebSocketChannelParent : public PW
   NS_DECL_NSIINTERFACEREQUESTOR
 
   WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
                          nsILoadContext* aLoadContext,
                          PBOverrideStatus aOverrideStatus, uint32_t aSerial);
 
  private:
   mozilla::ipc::IPCResult RecvAsyncOpen(
-      const Maybe<URIParams>& aURI, const nsCString& aOrigin,
-      const uint64_t& aInnerWindowID, const nsCString& aProtocol,
-      const bool& aSecure, const uint32_t& aPingInterval,
-      const bool& aClientSetPingInterval, const uint32_t& aPingTimeout,
-      const bool& aClientSetPingTimeout,
+      nsIURI* aURI, const nsCString& aOrigin, const uint64_t& aInnerWindowID,
+      const nsCString& aProtocol, const bool& aSecure,
+      const uint32_t& aPingInterval, const bool& aClientSetPingInterval,
+      const uint32_t& aPingTimeout, const bool& aClientSetPingTimeout,
       const Maybe<LoadInfoArgs>& aLoadInfoArgs,
       const Maybe<PTransportProviderParent*>& aTransportProvider,
       const nsCString& aNegotiatedExtensions);
   mozilla::ipc::IPCResult RecvClose(const uint16_t& code,
                                     const nsCString& reason);
   mozilla::ipc::IPCResult RecvSendMsg(const nsCString& aMsg);
   mozilla::ipc::IPCResult RecvSendBinaryMsg(const nsCString& aMsg);
   mozilla::ipc::IPCResult RecvSendBinaryStream(const IPCStream& aStream,