Bug 1532727 - replace OptionalURIParams with URIParams? in IPDL; r=froydnj
authorAlex Gaynor <agaynor@mozilla.com>
Wed, 06 Mar 2019 14:05:50 +0000
changeset 462619 dcdb7860cae8667256dcca87711d1edea92a9bad
parent 462618 51a634029b4420a4ed2df59756dc2a66ade0b958
child 462620 8c8f7c2d12be58ebc5833907541923022fe497b3
push id79755
push userncsoregi@mozilla.com
push dateWed, 06 Mar 2019 14:20:21 +0000
treeherderautoland@dcdb7860cae8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1532727
milestone67.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 1532727 - replace OptionalURIParams with URIParams? in IPDL; r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D22138
caps/DomainPolicy.cpp
docshell/base/nsDefaultURIFixup.cpp
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PBrowser.ipdl
dom/ipc/PContent.ipdl
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/jsurl/nsJSProtocolHandler.cpp
image/decoders/icon/nsIconURI.cpp
ipc/glue/BackgroundUtils.cpp
ipc/glue/URIParams.ipdlh
ipc/glue/URIUtils.cpp
ipc/glue/URIUtils.h
mobile/android/components/geckoview/GeckoViewHistory.cpp
netwerk/base/Predictor.cpp
netwerk/cookie/CookieServiceChild.cpp
netwerk/cookie/CookieServiceParent.cpp
netwerk/cookie/CookieServiceParent.h
netwerk/cookie/PCookieService.ipdl
netwerk/ipc/NeckoChannelParams.ipdlh
netwerk/ipc/NeckoParent.cpp
netwerk/ipc/NeckoParent.h
netwerk/ipc/PNecko.ipdl
netwerk/protocol/http/HttpChannelChild.cpp
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/HttpChannelParent.h
netwerk/protocol/http/PHttpChannel.ipdl
netwerk/protocol/websocket/PWebSocket.ipdl
netwerk/protocol/websocket/WebSocketChannelChild.cpp
netwerk/protocol/websocket/WebSocketChannelParent.cpp
netwerk/protocol/websocket/WebSocketChannelParent.h
toolkit/components/places/History.cpp
uriloader/exthandler/ExternalHelperAppParent.cpp
uriloader/exthandler/ExternalHelperAppParent.h
uriloader/exthandler/nsExternalHelperAppService.cpp
--- a/caps/DomainPolicy.cpp
+++ b/caps/DomainPolicy.cpp
@@ -26,17 +26,17 @@ static nsresult BroadcastDomainSetChange
              "DomainPolicy should only be exposed to the chrome process.");
 
   nsTArray<ContentParent*> parents;
   ContentParent::GetAll(parents);
   if (!parents.Length()) {
     return NS_OK;
   }
 
-  OptionalURIParams uri;
+  Maybe<URIParams> uri;
   SerializeURI(aDomain, uri);
 
   for (uint32_t i = 0; i < parents.Length(); i++) {
     Unused << parents[i]->SendDomainSetChanged(aSetType, aChangeType, uri);
   }
   return NS_OK;
 }
 
