diff --git a/caps/DomainPolicy.cpp b/caps/DomainPolicy.cpp index 484be9b19b7c..11dc12f39ccf 100644 --- a/caps/DomainPolicy.cpp +++ b/caps/DomainPolicy.cpp @@ -31,7 +31,7 @@ static nsresult BroadcastDomainSetChange(DomainSetType aSetType, return NS_OK; } - OptionalURIParams uri; + Maybe uri; SerializeURI(aDomain, uri); for (uint32_t i = 0; i < parents.Length(); i++) { diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index ffd241b2144c..33c7a59aaa0f 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -410,7 +410,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, } RefPtr postData; - ipc::OptionalURIParams uri; + Maybe uri; nsAutoString providerName; if (!contentChild->SendKeywordToURI(keyword, &providerName, &postData, &uri)) { diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index bc18ab257631..53fc6f2eda0c 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -873,7 +873,7 @@ nsresult ContentChild::ProvideWindowCommon( return rv; } - OptionalURIParams uriToLoad; + Maybe uriToLoad; SerializeURI(aURI, uriToLoad); Unused << SendCreateWindowInDifferentProcess( aTabOpener, aChromeFlags, aCalledFromJS, aPositionSpecified, @@ -1073,11 +1073,9 @@ nsresult ContentChild::ProvideWindowCommon( return rv; } - OptionalURIParams uriToLoad; + Maybe uriToLoad; if (aURI) { SerializeURI(aURI, uriToLoad); - } else { - uriToLoad = mozilla::void_t(); } SendCreateWindow(aTabOpener, newChild, aChromeFlags, aCalledFromJS, @@ -2017,13 +2015,13 @@ bool ContentChild::DeallocPPSMContentDownloaderChild( } PExternalHelperAppChild* ContentChild::AllocPExternalHelperAppChild( - const OptionalURIParams& uri, + const Maybe& uri, const Maybe& 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& aReferrer, PBrowserChild* aBrowser) { auto* child = new ExternalHelperAppChild(); child->AddRef(); return child; @@ -2742,7 +2740,7 @@ bool ContentChild::DeallocPOfflineCacheUpdateChild( mozilla::ipc::IPCResult ContentChild::RecvDomainSetChanged( const uint32_t& aSetType, const uint32_t& aChangeType, - const OptionalURIParams& aDomain) { + const Maybe& aDomain) { if (aChangeType == ACTIVATE_POLICY) { if (mPolicy) { return IPC_OK(); diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 91cdb3202dd1..eb55d752e50f 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -62,7 +62,6 @@ nsresult GetObjDir(nsIFile** aObjDir); #endif /* XP_MACOSX */ namespace ipc { -class OptionalURIParams; class URIParams; } // namespace ipc @@ -85,7 +84,6 @@ class ContentChild final : public PContentChild, 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; @@ -279,13 +277,13 @@ class ContentChild final : public PContentChild, PPSMContentDownloaderChild* aDownloader); PExternalHelperAppChild* AllocPExternalHelperAppChild( - const OptionalURIParams& uri, + const Maybe& uri, const Maybe& 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& aReferrer, PBrowserChild* aBrowser); bool DeallocPExternalHelperAppChild(PExternalHelperAppChild* aService); @@ -450,9 +448,9 @@ class ContentChild final : public PContentChild, 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& aDomain); mozilla::ipc::IPCResult RecvShutdown(); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index e5bb8b74a6a0..e72f48404df3 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -3631,13 +3631,13 @@ bool ContentParent::DeallocPPSMContentDownloaderParent( } PExternalHelperAppParent* ContentParent::AllocPExternalHelperAppParent( - const OptionalURIParams& uri, + const Maybe& uri, const Maybe& 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& aReferrer, PBrowserParent* aBrowser) { ExternalHelperAppParent* parent = new ExternalHelperAppParent( uri, aContentLength, aWasFileChannel, aContentDisposition, aContentDispositionHint, aContentDispositionFilename); @@ -3654,13 +3654,13 @@ bool ContentParent::DeallocPExternalHelperAppParent( } mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor( - PExternalHelperAppParent* actor, const OptionalURIParams& uri, + PExternalHelperAppParent* actor, const Maybe& uri, const Maybe& 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& aReferrer, PBrowserParent* aBrowser) { static_cast(actor)->Init( loadInfoArgs, aMimeContentType, aForceSave, aReferrer, aBrowser); return IPC_OK(); @@ -4185,9 +4185,9 @@ nsresult ContentParent::DoSendAsyncMessage(JSContext* aCx, mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI( const nsCString& aKeyword, nsString* aProviderName, - RefPtr* aPostData, OptionalURIParams* aURI) { + RefPtr* aPostData, Maybe* aURI) { *aPostData = nullptr; - *aURI = void_t(); + *aURI = Nothing(); nsCOMPtr fixup = components::URIFixup::Service(); if (!fixup) { @@ -4872,7 +4872,7 @@ 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& aURIToLoad, const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, const uint32_t& aReferrerPolicy, CreateWindowResolver&& aResolve) { @@ -4952,7 +4952,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow( 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& aURIToLoad, const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, const nsString& aName, const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index baddb7aa683a..042d4e98a919 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -81,7 +81,6 @@ class PrintingParent; namespace ipc { class CrashReporterHost; -class OptionalURIParams; class PFileDescriptorSetParent; class URIParams; class TestShellParent; @@ -130,7 +129,6 @@ class ContentParent final : public PContentParent, 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; @@ -514,7 +512,7 @@ class ContentParent final : public PContentParent, 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& aURIToLoad, const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, const uint32_t& aReferrerPolicy, @@ -523,7 +521,7 @@ class ContentParent final : public PContentParent, 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& aURIToLoad, const nsCString& aFeatures, const nsCString& aBaseURI, const float& aFullZoom, const nsString& aName, const IPC::Principal& aTriggeringPrincipal, @@ -875,24 +873,24 @@ class ContentParent final : public PContentParent, PPSMContentDownloaderParent* aDownloader); PExternalHelperAppParent* AllocPExternalHelperAppParent( - const OptionalURIParams& aUri, + const Maybe& aUri, const Maybe& 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& aReferrer, PBrowserParent* aBrowser); bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService); mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor( - PExternalHelperAppParent* actor, const OptionalURIParams& uri, + PExternalHelperAppParent* actor, const Maybe& uri, const Maybe& 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& aReferrer, PBrowserParent* aBrowser) override; PHandlerServiceParent* AllocPHandlerServiceParent(); @@ -1039,7 +1037,7 @@ class ContentParent final : public PContentParent, mozilla::ipc::IPCResult RecvKeywordToURI(const nsCString& aKeyword, nsString* aProviderName, RefPtr* aPostData, - OptionalURIParams* aURI); + Maybe* aURI); mozilla::ipc::IPCResult RecvNotifyKeywordSearchLoading( const nsString& aProvider, const nsString& aKeyword); diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 5f1e5abf0ab5..18daebc50a13 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -935,7 +935,7 @@ child: 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). */ diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index ab799a427505..6e588a2fe425 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -277,7 +277,7 @@ struct XPCOMInitData nsString[] dictionaries; ClipboardCapabilities clipboardCaps; DomainPolicyClone domainPolicy; - OptionalURIParams userContentSheetURL; + URIParams? userContentSheetURL; GfxVarUpdate[] gfxNonDefaultVarUpdates; ContentDeviceData contentDeviceData; GfxInfoFeatureStatus[] gfxFeatureStatus; @@ -587,7 +587,7 @@ child: 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 @@ -901,7 +901,7 @@ parent: async PPSMContentDownloader(uint32_t aCertType); - async PExternalHelperApp(OptionalURIParams uri, + async PExternalHelperApp(URIParams? uri, LoadInfoArgs? loadInfoArgs, nsCString aMimeContentType, nsCString aContentDisposition, @@ -910,7 +910,7 @@ parent: bool aForceSave, int64_t aContentLength, bool aWasFileChannel, - OptionalURIParams aReferrer, + URIParams? aReferrer, nullable PBrowser aBrowser); async PHandlerService(); @@ -971,7 +971,7 @@ parent: 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); @@ -1120,7 +1120,7 @@ parent: bool aCalledFromJS, bool aPositionSpecified, bool aSizeSpecified, - OptionalURIParams aURIToLoad, + URIParams? aURIToLoad, nsCString aFeatures, nsCString aBaseURI, float aFullZoom, @@ -1135,7 +1135,7 @@ parent: bool aCalledFromJS, bool aPositionSpecified, bool aSizeSpecified, - OptionalURIParams aURIToLoad, + URIParams? aURIToLoad, nsCString aFeatures, nsCString aBaseURI, float aFullZoom, diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index a7b74971e25f..c02ba8c53e2f 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -3393,7 +3393,7 @@ mozilla::ipc::IPCResult TabParent::RecvShowCanvasPermissionPrompt( } mozilla::ipc::IPCResult TabParent::RecvVisitURI( - const URIParams& aURI, const OptionalURIParams& aLastVisitedURI, + const URIParams& aURI, const Maybe& aLastVisitedURI, const uint32_t& aFlags) { nsCOMPtr ourURI = DeserializeURI(aURI); if (!ourURI) { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 248430160ceb..1f98d7b0c662 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -626,7 +626,7 @@ class TabParent final : public PBrowserParent, mozilla::ipc::IPCResult RecvGetSystemFont(nsCString* aFontName); mozilla::ipc::IPCResult RecvVisitURI(const URIParams& aURI, - const OptionalURIParams& aLastVisitedURI, + const Maybe& aLastVisitedURI, const uint32_t& aFlags); mozilla::ipc::IPCResult RecvQueryVisitedState( diff --git a/dom/jsurl/nsJSProtocolHandler.cpp b/dom/jsurl/nsJSProtocolHandler.cpp index 843c2e5d0ba0..0d6668581370 100644 --- a/dom/jsurl/nsJSProtocolHandler.cpp +++ b/dom/jsurl/nsJSProtocolHandler.cpp @@ -51,6 +51,7 @@ #include "nsILoadInfo.h" #include "nsContentSecurityManager.h" +#include "mozilla/Maybe.h" #include "mozilla/ipc/URIUtils.h" using mozilla::dom::AutoEntryScript; @@ -1231,7 +1232,7 @@ NS_IMETHODIMP_(void) nsJSURI::Serialize(mozilla::ipc::URIParams& aParams) { if (mBaseURI) { SerializeURI(mBaseURI, jsParams.baseURI()); } else { - jsParams.baseURI() = mozilla::void_t(); + jsParams.baseURI() = mozilla::Nothing(); } aParams = jsParams; @@ -1248,8 +1249,8 @@ bool nsJSURI::Deserialize(const mozilla::ipc::URIParams& aParams) { 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; } diff --git a/image/decoders/icon/nsIconURI.cpp b/image/decoders/icon/nsIconURI.cpp index a5e02c8fd017..d65e6f510c95 100644 --- a/image/decoders/icon/nsIconURI.cpp +++ b/image/decoders/icon/nsIconURI.cpp @@ -552,9 +552,9 @@ void nsMozIconURI::Serialize(URIParams& aParams) { return; } - params.uri() = iconURLParams; + params.uri() = Some(std::move(iconURLParams)); } else { - params.uri() = void_t(); + params.uri() = Nothing(); } params.size() = mSize; @@ -573,8 +573,8 @@ bool nsMozIconURI::Deserialize(const URIParams& aParams) { } const IconURIParams& params = aParams.get_IconURIParams(); - if (params.uri().type() != OptionalURIParams::Tvoid_t) { - nsCOMPtr uri = DeserializeURI(params.uri().get_URIParams()); + if (params.uri().isSome()) { + nsCOMPtr uri = DeserializeURI(params.uri().ref()); mIconURL = do_QueryInterface(uri); if (!mIconURL) { MOZ_ASSERT_UNREACHABLE("bad nsIURI passed"); diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp index bb5a815d4268..e5b68cb46255 100644 --- a/ipc/glue/BackgroundUtils.cpp +++ b/ipc/glue/BackgroundUtils.cpp @@ -424,7 +424,7 @@ nsresult LoadInfoToLoadInfoArgs(nsILoadInfo* aLoadInfo, Some(topLevelStorageAreaPrincipalInfoTemp); } - OptionalURIParams optionalResultPrincipalURI = mozilla::void_t(); + Maybe optionalResultPrincipalURI; nsCOMPtr resultPrincipalURI; Unused << aLoadInfo->GetResultPrincipalURI( getter_AddRefs(resultPrincipalURI)); @@ -573,7 +573,7 @@ nsresult LoadInfoArgsToLoadInfo( } nsCOMPtr resultPrincipalURI; - if (loadInfoArgs.resultPrincipalURI().type() != OptionalURIParams::Tvoid_t) { + if (loadInfoArgs.resultPrincipalURI().isSome()) { resultPrincipalURI = DeserializeURI(loadInfoArgs.resultPrincipalURI()); NS_ENSURE_TRUE(resultPrincipalURI, NS_ERROR_UNEXPECTED); } diff --git a/ipc/glue/URIParams.ipdlh b/ipc/glue/URIParams.ipdlh index 0c68667f080e..fd27459669f4 100644 --- a/ipc/glue/URIParams.ipdlh +++ b/ipc/glue/URIParams.ipdlh @@ -54,7 +54,7 @@ struct JARURIParams struct IconURIParams { - OptionalURIParams uri; + URIParams? uri; uint32_t size; nsCString contentType; nsCString fileName; @@ -86,16 +86,10 @@ union URIParams HostObjectURIParams; }; -union OptionalURIParams -{ - void_t; - URIParams; -}; - struct JSURIParams { SimpleURIParams simpleParams; - OptionalURIParams baseURI; + URIParams? baseURI; }; struct SimpleNestedURIParams diff --git a/ipc/glue/URIUtils.cpp b/ipc/glue/URIUtils.cpp index adc130cdc06d..e5755be0db18 100644 --- a/ipc/glue/URIUtils.cpp +++ b/ipc/glue/URIUtils.cpp @@ -46,15 +46,15 @@ void SerializeURI(nsIURI* aURI, URIParams& aParams) { } } -void SerializeURI(nsIURI* aURI, OptionalURIParams& aParams) { +void SerializeURI(nsIURI* aURI, Maybe& 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(); } } @@ -116,21 +116,13 @@ already_AddRefed DeserializeURI(const URIParams& aParams) { return uri.forget(); } -already_AddRefed DeserializeURI(const OptionalURIParams& aParams) { +already_AddRefed DeserializeURI(const Maybe& aParams) { MOZ_ASSERT(NS_IsMainThread()); nsCOMPtr 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(); diff --git a/ipc/glue/URIUtils.h b/ipc/glue/URIUtils.h index 50daf162f6b0..98619c60df89 100644 --- a/ipc/glue/URIUtils.h +++ b/ipc/glue/URIUtils.h @@ -17,23 +17,23 @@ namespace ipc { void SerializeURI(nsIURI* aURI, URIParams& aParams); -void SerializeURI(nsIURI* aURI, OptionalURIParams& aParams); +void SerializeURI(nsIURI* aURI, Maybe& aParams); already_AddRefed DeserializeURI(const URIParams& aParams); -already_AddRefed DeserializeURI(const OptionalURIParams& aParams); +already_AddRefed DeserializeURI(const Maybe& aParams); template <> struct IPDLParamTraits { static void Write(IPC::Message* aMsg, IProtocol* aActor, nsIURI* aParam) { - OptionalURIParams params; + Maybe params; SerializeURI(aParam, params); WriteIPDLParam(aMsg, aActor, params); } static bool Read(const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, RefPtr* aResult) { - OptionalURIParams params; + Maybe params; if (!ReadIPDLParam(aMsg, aIter, aActor, ¶ms)) { return false; } diff --git a/mobile/android/components/geckoview/GeckoViewHistory.cpp b/mobile/android/components/geckoview/GeckoViewHistory.cpp index 9eff3a6db4a4..ad783faff5d0 100644 --- a/mobile/android/components/geckoview/GeckoViewHistory.cpp +++ b/mobile/android/components/geckoview/GeckoViewHistory.cpp @@ -360,7 +360,7 @@ GeckoViewHistory::VisitURI(nsIWidget* aWidget, nsIURI* aURI, URIParams uri; SerializeURI(aURI, uri); - OptionalURIParams lastVisitedURI; + Maybe lastVisitedURI; SerializeURI(aLastVisitedURI, lastVisitedURI); // If we're in the content process, send the visit to the parent. The parent diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index f963d638c101..74d8b749faf5 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -539,7 +539,7 @@ class PredictorLearnRunnable final : public Runnable { ipc::URIParams serTargetURI; SerializeURI(mTargetURI, serTargetURI); - ipc::OptionalURIParams serSourceURI; + Maybe serSourceURI; SerializeURI(mSourceURI, serSourceURI); PREDICTOR_LOG(("predictor::learn (async) forwarding to parent")); @@ -657,7 +657,7 @@ Predictor::PredictNative(nsIURI *targetURI, nsIURI *sourceURI, PREDICTOR_LOG((" called on child process")); - ipc::OptionalURIParams serTargetURI, serSourceURI; + Maybe serTargetURI, serSourceURI; SerializeURI(targetURI, serTargetURI); SerializeURI(sourceURI, serSourceURI); diff --git a/netwerk/cookie/CookieServiceChild.cpp b/netwerk/cookie/CookieServiceChild.cpp index 8216594af8f6..663dbf9ce058 100644 --- a/netwerk/cookie/CookieServiceChild.cpp +++ b/netwerk/cookie/CookieServiceChild.cpp @@ -549,7 +549,7 @@ nsresult CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI, URIParams hostURIParams; SerializeURI(aHostURI, hostURIParams); - OptionalURIParams channelURIParams; + Maybe channelURIParams; mozilla::OriginAttributes attrs; if (aChannel) { nsCOMPtr channelURI; diff --git a/netwerk/cookie/CookieServiceParent.cpp b/netwerk/cookie/CookieServiceParent.cpp index 717ac4781d6c..da0074690968 100644 --- a/netwerk/cookie/CookieServiceParent.cpp +++ b/netwerk/cookie/CookieServiceParent.cpp @@ -215,7 +215,7 @@ void CookieServiceParent::ActorDestroy(ActorDestroyReason aWhy) { } mozilla::ipc::IPCResult CookieServiceParent::RecvSetCookieString( - const URIParams &aHost, const OptionalURIParams &aChannelURI, + const URIParams &aHost, const Maybe &aChannelURI, const bool &aIsForeign, const bool &aIsTrackingResource, const bool &aFirstPartyStorageAccessGranted, const nsCString &aCookieString, const nsCString &aServerTime, const OriginAttributes &aAttrs, diff --git a/netwerk/cookie/CookieServiceParent.h b/netwerk/cookie/CookieServiceParent.h index cbf2693b8e9e..f2870de1b2df 100644 --- a/netwerk/cookie/CookieServiceParent.h +++ b/netwerk/cookie/CookieServiceParent.h @@ -45,7 +45,7 @@ class CookieServiceParent : public PCookieServiceParent { virtual void ActorDestroy(ActorDestroyReason aWhy) override; mozilla::ipc::IPCResult RecvSetCookieString( - const URIParams &aHost, const OptionalURIParams &aChannelURI, + const URIParams &aHost, const Maybe &aChannelURI, const bool &aIsForeign, const bool &aIsTrackingResource, const bool &aFirstPartyStorageAccessGranted, const nsCString &aCookieString, const nsCString &aServerTime, diff --git a/netwerk/cookie/PCookieService.ipdl b/netwerk/cookie/PCookieService.ipdl index 344bbe08ffb9..be31efb7c362 100644 --- a/netwerk/cookie/PCookieService.ipdl +++ b/netwerk/cookie/PCookieService.ipdl @@ -71,7 +71,7 @@ parent: * @see mozIThirdPartyUtil.isThirdPartyChannel */ nested(inside_cpow) async SetCookieString(URIParams host, - OptionalURIParams channelURI, + URIParams? channelURI, bool isForeign, bool isTrackingResource, bool firstPartyStorageAccessGranted, diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh index 793e9aff21f4..d9c8323791fd 100644 --- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -45,7 +45,7 @@ struct PreferredAlternativeDataTypeParams struct RedirectHistoryEntryInfo { PrincipalInfo principalInfo; - OptionalURIParams referrerUri; + URIParams? referrerUri; nsCString remoteAddress; }; @@ -57,7 +57,7 @@ struct LoadInfoArgs PrincipalInfo? sandboxedLoadingPrincipalInfo; PrincipalInfo? topLevelPrincipalInfo; PrincipalInfo? topLevelStorageAreaPrincipalInfo; - OptionalURIParams resultPrincipalURI; + URIParams? resultPrincipalURI; uint32_t securityFlags; uint32_t contentPolicyType; uint32_t tainting; @@ -209,12 +209,12 @@ struct HttpChannelOpenArgs // - 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; diff --git a/netwerk/ipc/NeckoParent.cpp b/netwerk/ipc/NeckoParent.cpp index a40e70c124b4..1c0b08c17e20 100644 --- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -743,8 +743,8 @@ mozilla::ipc::IPCResult NeckoParent::RecvOnAuthCancelled( /* Predictor Messages */ mozilla::ipc::IPCResult NeckoParent::RecvPredPredict( - const ipc::OptionalURIParams& aTargetURI, - const ipc::OptionalURIParams& aSourceURI, const uint32_t& aReason, + const Maybe& aTargetURI, + const Maybe& aSourceURI, const uint32_t& aReason, const OriginAttributes& aOriginAttributes, const bool& hasVerifier) { nsCOMPtr targetURI = DeserializeURI(aTargetURI); nsCOMPtr sourceURI = DeserializeURI(aSourceURI); @@ -765,7 +765,7 @@ mozilla::ipc::IPCResult NeckoParent::RecvPredPredict( } mozilla::ipc::IPCResult NeckoParent::RecvPredLearn( - const ipc::URIParams& aTargetURI, const ipc::OptionalURIParams& aSourceURI, + const ipc::URIParams& aTargetURI, const Maybe& aSourceURI, const uint32_t& aReason, const OriginAttributes& aOriginAttributes) { nsCOMPtr targetURI = DeserializeURI(aTargetURI); nsCOMPtr sourceURI = DeserializeURI(aSourceURI); diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h index fa956839bb18..6f07a75a4549 100644 --- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -200,14 +200,13 @@ class NeckoParent : public PNeckoParent { /* Predictor Messages */ mozilla::ipc::IPCResult RecvPredPredict( - const ipc::OptionalURIParams& aTargetURI, - const ipc::OptionalURIParams& aSourceURI, + const Maybe& aTargetURI, + const Maybe& 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& aSourceURI, const PredictorPredictReason& aReason, const OriginAttributes& aOriginAttributes); mozilla::ipc::IPCResult RecvPredReset(); diff --git a/netwerk/ipc/PNecko.ipdl b/netwerk/ipc/PNecko.ipdl index ef5c7d31d32e..392b2789ad76 100644 --- a/netwerk/ipc/PNecko.ipdl +++ b/netwerk/ipc/PNecko.ipdl @@ -88,10 +88,10 @@ parent: 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(); diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index 203a05d4ee2c..55d550b2ff97 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -2141,11 +2141,11 @@ NS_IMETHODIMP HttpChannelChild::OnRedirectVerifyCallback(nsresult result) { LOG(("HttpChannelChild::OnRedirectVerifyCallback [this=%p]\n", this)); MOZ_ASSERT(NS_IsMainThread()); - OptionalURIParams redirectURI; + Maybe redirectURI; nsresult rv; uint32_t referrerPolicy = REFERRER_POLICY_UNSET; - OptionalURIParams referrerURI; + Maybe referrerURI; SerializeURI(nullptr, referrerURI); nsCOMPtr newHttpChannel = diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index fb5f2af1c96a..0925d10ddbb7 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -382,11 +382,11 @@ void HttpChannelParent::InvokeAsyncOpen(nsresult 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& aOriginalURI, + const Maybe& aDocURI, + const Maybe& aOriginalReferrerURI, + const uint32_t& aReferrerPolicy, const Maybe& aAPIRedirectToURI, + const Maybe& aTopWindowURI, nsIPrincipal* aTopWindowPrincipal, const uint32_t& aLoadFlags, const RequestHeaderTuples& requestHeaders, const nsCString& requestMethod, const Maybe& uploadStream, const bool& uploadStreamHasHeaders, const int16_t& priority, @@ -827,8 +827,8 @@ 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& aReferrerURI, + const Maybe& aAPIRedirectURI, const OptionalCorsPreflightArgs& aCorsPreflightArgs, const bool& aChooseAppcache) { LOG(("HttpChannelParent::RecvRedirect2Verify [this=%p result=%" PRIx32 "]\n", diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h index 06909b3f55b6..0c6b455aee82 100644 --- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -138,12 +138,12 @@ class HttpChannelParent final : public nsIInterfaceRequestor, 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& originalUri, + const Maybe& docUri, + const Maybe& originalReferrerUri, const uint32_t& referrerPolicy, - const OptionalURIParams& internalRedirectUri, - const OptionalURIParams& topWindowUri, nsIPrincipal* aTopWindowPrincipal, + const Maybe& internalRedirectUri, + const Maybe& topWindowUri, nsIPrincipal* aTopWindowPrincipal, const uint32_t& loadFlags, const RequestHeaderTuples& requestHeaders, const nsCString& requestMethod, const Maybe& uploadStream, const bool& uploadStreamHasHeaders, const int16_t& priority, @@ -189,8 +189,8 @@ class HttpChannelParent final : public nsIInterfaceRequestor, 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& aReferrerURI, + const Maybe& apiRedirectUri, const OptionalCorsPreflightArgs& aCorsPreflightArgs, const bool& aChooseAppcache) override; virtual mozilla::ipc::IPCResult RecvDocumentChannelCleanup( diff --git a/netwerk/protocol/http/PHttpChannel.ipdl b/netwerk/protocol/http/PHttpChannel.ipdl index 0e1ada9ca120..938f0a8576e3 100644 --- a/netwerk/protocol/http/PHttpChannel.ipdl +++ b/netwerk/protocol/http/PHttpChannel.ipdl @@ -45,8 +45,7 @@ parent: 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); diff --git a/netwerk/protocol/websocket/PWebSocket.ipdl b/netwerk/protocol/websocket/PWebSocket.ipdl index a2993c6bb471..0e1cce98a956 100644 --- a/netwerk/protocol/websocket/PWebSocket.ipdl +++ b/netwerk/protocol/websocket/PWebSocket.ipdl @@ -34,7 +34,7 @@ async protocol PWebSocket parent: // Forwarded methods corresponding to methods on nsIWebSocketChannel - async AsyncOpen(OptionalURIParams aURI, + async AsyncOpen(URIParams? aURI, nsCString aOrigin, uint64_t aInnerWindowID, nsCString aProtocol, diff --git a/netwerk/protocol/websocket/WebSocketChannelChild.cpp b/netwerk/protocol/websocket/WebSocketChannelChild.cpp index 1498e8af3e01..42b86459318b 100644 --- a/netwerk/protocol/websocket/WebSocketChannelChild.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelChild.cpp @@ -444,21 +444,18 @@ WebSocketChannelChild::AsyncOpen(nsIURI* aURI, const nsACString& aOrigin, // Corresponding release in DeallocPWebSocket AddIPDLReference(); - OptionalURIParams uri; + Maybe uri; Maybe 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); diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.cpp b/netwerk/protocol/websocket/WebSocketChannelParent.cpp index 532a9c9cc2b4..d697a3839b56 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.cpp +++ b/netwerk/protocol/websocket/WebSocketChannelParent.cpp @@ -48,7 +48,7 @@ mozilla::ipc::IPCResult WebSocketChannelParent::RecvDeleteSelf() { } mozilla::ipc::IPCResult WebSocketChannelParent::RecvAsyncOpen( - const OptionalURIParams& aURI, const nsCString& aOrigin, + const Maybe& 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, diff --git a/netwerk/protocol/websocket/WebSocketChannelParent.h b/netwerk/protocol/websocket/WebSocketChannelParent.h index ce8af4b2c833..efd4d717abc5 100644 --- a/netwerk/protocol/websocket/WebSocketChannelParent.h +++ b/netwerk/protocol/websocket/WebSocketChannelParent.h @@ -39,7 +39,7 @@ class WebSocketChannelParent : public PWebSocketParent, private: mozilla::ipc::IPCResult RecvAsyncOpen( - const OptionalURIParams& aURI, const nsCString& aOrigin, + const Maybe& 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, diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index 0927499b5570..6d8e33f8b1e4 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -2008,7 +2008,7 @@ History::VisitURI(nsIWidget* aWidget, nsIURI* aURI, nsIURI* aLastVisitedURI, URIParams uri; SerializeURI(aURI, uri); - OptionalURIParams lastVisitedURI; + Maybe lastVisitedURI; SerializeURI(aLastVisitedURI, lastVisitedURI); NS_ENSURE_ARG(aWidget); diff --git a/uriloader/exthandler/ExternalHelperAppParent.cpp b/uriloader/exthandler/ExternalHelperAppParent.cpp index 046cff58b943..455090109785 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.cpp +++ b/uriloader/exthandler/ExternalHelperAppParent.cpp @@ -33,9 +33,8 @@ NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsHashPropertyBag, nsIStreamListener, nsIExternalHelperAppParent) ExternalHelperAppParent::ExternalHelperAppParent( - const OptionalURIParams& uri, - const int64_t& aContentLength, const bool& aWasFileChannel, - const nsCString& aContentDispositionHeader, + const Maybe& uri, const int64_t& aContentLength, + const bool& aWasFileChannel, const nsCString& aContentDispositionHeader, const uint32_t& aContentDispositionHint, const nsString& aContentDispositionFilename) : mURI(DeserializeURI(uri)), @@ -88,7 +87,7 @@ void UpdateContentContext(nsIStreamListener* aListener, void ExternalHelperAppParent::Init( const Maybe& aLoadInfoArgs, const nsCString& aMimeContentType, const bool& aForceSave, - const OptionalURIParams& aReferrer, PBrowserParent* aBrowser) { + const Maybe& aReferrer, PBrowserParent* aBrowser) { mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs, getter_AddRefs(mLoadInfo)); diff --git a/uriloader/exthandler/ExternalHelperAppParent.h b/uriloader/exthandler/ExternalHelperAppParent.h index baf729761533..66b15ea5bfed 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.h +++ b/uriloader/exthandler/ExternalHelperAppParent.h @@ -20,7 +20,7 @@ class URI; namespace mozilla { namespace ipc { -class OptionalURIParams; +class URIParams; } // namespace ipc namespace net { @@ -61,7 +61,6 @@ class ExternalHelperAppParent public nsIStreamListener, public net::PrivateBrowsingChannel, public nsIExternalHelperAppParent { - typedef mozilla::ipc::OptionalURIParams OptionalURIParams; public: NS_DECL_ISUPPORTS_INHERITED @@ -84,15 +83,16 @@ class ExternalHelperAppParent 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& uri, + const int64_t& contentLength, + const bool& wasFileChannel, + const nsCString& aContentDispositionHeader, + const uint32_t& aContentDispositionHint, + const nsString& aContentDispositionFilename); void Init(const Maybe& aLoadInfoArgs, const nsCString& aMimeContentType, const bool& aForceSave, - const OptionalURIParams& aReferrer, PBrowserParent* aBrowser); + const Maybe& aReferrer, + PBrowserParent* aBrowser); protected: virtual ~ExternalHelperAppParent(); diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 1b221ba87c7f..6ee76a9d3e33 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -634,7 +634,7 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper( nsCOMPtr referrer; NS_GetReferrerFromChannel(channel, getter_AddRefs(referrer)); - OptionalURIParams uriParams, referrerParams; + Maybe uriParams, referrerParams; SerializeURI(uri, uriParams); SerializeURI(referrer, referrerParams);