--- a/docshell/base/nsDefaultURIFixup.cpp
+++ b/docshell/base/nsDefaultURIFixup.cpp
@@ -405,17 +405,17 @@ nsDefaultURIFixup::KeywordToURI(const ns
 
   if (XRE_IsContentProcess()) {
     dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
     if (!contentChild) {
       return NS_ERROR_NOT_AVAILABLE;
     }
 
     RefPtr<nsIInputStream> postData;
-    ipc::OptionalURIParams uri;
+    Maybe<ipc::URIParams> uri;
     nsAutoString providerName;
     if (!contentChild->SendKeywordToURI(keyword, &providerName, &postData,
                                         &uri)) {
       return NS_ERROR_FAILURE;
     }
 
     CopyUTF8toUTF16(keyword, info->mKeywordAsSent);
     info->mKeywordProviderName = providerName;
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -868,17 +868,17 @@ nsresult ContentChild::ProvideWindowComm
     uint32_t referrerPolicy = mozilla::net::RP_Unset;
     rv = GetCreateWindowParams(
         aParent, aLoadState, baseURIString, &fullZoom, &referrerPolicy,
         getter_AddRefs(triggeringPrincipal), getter_AddRefs(csp));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    OptionalURIParams uriToLoad;
+    Maybe<URIParams> uriToLoad;
     SerializeURI(aURI, uriToLoad);
     Unused << SendCreateWindowInDifferentProcess(
         aTabOpener, aChromeFlags, aCalledFromJS, aPositionSpecified,
         aSizeSpecified, uriToLoad, features, baseURIString, fullZoom, name,
         Principal(triggeringPrincipal), csp, referrerPolicy);
 
     // We return NS_ERROR_ABORT, so that the caller knows that we've abandoned
     // the window open as far as it is concerned.
@@ -1068,21 +1068,19 @@ nsresult ContentChild::ProvideWindowComm
     uint32_t referrerPolicy = mozilla::net::RP_Unset;
     rv = GetCreateWindowParams(
         aParent, aLoadState, baseURIString, &fullZoom, &referrerPolicy,
         getter_AddRefs(triggeringPrincipal), getter_AddRefs(csp));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    OptionalURIParams uriToLoad;
+    Maybe<URIParams> uriToLoad;
     if (aURI) {
       SerializeURI(aURI, uriToLoad);
-    } else {
-      uriToLoad = mozilla::void_t();
     }
 
     SendCreateWindow(aTabOpener, newChild, aChromeFlags, aCalledFromJS,
                      aPositionSpecified, aSizeSpecified, uriToLoad, features,
                      baseURIString, fullZoom, Principal(triggeringPrincipal),
                      csp, referrerPolicy, std::move(resolve),
                      std::move(reject));
   }
@@ -2012,23 +2010,23 @@ PPSMContentDownloaderChild* ContentChild
 bool ContentChild::DeallocPPSMContentDownloaderChild(
     PPSMContentDownloaderChild* aListener) {
   auto* listener = static_cast<PSMContentDownloaderChild*>(aListener);
   RefPtr<PSMContentDownloaderChild> child = dont_AddRef(listener);
   return true;
 }
 
 PExternalHelperAppChild* ContentChild::AllocPExternalHelperAppChild(
-    const OptionalURIParams& uri,
+    const Maybe<URIParams>& uri,
     const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
     const nsCString& aMimeContentType, const nsCString& aContentDisposition,
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename, const bool& aForceSave,
     const int64_t& aContentLength, const bool& aWasFileChannel,
-    const OptionalURIParams& aReferrer, PBrowserChild* aBrowser) {
+    const Maybe<URIParams>& aReferrer, PBrowserChild* aBrowser) {
   auto* child = new ExternalHelperAppChild();
   child->AddRef();
   return child;
 }
 
 bool ContentChild::DeallocPExternalHelperAppChild(
     PExternalHelperAppChild* aService) {
   ExternalHelperAppChild* child =
@@ -2737,17 +2735,17 @@ bool ContentChild::DeallocPOfflineCacheU
   OfflineCacheUpdateChild* offlineCacheUpdate =
       static_cast<OfflineCacheUpdateChild*>(actor);
   NS_RELEASE(offlineCacheUpdate);
   return true;
 }
 
 mozilla::ipc::IPCResult ContentChild::RecvDomainSetChanged(
     const uint32_t& aSetType, const uint32_t& aChangeType,
-    const OptionalURIParams& aDomain) {
+    const Maybe<URIParams>& aDomain) {
   if (aChangeType == ACTIVATE_POLICY) {
     if (mPolicy) {
       return IPC_OK();
     }
     nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
     MOZ_ASSERT(ssm);
     ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy));
     if (!mPolicy) {
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -57,17 +57,16 @@ bool IsDevelopmentBuild();
 // Return the repo directory and the repo object directory respectively. These
 // should only be used on Mac developer builds to determine the path to the
 // repo or object directory.
 nsresult GetRepoDir(nsIFile** aRepoDir);
 nsresult GetObjDir(nsIFile** aObjDir);
 #endif /* XP_MACOSX */
 
 namespace ipc {
-class OptionalURIParams;
 class URIParams;
 }  // namespace ipc
 
 namespace dom {
 
 namespace ipc {
 class SharedMap;
 }
@@ -80,17 +79,16 @@ class GetFilesHelperChild;
 class FileCreatorHelper;
 
 class ContentChild final : public PContentChild,
                            public nsIWindowProvider,
                            public CPOWManagerGetter,
                            public mozilla::ipc::IShmemAllocator {
   typedef mozilla::dom::ClonedMessageData ClonedMessageData;
   typedef mozilla::ipc::FileDescriptor FileDescriptor;
-  typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
   typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild;
   typedef mozilla::ipc::URIParams URIParams;
 
   friend class PContentChild;
 
  public:
   NS_DECL_NSIWINDOWPROVIDER
 
@@ -274,23 +272,23 @@ class ContentChild final : public PConte
 
   PPSMContentDownloaderChild* AllocPPSMContentDownloaderChild(
       const uint32_t& aCertType);
 
   bool DeallocPPSMContentDownloaderChild(
       PPSMContentDownloaderChild* aDownloader);
 
   PExternalHelperAppChild* AllocPExternalHelperAppChild(
-      const OptionalURIParams& uri,
+      const Maybe<URIParams>& uri,
       const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
       const nsCString& aMimeContentType, const nsCString& aContentDisposition,
       const uint32_t& aContentDispositionHint,
       const nsString& aContentDispositionFilename, const bool& aForceSave,
       const int64_t& aContentLength, const bool& aWasFileChannel,
-      const OptionalURIParams& aReferrer, PBrowserChild* aBrowser);
+      const Maybe<URIParams>& aReferrer, PBrowserChild* aBrowser);
 
   bool DeallocPExternalHelperAppChild(PExternalHelperAppChild* aService);
 
   PHandlerServiceChild* AllocPHandlerServiceChild();
 
   bool DeallocPHandlerServiceChild(PHandlerServiceChild*);
 
   PMediaChild* AllocPMediaChild();
@@ -445,19 +443,19 @@ class ContentChild final : public PConte
   void RemoveIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS);
 
   mozilla::ipc::IPCResult RecvNotifyIdleObserver(const uint64_t& aObserver,
                                                  const nsCString& aTopic,
                                                  const nsString& aData);
 
   mozilla::ipc::IPCResult RecvUpdateWindow(const uintptr_t& aChildId);
 
-  mozilla::ipc::IPCResult RecvDomainSetChanged(
-      const uint32_t& aSetType, const uint32_t& aChangeType,
-      const OptionalURIParams& aDomain);
+  mozilla::ipc::IPCResult RecvDomainSetChanged(const uint32_t& aSetType,
+                                               const uint32_t& aChangeType,
+                                               const Maybe<URIParams>& aDomain);
 
   mozilla::ipc::IPCResult RecvShutdown();
 
   mozilla::ipc::IPCResult RecvInvokeDragSession(
       nsTArray<IPCDataTransfer>&& aTransfers, const uint32_t& aAction);
 
   mozilla::ipc::IPCResult RecvEndDragSession(
       const bool& aDoneDrag, const bool& aUserCancelled,
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -3626,46 +3626,46 @@ PPSMContentDownloaderParent* ContentPare
 bool ContentParent::DeallocPPSMContentDownloaderParent(
     PPSMContentDownloaderParent* aListener) {
   auto* listener = static_cast<PSMContentDownloaderParent*>(aListener);
   RefPtr<PSMContentDownloaderParent> downloader = dont_AddRef(listener);
   return true;
 }
 
 PExternalHelperAppParent* ContentParent::AllocPExternalHelperAppParent(
-    const OptionalURIParams& uri,
+    const Maybe<URIParams>& uri,
     const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
     const nsCString& aMimeContentType, const nsCString& aContentDisposition,
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename, const bool& aForceSave,
     const int64_t& aContentLength, const bool& aWasFileChannel,
-    const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) {
+    const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) {
   ExternalHelperAppParent* parent = new ExternalHelperAppParent(
       uri, aContentLength, aWasFileChannel, aContentDisposition,
       aContentDispositionHint, aContentDispositionFilename);
   parent->AddRef();
   return parent;
 }
 
 bool ContentParent::DeallocPExternalHelperAppParent(
     PExternalHelperAppParent* aService) {
   ExternalHelperAppParent* parent =
       static_cast<ExternalHelperAppParent*>(aService);
   parent->Release();
   return true;
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor(
-    PExternalHelperAppParent* actor, const OptionalURIParams& uri,
+    PExternalHelperAppParent* actor, const Maybe<URIParams>& uri,
     const Maybe<LoadInfoArgs>& loadInfoArgs, const nsCString& aMimeContentType,
     const nsCString& aContentDisposition,
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename, const bool& aForceSave,
     const int64_t& aContentLength, const bool& aWasFileChannel,
-    const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) {
+    const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) {
   static_cast<ExternalHelperAppParent*>(actor)->Init(
       loadInfoArgs, aMimeContentType, aForceSave, aReferrer, aBrowser);
   return IPC_OK();
 }
 
 PHandlerServiceParent* ContentParent::AllocPHandlerServiceParent() {
   HandlerServiceParent* actor = new HandlerServiceParent();
   actor->AddRef();
@@ -4180,19 +4180,19 @@ nsresult ContentParent::DoSendAsyncMessa
                         data)) {
     return NS_ERROR_UNEXPECTED;
   }
   return NS_OK;
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI(
     const nsCString& aKeyword, nsString* aProviderName,
-    RefPtr<nsIInputStream>* aPostData, OptionalURIParams* aURI) {
+    RefPtr<nsIInputStream>* aPostData, Maybe<URIParams>* aURI) {
   *aPostData = nullptr;
-  *aURI = void_t();
+  *aURI = Nothing();
 
   nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service();
   if (!fixup) {
     return IPC_OK();
   }
 
   nsCOMPtr<nsIURIFixupInfo> info;
 
@@ -4867,17 +4867,17 @@ mozilla::ipc::IPCResult ContentParent::C
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvCreateWindow(
     PBrowserParent* aThisTab, PBrowserParent* aNewTab,
     const uint32_t& aChromeFlags, const bool& aCalledFromJS,
     const bool& aPositionSpecified, const bool& aSizeSpecified,
-    const OptionalURIParams& aURIToLoad, const nsCString& aFeatures,
+    const Maybe<URIParams>& aURIToLoad, const nsCString& aFeatures,
     const nsCString& aBaseURI, const float& aFullZoom,
     const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
     const uint32_t& aReferrerPolicy, CreateWindowResolver&& aResolve) {
   nsresult rv = NS_OK;
   CreatedWindowInfo cwi;
 
   // We always expect to open a new window here. If we don't, it's an error.
   cwi.windowOpened() = true;
@@ -4947,17 +4947,17 @@ mozilla::ipc::IPCResult ContentParent::R
   cwi.hasSiblings() = (openLocation == nsIBrowserDOMWindow::OPEN_NEWTAB);
 
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess(
     PBrowserParent* aThisTab, const uint32_t& aChromeFlags,
     const bool& aCalledFromJS, const bool& aPositionSpecified,
-    const bool& aSizeSpecified, const OptionalURIParams& aURIToLoad,
+    const bool& aSizeSpecified, const Maybe<URIParams>& aURIToLoad,
     const nsCString& aFeatures, const nsCString& aBaseURI,
     const float& aFullZoom, const nsString& aName,
     const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp,
     const uint32_t& aReferrerPolicy) {
   nsCOMPtr<nsITabParent> newRemoteTab;
   bool windowIsNew;
   nsCOMPtr<nsIURI> uriToLoad = DeserializeURI(aURIToLoad);
   int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW;
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -76,17 +76,16 @@ class PreallocatedProcessManagerImpl;
 using mozilla::loader::PScriptCacheParent;
 
 namespace embedding {
 class PrintingParent;
 }
 
 namespace ipc {
 class CrashReporterHost;
-class OptionalURIParams;
 class PFileDescriptorSetParent;
 class URIParams;
 class TestShellParent;
 #ifdef FUZZING
 class ProtocolFuzzerHelper;
 #endif
 }  // namespace ipc
 
@@ -125,17 +124,16 @@ class ContentParent final : public PCont
                             public gfx::gfxVarReceiver,
                             public mozilla::LinkedListElement<ContentParent>,
                             public gfx::GPUProcessListener,
                             public mozilla::MemoryReportingProcess,
                             public mozilla::dom::ipc::MessageManagerCallback,
                             public CPOWManagerGetter,
                             public mozilla::ipc::IShmemAllocator {
   typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost;
-  typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
   typedef mozilla::ipc::PFileDescriptorSetParent PFileDescriptorSetParent;
   typedef mozilla::ipc::TestShellParent TestShellParent;
   typedef mozilla::ipc::URIParams URIParams;
   typedef mozilla::ipc::PrincipalInfo PrincipalInfo;
   typedef mozilla::dom::ClonedMessageData ClonedMessageData;
   typedef mozilla::dom::BrowsingContextGroup BrowsingContextGroup;
 
   friend class mozilla::PreallocatedProcessManagerImpl;
@@ -509,26 +507,26 @@ class ContentParent final : public PCont
   virtual bool HandleWindowsMessages(const Message& aMsg) const override;
 
   void ForkNewProcess(bool aBlocking);
 
   mozilla::ipc::IPCResult RecvCreateWindow(
       PBrowserParent* aThisTabParent, PBrowserParent* aNewTab,
       const uint32_t& aChromeFlags, const bool& aCalledFromJS,
       const bool& aPositionSpecified, const bool& aSizeSpecified,
-      const OptionalURIParams& aURIToLoad, const nsCString& aFeatures,
+      const Maybe<URIParams>& aURIToLoad, const nsCString& aFeatures,
       const nsCString& aBaseURI, const float& aFullZoom,
       const IPC::Principal& aTriggeringPrincipal,
       nsIContentSecurityPolicy* aCsp, const uint32_t& aReferrerPolicy,
       CreateWindowResolver&& aResolve);
 
   mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
       PBrowserParent* aThisTab, const uint32_t& aChromeFlags,
       const bool& aCalledFromJS, const bool& aPositionSpecified,
-      const bool& aSizeSpecified, const OptionalURIParams& aURIToLoad,
+      const bool& aSizeSpecified, const Maybe<URIParams>& aURIToLoad,
       const nsCString& aFeatures, const nsCString& aBaseURI,
       const float& aFullZoom, const nsString& aName,
       const IPC::Principal& aTriggeringPrincipal,
       nsIContentSecurityPolicy* aCsp, const uint32_t& aReferrerPolicy);
 
   static void BroadcastBlobURLRegistration(
       const nsACString& aURI, BlobImpl* aBlobImpl, nsIPrincipal* aPrincipal,
       ContentParent* aIgnoreThisCP = nullptr);
@@ -870,34 +868,34 @@ class ContentParent final : public PCont
 
   PPSMContentDownloaderParent* AllocPPSMContentDownloaderParent(
       const uint32_t& aCertType);
 
   bool DeallocPPSMContentDownloaderParent(
       PPSMContentDownloaderParent* aDownloader);
 
   PExternalHelperAppParent* AllocPExternalHelperAppParent(
-      const OptionalURIParams& aUri,
+      const Maybe<URIParams>& aUri,
       const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
       const nsCString& aMimeContentType, const nsCString& aContentDisposition,
       const uint32_t& aContentDispositionHint,
       const nsString& aContentDispositionFilename, const bool& aForceSave,
       const int64_t& aContentLength, const bool& aWasFileChannel,
-      const OptionalURIParams& aReferrer, PBrowserParent* aBrowser);
+      const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser);
 
   bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
 
   mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor(
-      PExternalHelperAppParent* actor, const OptionalURIParams& uri,
+      PExternalHelperAppParent* actor, const Maybe<URIParams>& uri,
       const Maybe<LoadInfoArgs>& loadInfoArgs,
       const nsCString& aMimeContentType, const nsCString& aContentDisposition,
       const uint32_t& aContentDispositionHint,
       const nsString& aContentDispositionFilename, const bool& aForceSave,
       const int64_t& aContentLength, const bool& aWasFileChannel,
-      const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) override;
+      const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) override;
 
   PHandlerServiceParent* AllocPHandlerServiceParent();
 
   bool DeallocPHandlerServiceParent(PHandlerServiceParent*);
 
   PMediaParent* AllocPMediaParent();
 
   bool DeallocPMediaParent(PMediaParent* aActor);
@@ -1034,17 +1032,17 @@ class ContentParent final : public PCont
 
   mozilla::ipc::IPCResult RecvFirstIdle();
 
   mozilla::ipc::IPCResult RecvDeviceReset();
 
   mozilla::ipc::IPCResult RecvKeywordToURI(const nsCString& aKeyword,
                                            nsString* aProviderName,
                                            RefPtr<nsIInputStream>* aPostData,
-                                           OptionalURIParams* aURI);
+                                           Maybe<URIParams>* aURI);
 
   mozilla::ipc::IPCResult RecvNotifyKeywordSearchLoading(
       const nsString& aProvider, const nsString& aKeyword);
 
   mozilla::ipc::IPCResult RecvCopyFavicon(
       const URIParams& aOldURI, const URIParams& aNewURI,
       const IPC::Principal& aLoadingPrincipal, const bool& aInPrivateBrowsing);
 
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -930,17 +930,17 @@ child:
 
     /**
      * Requests the content blocking log, which is sent back in response.
      */
     async GetContentBlockingLog() returns(nsCString log, bool success);
 
 parent:
     /** Records a history visit. */
-    async VisitURI(URIParams aURI, OptionalURIParams aLastVisitedURI,
+    async VisitURI(URIParams aURI, URIParams? aLastVisitedURI,
                    uint32_t aFlags);
 
     /** Fetches the visited status for an array of URIs (Android-only). */
     async QueryVisitedState(URIParams[] aURIs);
 
 /*
  * FIXME: write protocol!
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -272,17 +272,17 @@ struct XPCOMInitData
     bool isOffline;
     bool isConnected;
     int32_t captivePortalState;
     bool isLangRTL;
     bool haveBidiKeyboards;
     nsString[] dictionaries;
     ClipboardCapabilities clipboardCaps;
     DomainPolicyClone domainPolicy;
-    OptionalURIParams userContentSheetURL;
+    URIParams? userContentSheetURL;
     GfxVarUpdate[] gfxNonDefaultVarUpdates;
     ContentDeviceData contentDeviceData;
     GfxInfoFeatureStatus[] gfxFeatureStatus;
     DataStorageEntry[] dataStorage;
     nsCString[] appLocales;
     nsCString[] requestedLocales;
     DynamicScalarDefinition[] dynamicScalarDefs;
 };
@@ -582,17 +582,17 @@ child:
     async NotifyIdleObserver(uint64_t observerId, nsCString topic, nsString str);
 
     async InvokeDragSession(IPCDataTransfer[] transfers, uint32_t action);
 
     async EndDragSession(bool aDoneDrag, bool aUserCancelled,
                          LayoutDeviceIntPoint aDragEndPoint,
                          uint32_t aKeyModifiers);
 
-    async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, OptionalURIParams aDomain);
+    async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, URIParams? aDomain);
 
     /**
      * Notify the child to shutdown. The child will in turn call FinishShutdown
      * and let the parent close the channel.
      */
     async Shutdown();
 
     async LoadProcessScript(nsString url);
@@ -896,26 +896,26 @@ parent:
     // main thread and bouncing this off of PBackground would be silly and
     // complex. In the long run, the notification implementation will be
     // overhauled to directly process the notification click/close and directly
     // translate that to a ServiceWorker event.
     async NotificationEvent(nsString type, NotificationEventData data);
 
     async PPSMContentDownloader(uint32_t aCertType);
 
-    async PExternalHelperApp(OptionalURIParams uri,
+    async PExternalHelperApp(URIParams? uri,
                              LoadInfoArgs? loadInfoArgs,
                              nsCString aMimeContentType,
                              nsCString aContentDisposition,
                              uint32_t aContentDispositionHint,
                              nsString aContentDispositionFilename,
                              bool aForceSave,
                              int64_t aContentLength,
                              bool aWasFileChannel,
-                             OptionalURIParams aReferrer,
+                             URIParams? aReferrer,
                              nullable PBrowser aBrowser);
 
     async PHandlerService();
 
     async AddGeolocationListener(Principal principal, bool highAccuracy);
     async RemoveGeolocationListener();
     async SetGeolocationHigherAccuracy(bool enable);
 
@@ -966,17 +966,17 @@ parent:
     async PrivateDocShellsExist(bool aExist);
 
     // Tell the parent that the child has gone idle for the first time.
     async FirstIdle();
 
     async DeviceReset();
 
     sync KeywordToURI(nsCString keyword)
-        returns (nsString providerName, nsIInputStream postData, OptionalURIParams uri);
+        returns (nsString providerName, nsIInputStream postData, URIParams? uri);
 
     sync NotifyKeywordSearchLoading(nsString providerName, nsString keyword);
 
     async CopyFavicon(URIParams oldURI, URIParams newURI, Principal aLoadingPrincipal, bool isPrivate);
 
     /**
      * Notifies the parent about a recording device is starting or shutdown.
      * @param recordingStatus starting or shutdown
@@ -1115,32 +1115,32 @@ parent:
         returns (ContentDeviceData aData);
 
     async CreateWindow(nullable PBrowser aThisTab,
                        PBrowser aNewTab,
                        uint32_t aChromeFlags,
                        bool aCalledFromJS,
                        bool aPositionSpecified,
                        bool aSizeSpecified,
-                       OptionalURIParams aURIToLoad,
+                       URIParams? aURIToLoad,
                        nsCString aFeatures,
                        nsCString aBaseURI,
                        float aFullZoom,
                        Principal aTriggeringPrincipal,
                        nsIContentSecurityPolicy aCsp,
                        uint32_t aReferrerPolicy)
         returns (CreatedWindowInfo window);
 
     async CreateWindowInDifferentProcess(
       PBrowser aThisTab,
       uint32_t aChromeFlags,
       bool aCalledFromJS,
       bool aPositionSpecified,
       bool aSizeSpecified,
-      OptionalURIParams aURIToLoad,
+      URIParams? aURIToLoad,
       nsCString aFeatures,
       nsCString aBaseURI,
       float aFullZoom,
       nsString aName,
       Principal aTriggeringPrincipal,
       nsIContentSecurityPolicy aCsp,
       uint32_t aReferrerPolicy);
 
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -3388,17 +3388,17 @@ mozilla::ipc::IPCResult TabParent::RecvS
       NS_ConvertUTF8toUTF16(aFirstPartyURI).get());
   if (NS_FAILED(rv)) {
     return IPC_FAIL_NO_REASON(this);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult TabParent::RecvVisitURI(
-    const URIParams& aURI, const OptionalURIParams& aLastVisitedURI,
+    const URIParams& aURI, const Maybe<URIParams>& aLastVisitedURI,
     const uint32_t& aFlags) {
   nsCOMPtr<nsIURI> ourURI = DeserializeURI(aURI);
   if (!ourURI) {
     return IPC_FAIL_NO_REASON(this);
   }
   nsCOMPtr<nsIURI> ourLastVisitedURI = DeserializeURI(aLastVisitedURI);
   RefPtr<nsIWidget> widget = GetWidget();
   if (NS_WARN_IF(!widget)) {
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -621,17 +621,17 @@ class TabParent final : public PBrowserP
       const nsCString& aFirstPartyURI, const bool& aHideDoorHanger);
 
   mozilla::ipc::IPCResult RecvRootBrowsingContext(BrowsingContext* aContext);
 
   mozilla::ipc::IPCResult RecvSetSystemFont(const nsCString& aFontName);
   mozilla::ipc::IPCResult RecvGetSystemFont(nsCString* aFontName);
 
   mozilla::ipc::IPCResult RecvVisitURI(const URIParams& aURI,
-                                       const OptionalURIParams& aLastVisitedURI,
+                                       const Maybe<URIParams>& aLastVisitedURI,
                                        const uint32_t& aFlags);
 
   mozilla::ipc::IPCResult RecvQueryVisitedState(
       InfallibleTArray<URIParams>&& aURIs);
 
   ContentCacheInParent mContentCache;
 
   nsIntRect mRect;
--- a/dom/jsurl/nsJSProtocolHandler.cpp
+++ b/dom/jsurl/nsJSProtocolHandler.cpp
@@ -46,16 +46,17 @@
 #include "nsIContentSecurityPolicy.h"
 #include "nsSandboxFlags.h"
 #include "mozilla/CycleCollectedJSContext.h"
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/dom/PopupBlocker.h"
 #include "nsILoadInfo.h"
 #include "nsContentSecurityManager.h"
 
+#include "mozilla/Maybe.h"
 #include "mozilla/ipc/URIUtils.h"
 
 using mozilla::dom::AutoEntryScript;
 
 static NS_DEFINE_CID(kJSURICID, NS_JSURI_CID);
 
 class nsJSThunk : public nsIInputStream {
  public:
@@ -1226,35 +1227,35 @@ NS_IMETHODIMP_(void) nsJSURI::Serialize(
   URIParams simpleParams;
 
   mozilla::net::nsSimpleURI::Serialize(simpleParams);
 
   jsParams.simpleParams() = simpleParams;
   if (mBaseURI) {
     SerializeURI(mBaseURI, jsParams.baseURI());
   } else {
-    jsParams.baseURI() = mozilla::void_t();
+    jsParams.baseURI() = mozilla::Nothing();
   }
 
   aParams = jsParams;
 }
 
 bool nsJSURI::Deserialize(const mozilla::ipc::URIParams& aParams) {
   using namespace mozilla::ipc;
 
   if (aParams.type() != URIParams::TJSURIParams) {
     NS_ERROR("Received unknown parameters from the other process!");
     return false;
   }
 
   const JSURIParams& jsParams = aParams.get_JSURIParams();
   mozilla::net::nsSimpleURI::Deserialize(jsParams.simpleParams());
 
-  if (jsParams.baseURI().type() != OptionalURIParams::Tvoid_t) {
-    mBaseURI = DeserializeURI(jsParams.baseURI().get_URIParams());
+  if (jsParams.baseURI().isSome()) {
+    mBaseURI = DeserializeURI(jsParams.baseURI().ref());
   } else {
     mBaseURI = nullptr;
   }
   return true;
 }
 
 // nsSimpleURI methods:
 /* virtual */ mozilla::net::nsSimpleURI* nsJSURI::StartClone(
--- a/image/decoders/icon/nsIconURI.cpp
+++ b/image/decoders/icon/nsIconURI.cpp
@@ -547,19 +547,19 @@ void nsMozIconURI::Serialize(URIParams& 
   if (mIconURL) {
     URIParams iconURLParams;
     SerializeURI(mIconURL, iconURLParams);
     if (iconURLParams.type() == URIParams::T__None) {
       // Serialization failed, bail.
       return;
     }
 
-    params.uri() = iconURLParams;
+    params.uri() = Some(std::move(iconURLParams));
   } else {
-    params.uri() = void_t();
+    params.uri() = Nothing();
   }
 
   params.size() = mSize;
   params.fileName() = mFileName;
   params.stockIcon() = mStockIcon;
   params.iconSize() = mIconSize;
   params.iconState() = mIconState;
 
@@ -568,18 +568,18 @@ void nsMozIconURI::Serialize(URIParams& 
 
 bool nsMozIconURI::Deserialize(const URIParams& aParams) {
   if (aParams.type() != URIParams::TIconURIParams) {
     MOZ_ASSERT_UNREACHABLE("Received unknown URI from other process!");
     return false;
   }
 
   const IconURIParams& params = aParams.get_IconURIParams();
-  if (params.uri().type() != OptionalURIParams::Tvoid_t) {
-    nsCOMPtr<nsIURI> uri = DeserializeURI(params.uri().get_URIParams());
+  if (params.uri().isSome()) {
+    nsCOMPtr<nsIURI> uri = DeserializeURI(params.uri().ref());
     mIconURL = do_QueryInterface(uri);
     if (!mIconURL) {
       MOZ_ASSERT_UNREACHABLE("bad nsIURI passed");
       return false;
     }
   }
 
   mSize = params.size();
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -419,17 +419,17 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadI
     PrincipalInfo topLevelStorageAreaPrincipalInfoTemp;
     rv = PrincipalToPrincipalInfo(aLoadInfo->GetTopLevelStorageAreaPrincipal(),
                                   &topLevelStorageAreaPrincipalInfoTemp);
     NS_ENSURE_SUCCESS(rv, rv);
     topLevelStorageAreaPrincipalInfo =
         Some(topLevelStorageAreaPrincipalInfoTemp);
   }
 
-  OptionalURIParams optionalResultPrincipalURI = mozilla::void_t();
+  Maybe<URIParams> optionalResultPrincipalURI;
   nsCOMPtr<nsIURI> resultPrincipalURI;
   Unused << aLoadInfo->GetResultPrincipalURI(
       getter_AddRefs(resultPrincipalURI));
   if (resultPrincipalURI) {
     SerializeURI(resultPrincipalURI, optionalResultPrincipalURI);
   }
 
   nsTArray<RedirectHistoryEntryInfo> redirectChainIncludingInternalRedirects;
@@ -568,17 +568,17 @@ nsresult LoadInfoArgsToLoadInfo(
   nsCOMPtr<nsIPrincipal> topLevelStorageAreaPrincipal;
   if (loadInfoArgs.topLevelStorageAreaPrincipalInfo().isSome()) {
     topLevelStorageAreaPrincipal = PrincipalInfoToPrincipal(
         loadInfoArgs.topLevelStorageAreaPrincipalInfo().ref(), &rv);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   nsCOMPtr<nsIURI> resultPrincipalURI;
-  if (loadInfoArgs.resultPrincipalURI().type() != OptionalURIParams::Tvoid_t) {
+  if (loadInfoArgs.resultPrincipalURI().isSome()) {
     resultPrincipalURI = DeserializeURI(loadInfoArgs.resultPrincipalURI());
     NS_ENSURE_TRUE(resultPrincipalURI, NS_ERROR_UNEXPECTED);
   }
 
   RedirectHistoryArray redirectChainIncludingInternalRedirects;
   for (const RedirectHistoryEntryInfo& entryInfo :
        loadInfoArgs.redirectChainIncludingInternalRedirects()) {
     nsCOMPtr<nsIRedirectHistoryEntry> redirectHistoryEntry =
--- a/ipc/glue/URIParams.ipdlh
+++ b/ipc/glue/URIParams.ipdlh
@@ -49,17 +49,17 @@ struct JARURIParams
 {
   URIParams jarFile;
   URIParams jarEntry;
   nsCString charset;
 };
 
 struct IconURIParams
 {
-  OptionalURIParams uri;
+  URIParams? uri;
   uint32_t size;
   nsCString contentType;
   nsCString fileName;
   nsCString stockIcon;
   int32_t iconSize;
   int32_t iconState;
 };
 
@@ -81,26 +81,20 @@ union URIParams
   JARURIParams;
   IconURIParams;
   NullPrincipalURIParams;
   JSURIParams;
   SimpleNestedURIParams;
   HostObjectURIParams;
 };
 
-union OptionalURIParams
-{
-  void_t;
-  URIParams;
-};
-
 struct JSURIParams
 {
   SimpleURIParams simpleParams;
-  OptionalURIParams baseURI;
+  URIParams? baseURI;
 };
 
 struct SimpleNestedURIParams
 {
   SimpleURIParams simpleParams;
   URIParams innerURI;
 };
 
--- a/ipc/glue/URIUtils.cpp
+++ b/ipc/glue/URIUtils.cpp
@@ -41,25 +41,25 @@ void SerializeURI(nsIURI* aURI, URIParam
   MOZ_ASSERT(aURI);
 
   aURI->Serialize(aParams);
   if (aParams.type() == URIParams::T__None) {
     MOZ_CRASH("Serialize failed!");
   }
 }
 
-void SerializeURI(nsIURI* aURI, OptionalURIParams& aParams) {
+void SerializeURI(nsIURI* aURI, Maybe<URIParams>& aParams) {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (aURI) {
     URIParams params;
     SerializeURI(aURI, params);
-    aParams = params;
+    aParams = Some(std::move(params));
   } else {
-    aParams = mozilla::void_t();
+    aParams = Nothing();
   }
 }
 
 already_AddRefed<nsIURI> DeserializeURI(const URIParams& aParams) {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIURIMutator> mutator;
 
@@ -111,30 +111,22 @@ already_AddRefed<nsIURI> DeserializeURI(
   nsCOMPtr<nsIURI> uri;
   DebugOnly<nsresult> rv2 = mutator->Finalize(getter_AddRefs(uri));
   MOZ_ASSERT(uri);
   MOZ_ASSERT(NS_SUCCEEDED(rv2));
 
   return uri.forget();
 }
 
-already_AddRefed<nsIURI> DeserializeURI(const OptionalURIParams& aParams) {
+already_AddRefed<nsIURI> DeserializeURI(const Maybe<URIParams>& aParams) {
   MOZ_ASSERT(NS_IsMainThread());
 
   nsCOMPtr<nsIURI> uri;
 
-  switch (aParams.type()) {
-    case OptionalURIParams::Tvoid_t:
-      break;
-
-    case OptionalURIParams::TURIParams:
-      uri = DeserializeURI(aParams.get_URIParams());
-      break;
-
-    default:
-      MOZ_CRASH("Unknown params!");
+  if (aParams.isSome()) {
+    uri = DeserializeURI(aParams.ref());
   }
 
   return uri.forget();
 }
 
 }  // namespace ipc
 }  // namespace mozilla
--- a/ipc/glue/URIUtils.h
+++ b/ipc/glue/URIUtils.h
@@ -12,33 +12,33 @@
 #include "nsCOMPtr.h"
 #include "nsIURI.h"
 
 namespace mozilla {
 namespace ipc {
 
 void SerializeURI(nsIURI* aURI, URIParams& aParams);
 
-void SerializeURI(nsIURI* aURI, OptionalURIParams& aParams);
+void SerializeURI(nsIURI* aURI, Maybe<URIParams>& aParams);
 
 already_AddRefed<nsIURI> DeserializeURI(const URIParams& aParams);
 
-already_AddRefed<nsIURI> DeserializeURI(const OptionalURIParams& aParams);
+already_AddRefed<nsIURI> DeserializeURI(const Maybe<URIParams>& aParams);
 
 template <>
 struct IPDLParamTraits<nsIURI> {
   static void Write(IPC::Message* aMsg, IProtocol* aActor, nsIURI* aParam) {
-    OptionalURIParams params;
+    Maybe<URIParams> params;
     SerializeURI(aParam, params);
     WriteIPDLParam(aMsg, aActor, params);
   }
 
   static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
                    IProtocol* aActor, RefPtr<nsIURI>* aResult) {
-    OptionalURIParams params;
+    Maybe<URIParams> params;
     if (!ReadIPDLParam(aMsg, aIter, aActor, &params)) {
       return false;
     }
     *aResult = DeserializeURI(params);
     return true;
   }
 };
 
--- a/mobile/android/components/geckoview/GeckoViewHistory.cpp
+++ b/mobile/android/components/geckoview/GeckoViewHistory.cpp
@@ -355,17 +355,17 @@ GeckoViewHistory::VisitURI(nsIWidget* aW
   if (!aURI) {
     return NS_OK;
   }
 
   if (XRE_IsContentProcess()) {
     URIParams uri;
     SerializeURI(aURI, uri);
 
-    OptionalURIParams lastVisitedURI;
+    Maybe<URIParams> lastVisitedURI;
     SerializeURI(aLastVisitedURI, lastVisitedURI);
 
     // If we're in the content process, send the visit to the parent. The parent
     // will find the matching chrome window for the content process and tab,
     // then forward the visit to Java.
     if (NS_WARN_IF(!aWidget)) {
       return NS_OK;
     }
--- a/netwerk/base/Predictor.cpp
+++ b/netwerk/base/Predictor.cpp
@@ -534,17 +534,17 @@ class PredictorLearnRunnable final : pub
       // earlier.
       PREDICTOR_LOG(("predictor::learn (async) gNeckoChild went away"));
       return NS_OK;
     }
 
     ipc::URIParams serTargetURI;
     SerializeURI(mTargetURI, serTargetURI);
 
-    ipc::OptionalURIParams serSourceURI;
+    Maybe<ipc::URIParams> serSourceURI;
     SerializeURI(mSourceURI, serSourceURI);
 
     PREDICTOR_LOG(("predictor::learn (async) forwarding to parent"));
     gNeckoChild->SendPredLearn(serTargetURI, serSourceURI, mReason, mOA);
 
     return NS_OK;
   }
 
@@ -652,17 +652,17 @@ Predictor::PredictNative(nsIURI *targetU
 
   PREDICTOR_LOG(("Predictor::Predict"));
 
   if (IsNeckoChild()) {
     MOZ_DIAGNOSTIC_ASSERT(gNeckoChild);
 
     PREDICTOR_LOG(("    called on child process"));
 
-    ipc::OptionalURIParams serTargetURI, serSourceURI;
+    Maybe<ipc::URIParams> serTargetURI, serSourceURI;
     SerializeURI(targetURI, serTargetURI);
     SerializeURI(sourceURI, serSourceURI);
 
     // If two different threads are predicting concurently, this will be
     // overwritten. Thankfully, we only use this in tests, which will
     // overwrite mVerifier perhaps multiple times for each individual test;
     // however, within each test, the multiple predict calls should have the
     // same verifier.
--- a/netwerk/cookie/CookieServiceChild.cpp
+++ b/netwerk/cookie/CookieServiceChild.cpp
@@ -544,17 +544,17 @@ nsresult CookieServiceChild::SetCookieSt
 
   nsDependentCString cookieString(aCookieString);
   nsDependentCString stringServerTime;
   if (aServerTime) stringServerTime.Rebind(aServerTime);
 
   URIParams hostURIParams;
   SerializeURI(aHostURI, hostURIParams);
 
-  OptionalURIParams channelURIParams;
+  Maybe<URIParams> channelURIParams;
   mozilla::OriginAttributes attrs;
   if (aChannel) {
     nsCOMPtr<nsIURI> channelURI;
     aChannel->GetURI(getter_AddRefs(channelURI));
     SerializeURI(channelURI, channelURIParams);
 
     nsCOMPtr<nsILoadInfo> loadInfo = aChannel->LoadInfo();
     attrs = loadInfo->GetOriginAttributes();
--- a/netwerk/cookie/CookieServiceParent.cpp
+++ b/netwerk/cookie/CookieServiceParent.cpp
@@ -210,17 +210,17 @@ mozilla::ipc::IPCResult CookieServicePar
 }
 
 void CookieServiceParent::ActorDestroy(ActorDestroyReason aWhy) {
   // Nothing needed here. Called right before destructor since this is a
   // non-refcounted class.
 }
 
 mozilla::ipc::IPCResult CookieServiceParent::RecvSetCookieString(
-    const URIParams &aHost, const OptionalURIParams &aChannelURI,
+    const URIParams &aHost, const Maybe<URIParams> &aChannelURI,
     const bool &aIsForeign, const bool &aIsTrackingResource,
     const bool &aFirstPartyStorageAccessGranted, const nsCString &aCookieString,
     const nsCString &aServerTime, const OriginAttributes &aAttrs,
     const bool &aFromHttp) {
   if (!mCookieService) return IPC_OK();
 
   // Deserialize URI. Having a host URI is mandatory and should always be
   // provided by the child; thus we consider failure fatal.
--- a/netwerk/cookie/CookieServiceParent.h
+++ b/netwerk/cookie/CookieServiceParent.h
@@ -40,17 +40,17 @@ class CookieServiceParent : public PCook
   // sure that we are only forwarding those cookie updates to other content
   // processes, not the one they originated from.
   bool ProcessingCookie() { return mProcessingCookie; }
 
  protected:
   virtual void ActorDestroy(ActorDestroyReason aWhy) override;
 
   mozilla::ipc::IPCResult RecvSetCookieString(
-      const URIParams &aHost, const OptionalURIParams &aChannelURI,
+      const URIParams &aHost, const Maybe<URIParams> &aChannelURI,
       const bool &aIsForeign, const bool &aIsTrackingResource,
       const bool &aFirstPartyStorageAccessGranted,
       const nsCString &aCookieString, const nsCString &aServerTime,
       const OriginAttributes &aAttrs, const bool &aFromHttp);
   mozilla::ipc::IPCResult RecvPrepareCookieList(
       const URIParams &aHost, const bool &aIsForeign,
       const bool &aIsTackingResource,
       const bool &aFirstPartyStorageAccessGranted,
--- a/netwerk/cookie/PCookieService.ipdl
+++ b/netwerk/cookie/PCookieService.ipdl
@@ -66,17 +66,17 @@ parent:
    *        The origin attributes from the HTTP channel or document that the
    *        cookie is being set on.
    *
    * @see nsICookieService.setCookieString
    * @see nsICookieService.setCookieStringFromHttp
    * @see mozIThirdPartyUtil.isThirdPartyChannel
    */
   nested(inside_cpow) async SetCookieString(URIParams host,
-                                            OptionalURIParams channelURI,
+                                            URIParams? channelURI,
                                             bool isForeign,
                                             bool isTrackingResource,
                                             bool firstPartyStorageAccessGranted,
                                             nsCString cookieString,
                                             nsCString serverTime,
                                             OriginAttributes attrs,
                                             bool aFromHttp);
 
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -40,29 +40,29 @@ struct PreferredAlternativeDataTypeParam
 
 //-----------------------------------------------------------------------------
 // LoadInfo IPDL structs
 //-----------------------------------------------------------------------------
 
 struct RedirectHistoryEntryInfo
 {
   PrincipalInfo       principalInfo;
-  OptionalURIParams   referrerUri;
+  URIParams?          referrerUri;
   nsCString           remoteAddress;
 };
 
 struct LoadInfoArgs
 {
   PrincipalInfo?              requestingPrincipalInfo;
   PrincipalInfo               triggeringPrincipalInfo;
   PrincipalInfo?              principalToInheritInfo;
   PrincipalInfo?              sandboxedLoadingPrincipalInfo;
   PrincipalInfo?              topLevelPrincipalInfo;
   PrincipalInfo?              topLevelStorageAreaPrincipalInfo;
-  OptionalURIParams           resultPrincipalURI;
+  URIParams?                  resultPrincipalURI;
   uint32_t                    securityFlags;
   uint32_t                    contentPolicyType;
   uint32_t                    tainting;
   bool                        upgradeInsecureRequests;
   bool                        browserUpgradeInsecureRequests;
   bool                        browserWouldUpgradeInsecureRequests;
   bool                        verifySignedContent;
   bool                        enforceSRI;
@@ -204,22 +204,22 @@ union OptionalCorsPreflightArgs
 };
 
 struct HttpChannelOpenArgs
 {
   URIParams                   uri;
   // - TODO: bug 571161: unclear if any HTTP channel clients ever
   // set originalURI != uri (about:credits?); also not clear if
   // chrome channel would ever need to know.  Get rid of next arg?
-  OptionalURIParams           original;
-  OptionalURIParams           doc;
-  OptionalURIParams           originalReferrer;
+  URIParams?                  original;
+  URIParams?                  doc;
+  URIParams?                  originalReferrer;
   uint32_t                    referrerPolicy;
-  OptionalURIParams           apiRedirectTo;
-  OptionalURIParams           topWindowURI;
+  URIParams?                  apiRedirectTo;
+  URIParams?                  topWindowURI;
   nsIPrincipal                topWindowPrincipal;
   uint32_t                    loadFlags;
   RequestHeaderTuples         requestHeaders;
   nsCString                   requestMethod;
   IPCStream?                  uploadStream;
   bool                        uploadStreamHasHeaders;
   int16_t                     priority;
   uint32_t                    classOfService;
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -738,18 +738,18 @@ mozilla::ipc::IPCResult NeckoParent::Rec
   }
   CallbackMap().erase(aCallbackId);
   callback->OnAuthCancelled(nullptr, aUserCancel);
   return IPC_OK();
 }
 
 /* Predictor Messages */
 mozilla::ipc::IPCResult NeckoParent::RecvPredPredict(
-    const ipc::OptionalURIParams& aTargetURI,
-    const ipc::OptionalURIParams& aSourceURI, const uint32_t& aReason,
+    const Maybe<ipc::URIParams>& aTargetURI,
+    const Maybe<ipc::URIParams>& aSourceURI, const uint32_t& aReason,
     const OriginAttributes& aOriginAttributes, const bool& hasVerifier) {
   nsCOMPtr<nsIURI> targetURI = DeserializeURI(aTargetURI);
   nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
 
   // Get the current predictor
   nsresult rv = NS_OK;
   nsCOMPtr<nsINetworkPredictor> predictor =
       do_GetService("@mozilla.org/network/predictor;1", &rv);
@@ -760,17 +760,17 @@ mozilla::ipc::IPCResult NeckoParent::Rec
     verifier = do_QueryInterface(predictor);
   }
   predictor->PredictNative(targetURI, sourceURI, aReason, aOriginAttributes,
                            verifier);
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult NeckoParent::RecvPredLearn(
-    const ipc::URIParams& aTargetURI, const ipc::OptionalURIParams& aSourceURI,
+    const ipc::URIParams& aTargetURI, const Maybe<ipc::URIParams>& aSourceURI,
     const uint32_t& aReason, const OriginAttributes& aOriginAttributes) {
   nsCOMPtr<nsIURI> targetURI = DeserializeURI(aTargetURI);
   nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
 
   // Get the current predictor
   nsresult rv = NS_OK;
   nsCOMPtr<nsINetworkPredictor> predictor =
       do_GetService("@mozilla.org/network/predictor;1", &rv);
--- a/netwerk/ipc/NeckoParent.h
+++ b/netwerk/ipc/NeckoParent.h
@@ -195,24 +195,23 @@ class NeckoParent : public PNeckoParent 
                                               const nsString& aUser,
                                               const nsString& aPassword,
                                               const nsString& aDomain);
   mozilla::ipc::IPCResult RecvOnAuthCancelled(const uint64_t& aCallbackId,
                                               const bool& aUserCancel);
 
   /* Predictor Messages */
   mozilla::ipc::IPCResult RecvPredPredict(
-      const ipc::OptionalURIParams& aTargetURI,
-      const ipc::OptionalURIParams& aSourceURI,
+      const Maybe<ipc::URIParams>& aTargetURI,
+      const Maybe<ipc::URIParams>& aSourceURI,
       const PredictorPredictReason& aReason,
       const OriginAttributes& aOriginAttributes, const bool& hasVerifier);
 
   mozilla::ipc::IPCResult RecvPredLearn(
-      const ipc::URIParams& aTargetURI,
-      const ipc::OptionalURIParams& aSourceURI,
+      const ipc::URIParams& aTargetURI, const Maybe<ipc::URIParams>& aSourceURI,
       const PredictorPredictReason& aReason,
       const OriginAttributes& aOriginAttributes);
   mozilla::ipc::IPCResult RecvPredReset();
 
   mozilla::ipc::IPCResult RecvRequestContextLoadBegin(const uint64_t& rcid);
   mozilla::ipc::IPCResult RecvRequestContextAfterDOMContentLoaded(
       const uint64_t& rcid);
   mozilla::ipc::IPCResult RecvRemoveRequestContext(const uint64_t& rcid);
--- a/netwerk/ipc/PNecko.ipdl
+++ b/netwerk/ipc/PNecko.ipdl
@@ -83,20 +83,20 @@ parent:
   async PUDPSocket(Principal principal, nsCString filter);
 
   async PDNSRequest(nsCString hostName, OriginAttributes originAttributes,
                     uint32_t flags);
 
   async PWebSocketEventListener(uint64_t aInnerWindowID);
 
   /* Predictor Methods */
-  async PredPredict(OptionalURIParams targetURI, OptionalURIParams sourceURI,
+  async PredPredict(URIParams? targetURI, URIParams? sourceURI,
                     uint32_t reason, OriginAttributes originAttributes,
                     bool hasVerifier);
-  async PredLearn(URIParams targetURI, OptionalURIParams sourceURI,
+  async PredLearn(URIParams targetURI, URIParams? sourceURI,
                   uint32_t reason, OriginAttributes originAttributes);
   async PredReset();
 
   async SpeculativeConnect(URIParams uri, Principal principal, bool anonymous);
   async HTMLDNSPrefetch(nsString hostname, bool isHttps,
                         OriginAttributes originAttributes, uint16_t flags);
   async CancelHTMLDNSPrefetch(nsString hostname, bool isHttps,
                               OriginAttributes originAttributes,
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -2136,21 +2136,21 @@ HttpChannelChild::CompleteRedirectSetup(
 //-----------------------------------------------------------------------------
 // HttpChannelChild::nsIAsyncVerifyRedirectCallback
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 HttpChannelChild::OnRedirectVerifyCallback(nsresult result) {
   LOG(("HttpChannelChild::OnRedirectVerifyCallback [this=%p]\n", this));
   MOZ_ASSERT(NS_IsMainThread());
-  OptionalURIParams redirectURI;
+  Maybe<URIParams> redirectURI;
   nsresult rv;
 
   uint32_t referrerPolicy = REFERRER_POLICY_UNSET;
-  OptionalURIParams referrerURI;
+  Maybe<URIParams> referrerURI;
   SerializeURI(nullptr, referrerURI);
 
   nsCOMPtr<nsIHttpChannel> newHttpChannel =
       do_QueryInterface(mRedirectChannelChild);
 
   if (NS_SUCCEEDED(result) && !mRedirectChannelChild) {
     // mRedirectChannelChild doesn't exist means we're redirecting to a protocol
     // that doesn't implement nsIChildChannel. The redirect result should be set
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -377,21 +377,21 @@ void HttpChannelParent::InvokeAsyncOpen(
   }
   rv = mChannel->AsyncOpen(mParentListener);
   if (NS_FAILED(rv)) {
     AsyncOpenFailed(rv);
   }
 }
 
 bool HttpChannelParent::DoAsyncOpen(
-    const URIParams& aURI, const OptionalURIParams& aOriginalURI,
-    const OptionalURIParams& aDocURI,
-    const OptionalURIParams& aOriginalReferrerURI,
-    const uint32_t& aReferrerPolicy, const OptionalURIParams& aAPIRedirectToURI,
-    const OptionalURIParams& aTopWindowURI, nsIPrincipal* aTopWindowPrincipal,
+    const URIParams& aURI, const Maybe<URIParams>& aOriginalURI,
+    const Maybe<URIParams>& aDocURI,
+    const Maybe<URIParams>& aOriginalReferrerURI,
+    const uint32_t& aReferrerPolicy, const Maybe<URIParams>& aAPIRedirectToURI,
+    const Maybe<URIParams>& aTopWindowURI, nsIPrincipal* aTopWindowPrincipal,
     const uint32_t& aLoadFlags, const RequestHeaderTuples& requestHeaders,
     const nsCString& requestMethod, const Maybe<IPCStream>& uploadStream,
     const bool& uploadStreamHasHeaders, const int16_t& priority,
     const uint32_t& classOfService, const uint8_t& redirectionLimit,
     const bool& allowSTS, const uint32_t& thirdPartyFlags,
     const bool& doResumeAt, const uint64_t& startPos, const nsCString& entityID,
     const bool& chooseApplicationCache, const nsCString& appCacheClientID,
     const bool& allowSpdy, const bool& allowAltSvc, const bool& beConservative,
@@ -822,18 +822,18 @@ mozilla::ipc::IPCResult HttpChannelParen
   if (mCacheEntry) mCacheEntry->SetMetaDataElement("charset", charset.get());
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult HttpChannelParent::RecvRedirect2Verify(
     const nsresult& aResult, const RequestHeaderTuples& changedHeaders,
     const ChildLoadInfoForwarderArgs& aLoadInfoForwarder,
     const uint32_t& loadFlags, const uint32_t& referrerPolicy,
-    const OptionalURIParams& aReferrerURI,
-    const OptionalURIParams& aAPIRedirectURI,
+    const Maybe<URIParams>& aReferrerURI,
+    const Maybe<URIParams>& aAPIRedirectURI,
     const OptionalCorsPreflightArgs& aCorsPreflightArgs,
     const bool& aChooseAppcache) {
   LOG(("HttpChannelParent::RecvRedirect2Verify [this=%p result=%" PRIx32 "]\n",
        this, static_cast<uint32_t>(aResult)));
 
   // Result from the child.  If something fails here, we might overwrite a
   // success with a further failure.
   nsresult result = aResult;
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -133,22 +133,22 @@ class HttpChannelParent final : public n
 
  protected:
   // used to connect redirected-to channel in parent with just created
   // ChildChannel.  Used during redirects.
   MOZ_MUST_USE bool ConnectChannel(const uint32_t& channelId,
                                    const bool& shouldIntercept);
 
   MOZ_MUST_USE bool DoAsyncOpen(
-      const URIParams& uri, const OptionalURIParams& originalUri,
-      const OptionalURIParams& docUri,
-      const OptionalURIParams& originalReferrerUri,
+      const URIParams& uri, const Maybe<URIParams>& originalUri,
+      const Maybe<URIParams>& docUri,
+      const Maybe<URIParams>& originalReferrerUri,
       const uint32_t& referrerPolicy,
-      const OptionalURIParams& internalRedirectUri,
-      const OptionalURIParams& topWindowUri, nsIPrincipal* aTopWindowPrincipal,
+      const Maybe<URIParams>& internalRedirectUri,
+      const Maybe<URIParams>& topWindowUri, nsIPrincipal* aTopWindowPrincipal,
       const uint32_t& loadFlags, const RequestHeaderTuples& requestHeaders,
       const nsCString& requestMethod, const Maybe<IPCStream>& uploadStream,
       const bool& uploadStreamHasHeaders, const int16_t& priority,
       const uint32_t& classOfService, const uint8_t& redirectionLimit,
       const bool& allowSTS, const uint32_t& thirdPartyFlags,
       const bool& doResumeAt, const uint64_t& startPos,
       const nsCString& entityID, const bool& chooseApplicationCache,
       const nsCString& appCacheClientID, const bool& allowSpdy,
@@ -184,18 +184,18 @@ class HttpChannelParent final : public n
       const nsCString& charset) override;
   virtual mozilla::ipc::IPCResult RecvSuspend() override;
   virtual mozilla::ipc::IPCResult RecvResume() override;
   virtual mozilla::ipc::IPCResult RecvCancel(const nsresult& status) override;
   virtual mozilla::ipc::IPCResult RecvRedirect2Verify(
       const nsresult& result, const RequestHeaderTuples& changedHeaders,
       const ChildLoadInfoForwarderArgs& aLoadInfoForwarder,
       const uint32_t& loadFlags, const uint32_t& referrerPolicy,
-      const OptionalURIParams& aReferrerURI,
-      const OptionalURIParams& apiRedirectUri,
+      const Maybe<URIParams>& aReferrerURI,
+      const Maybe<URIParams>& apiRedirectUri,
       const OptionalCorsPreflightArgs& aCorsPreflightArgs,
       const bool& aChooseAppcache) override;
   virtual mozilla::ipc::IPCResult RecvDocumentChannelCleanup(
       const bool& clearCacheEntry) override;
   virtual mozilla::ipc::IPCResult RecvMarkOfflineCacheEntryAsForeign() override;
   virtual mozilla::ipc::IPCResult RecvDivertOnDataAvailable(
       const nsCString& data, const uint64_t& offset,
       const uint32_t& count) override;
--- a/netwerk/protocol/http/PHttpChannel.ipdl
+++ b/netwerk/protocol/http/PHttpChannel.ipdl
@@ -40,18 +40,17 @@ parent:
   async Resume();
 
   async Cancel(nsresult status);
 
   // Reports approval/veto of redirect by child process redirect observers
   async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
                         ChildLoadInfoForwarderArgs loadInfoForwarder,
                         uint32_t loadFlags, uint32_t referrerPolicy,
-                        OptionalURIParams referrerUri,
-                        OptionalURIParams apiRedirectTo,
+                        URIParams? referrerUri, URIParams? apiRedirectTo,
                         OptionalCorsPreflightArgs corsPreflightArgs,
                         bool chooseAppcache);
 
   // Sent to the parent in order signal that the child side listeners have been
   // set up and the parent side of the channel can be opened.
   async CrossProcessRedirectDone(nsresult result);
 
   // For document loads we keep this protocol open after child's
--- a/netwerk/protocol/websocket/PWebSocket.ipdl
+++ b/netwerk/protocol/websocket/PWebSocket.ipdl
@@ -29,17 +29,17 @@ union OptionalTransportProvider
 };
 
 async protocol PWebSocket
 {
   manager PNecko;
 
 parent:
   // Forwarded methods corresponding to methods on nsIWebSocketChannel
-  async AsyncOpen(OptionalURIParams aURI,
+  async AsyncOpen(URIParams? 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
@@ -439,31 +439,28 @@ WebSocketChannelChild::AsyncOpen(nsIURI*
   ContentChild* cc = static_cast<ContentChild*>(gNeckoChild->Manager());
   if (cc->IsShuttingDown()) {
     return NS_ERROR_FAILURE;
   }
 
   // Corresponding release in DeallocPWebSocket
   AddIPDLReference();
 
-  OptionalURIParams uri;
+  Maybe<URIParams> uri;
   Maybe<LoadInfoArgs> loadInfoArgs;
   OptionalTransportProvider transportProvider;
 
   if (!mIsServerSide) {
-    uri = URIParams();
-    SerializeURI(aURI, uri.get_URIParams());
+    uri.emplace(URIParams());
+    SerializeURI(aURI, uri.ref());
     nsresult rv = LoadInfoToLoadInfoArgs(mLoadInfo, &loadInfoArgs);
     NS_ENSURE_SUCCESS(rv, rv);
 
     transportProvider = void_t();
   } else {
-    uri = void_t();
-    loadInfoArgs = Nothing();
-
     MOZ_ASSERT(mServerTransportProvider);
     PTransportProviderChild* ipcChild;
     nsresult rv = mServerTransportProvider->GetIPCChild(&ipcChild);
     NS_ENSURE_SUCCESS(rv, rv);
 
     transportProvider = ipcChild;
   }
 
--- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp
@@ -43,17 +43,17 @@ mozilla::ipc::IPCResult WebSocketChannel
   IProtocol* mgr = Manager();
   if (mIPCOpen && !Send__delete__(this)) {
     return IPC_FAIL_NO_REASON(mgr);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult WebSocketChannelParent::RecvAsyncOpen(
-    const OptionalURIParams& aURI, const nsCString& aOrigin,
+    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,
     const OptionalTransportProvider& aTransportProvider,
     const nsCString& aNegotiatedExtensions) {
   LOG(("WebSocketChannelParent::RecvAsyncOpen() %p\n", this));
 
--- a/netwerk/protocol/websocket/WebSocketChannelParent.h
+++ b/netwerk/protocol/websocket/WebSocketChannelParent.h
@@ -34,17 +34,17 @@ class WebSocketChannelParent : public PW
   NS_DECL_NSIINTERFACEREQUESTOR
 
   WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvider,
                          nsILoadContext* aLoadContext,
                          PBOverrideStatus aOverrideStatus, uint32_t aSerial);
 
  private:
   mozilla::ipc::IPCResult RecvAsyncOpen(
-      const OptionalURIParams& aURI, const nsCString& aOrigin,
+      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,
       const OptionalTransportProvider& aTransportProvider,
       const nsCString& aNegotiatedExtensions);
   mozilla::ipc::IPCResult RecvClose(const uint16_t& code,
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -2003,17 +2003,17 @@ History::VisitURI(nsIWidget* aWidget, ns
   if (mShuttingDown) {
     return NS_OK;
   }
 
   if (XRE_IsContentProcess()) {
     URIParams uri;
     SerializeURI(aURI, uri);
 
-    OptionalURIParams lastVisitedURI;
+    Maybe<URIParams> lastVisitedURI;
     SerializeURI(aLastVisitedURI, lastVisitedURI);
 
     NS_ENSURE_ARG(aWidget);
     TabChild* tabChild = aWidget->GetOwningTabChild();
     NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
     (void)tabChild->SendVisitURI(uri, lastVisitedURI, aFlags);
     return NS_OK;
   }
--- a/uriloader/exthandler/ExternalHelperAppParent.cpp
+++ b/uriloader/exthandler/ExternalHelperAppParent.cpp
@@ -28,19 +28,18 @@ namespace mozilla {
 namespace dom {
 
 NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsHashPropertyBag,
                             nsIRequest, nsIChannel, nsIMultiPartChannel,
                             nsIPrivateBrowsingChannel, nsIResumableChannel,
                             nsIStreamListener, nsIExternalHelperAppParent)
 
 ExternalHelperAppParent::ExternalHelperAppParent(
-    const OptionalURIParams& uri,
-    const int64_t& aContentLength, const bool& aWasFileChannel,
-    const nsCString& aContentDispositionHeader,
+    const Maybe<URIParams>& uri, const int64_t& aContentLength,
+    const bool& aWasFileChannel, const nsCString& aContentDispositionHeader,
     const uint32_t& aContentDispositionHint,
     const nsString& aContentDispositionFilename)
     : mURI(DeserializeURI(uri)),
       mPending(false)
 #ifdef DEBUG
       ,
       mDiverted(false)
 #endif
@@ -83,17 +82,17 @@ void UpdateContentContext(nsIStreamListe
   MOZ_ASSERT(aListener);
   nsCOMPtr<nsIInterfaceRequestor> window = GetWindowFromTabParent(aBrowser);
   static_cast<nsExternalAppHandler*>(aListener)->SetContentContext(window);
 }
 
 void ExternalHelperAppParent::Init(
     const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
     const nsCString& aMimeContentType, const bool& aForceSave,
-    const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) {
+    const Maybe<URIParams>& aReferrer, PBrowserParent* aBrowser) {
   mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs,
                                        getter_AddRefs(mLoadInfo));
 
   nsCOMPtr<nsIExternalHelperAppService> helperAppService =
       do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
   NS_ASSERTION(helperAppService, "No Helper App Service!");
 
   nsCOMPtr<nsIURI> referrer = DeserializeURI(aReferrer);
--- a/uriloader/exthandler/ExternalHelperAppParent.h
+++ b/uriloader/exthandler/ExternalHelperAppParent.h
@@ -15,17 +15,17 @@
 
 namespace IPC {
 class URI;
 }  // namespace IPC
 
 namespace mozilla {
 
 namespace ipc {
-class OptionalURIParams;
+class URIParams;
 }  // namespace ipc
 
 namespace net {
 class PChannelDiverterParent;
 }  // namespace net
 
 namespace dom {
 
@@ -56,17 +56,16 @@ class ExternalHelperAppParent
     : public PExternalHelperAppParent,
       public nsHashPropertyBag,
       public nsIChannel,
       public nsIMultiPartChannel,
       public nsIResumableChannel,
       public nsIStreamListener,
       public net::PrivateBrowsingChannel<ExternalHelperAppParent>,
       public nsIExternalHelperAppParent {
-  typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
 
  public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIREQUEST
   NS_DECL_NSICHANNEL
   NS_DECL_NSIMULTIPARTCHANNEL
   NS_DECL_NSIRESUMABLECHANNEL
   NS_DECL_NSISTREAMLISTENER
@@ -79,25 +78,26 @@ class ExternalHelperAppParent
                                               const uint32_t& count) override;
   mozilla::ipc::IPCResult RecvOnStopRequest(const nsresult& code) override;
 
   mozilla::ipc::IPCResult RecvDivertToParentUsing(
       PChannelDiverterParent* diverter, PBrowserParent* aBrowser) override;
 
   bool WasFileChannel() override { return mWasFileChannel; }
 
-  ExternalHelperAppParent(
-      const OptionalURIParams& uri,
-      const int64_t& contentLength, const bool& wasFileChannel,
-      const nsCString& aContentDispositionHeader,
-      const uint32_t& aContentDispositionHint,
-      const nsString& aContentDispositionFilename);
+  ExternalHelperAppParent(const Maybe<mozilla::ipc::URIParams>& uri,
+                          const int64_t& contentLength,
+                          const bool& wasFileChannel,
+                          const nsCString& aContentDispositionHeader,
+                          const uint32_t& aContentDispositionHint,
+                          const nsString& aContentDispositionFilename);
   void Init(const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
             const nsCString& aMimeContentType, const bool& aForceSave,
-            const OptionalURIParams& aReferrer, PBrowserParent* aBrowser);
+            const Maybe<mozilla::ipc::URIParams>& aReferrer,
+            PBrowserParent* aBrowser);
 
  protected:
   virtual ~ExternalHelperAppParent();
 
   virtual void ActorDestroy(ActorDestroyReason why) override;
   void Delete();
 
  private:
--- a/uriloader/exthandler/nsExternalHelperAppService.cpp
+++ b/uriloader/exthandler/nsExternalHelperAppService.cpp
@@ -629,17 +629,17 @@ nsresult nsExternalHelperAppService::DoC
 
     nsCOMPtr<nsIFileChannel> fileChan(do_QueryInterface(aRequest));
     wasFileChannel = fileChan != nullptr;
   }
 
   nsCOMPtr<nsIURI> referrer;
   NS_GetReferrerFromChannel(channel, getter_AddRefs(referrer));
 
-  OptionalURIParams uriParams, referrerParams;
+  Maybe<URIParams> uriParams, referrerParams;
   SerializeURI(uri, uriParams);
   SerializeURI(referrer, referrerParams);
 
   Maybe<mozilla::net::LoadInfoArgs> loadInfoArgs;
   MOZ_ALWAYS_SUCCEEDS(LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
 
   // Now we build a protocol for forwarding our data to the parent.  The
   // protocol will act as a listener on the child-side and create a "real"