diff --git a/caps/DomainPolicy.cpp b/caps/DomainPolicy.cpp index 48dc4f8ca268..c4c9118dbe04 100644 --- a/caps/DomainPolicy.cpp +++ b/caps/DomainPolicy.cpp @@ -29,11 +29,8 @@ static nsresult BroadcastDomainSetChange(DomainSetType aSetType, return NS_OK; } - Maybe uri; - SerializeURI(aDomain, uri); - for (uint32_t i = 0; i < parents.Length(); i++) { - Unused << parents[i]->SendDomainSetChanged(aSetType, aChangeType, uri); + Unused << parents[i]->SendDomainSetChanged(aSetType, aChangeType, aDomain); } return NS_OK; } @@ -118,10 +115,13 @@ void DomainPolicy::CloneDomainPolicy(DomainPolicyClone* aClone) { mSuperAllowlist->CloneSet(&aClone->superAllowlist()); } -static void CopyURIs(const nsTArray& aDomains, nsIDomainSet* aSet) { +static void CopyURIs(const nsTArray>& aDomains, + nsIDomainSet* aSet) { for (uint32_t i = 0; i < aDomains.Length(); i++) { - nsCOMPtr uri = DeserializeURI(aDomains[i]); - aSet->Add(uri); + if (NS_WARN_IF(!aDomains[i])) { + continue; + } + aSet->Add(aDomains[i]); } } @@ -149,8 +149,9 @@ DomainSet::Add(nsIURI* aDomain) { nsCOMPtr clone = GetCanonicalClone(aDomain); NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE); mHashTable.PutEntry(clone); - if (XRE_IsParentProcess()) + if (XRE_IsParentProcess()) { return BroadcastDomainSetChange(mType, ADD_DOMAIN, aDomain); + } return NS_OK; } @@ -160,8 +161,9 @@ DomainSet::Remove(nsIURI* aDomain) { nsCOMPtr clone = GetCanonicalClone(aDomain); NS_ENSURE_TRUE(clone, NS_ERROR_FAILURE); mHashTable.RemoveEntry(clone); - if (XRE_IsParentProcess()) + if (XRE_IsParentProcess()) { return BroadcastDomainSetChange(mType, REMOVE_DOMAIN, aDomain); + } return NS_OK; } @@ -169,8 +171,9 @@ DomainSet::Remove(nsIURI* aDomain) { NS_IMETHODIMP DomainSet::Clear() { mHashTable.Clear(); - if (XRE_IsParentProcess()) + if (XRE_IsParentProcess()) { return BroadcastDomainSetChange(mType, CLEAR_DOMAINS); + } return NS_OK; } @@ -212,14 +215,10 @@ DomainSet::ContainsSuperDomain(nsIURI* aDomain, bool* aContains) { return NS_OK; } -void DomainSet::CloneSet(nsTArray* aDomains) { +void DomainSet::CloneSet(nsTArray>* aDomains) { for (auto iter = mHashTable.Iter(); !iter.Done(); iter.Next()) { nsIURI* key = iter.Get()->GetKey(); - - URIParams uri; - SerializeURI(key, uri); - - aDomains->AppendElement(uri); + aDomains->AppendElement(key); } } diff --git a/caps/DomainPolicy.h b/caps/DomainPolicy.h index cad67df47bcf..105b7fc1a07d 100644 --- a/caps/DomainPolicy.h +++ b/caps/DomainPolicy.h @@ -13,10 +13,6 @@ namespace mozilla { -namespace ipc { -class URIParams; -} // namespace ipc - enum DomainSetChangeType { ACTIVATE_POLICY, DEACTIVATE_POLICY, @@ -40,7 +36,7 @@ class DomainSet final : public nsIDomainSet { explicit DomainSet(DomainSetType aType) : mType(aType) {} - void CloneSet(nsTArray* aDomains); + void CloneSet(nsTArray>* aDomains); protected: virtual ~DomainSet() {} diff --git a/docshell/base/nsDefaultURIFixup.cpp b/docshell/base/nsDefaultURIFixup.cpp index 3ca219a6e331..6009db858a29 100644 --- a/docshell/base/nsDefaultURIFixup.cpp +++ b/docshell/base/nsDefaultURIFixup.cpp @@ -389,7 +389,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, } RefPtr postData; - Maybe uri; + RefPtr uri; nsAutoString providerName; if (!contentChild->SendKeywordToURI(keyword, aIsPrivateContext, &providerName, &postData, &uri)) { @@ -403,8 +403,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword, postData.forget(aPostData); } - nsCOMPtr temp = DeserializeURI(uri); - info->mPreferredURI = std::move(temp); + info->mPreferredURI = uri.forget(); return NS_OK; } diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 504b82f2085c..054bf815938a 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3682,11 +3682,9 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI, } else { mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); - mozilla::ipc::URIParams uri; - SerializeURI(aURI, uri); - cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HSTS, uri, flags, + cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HSTS, aURI, flags, mOriginAttributes, &isStsHost); - cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HPKP, uri, flags, + cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HPKP, aURI, flags, mOriginAttributes, &isPinnedHost); } @@ -8131,10 +8129,7 @@ void nsDocShell::CopyFavicon(nsIURI* aOldURI, nsIURI* aNewURI, if (XRE_IsContentProcess()) { dom::ContentChild* contentChild = dom::ContentChild::GetSingleton(); if (contentChild) { - mozilla::ipc::URIParams oldURI, newURI; - SerializeURI(aOldURI, oldURI); - SerializeURI(aNewURI, newURI); - contentChild->SendCopyFavicon(oldURI, newURI, + contentChild->SendCopyFavicon(aOldURI, aNewURI, IPC::Principal(aLoadingPrincipal), aInPrivateBrowsing); } diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 0c4c247f0dc7..1935388d4313 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -1809,11 +1809,9 @@ void Document::GetFailedCertSecurityInfo(FailedCertSecurityInfo& aInfo, if (XRE_IsContentProcess()) { ContentChild* cc = ContentChild::GetSingleton(); MOZ_ASSERT(cc); - mozilla::ipc::URIParams uri; - SerializeURI(aURI, uri); - cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HSTS, uri, flags, attrs, + cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HSTS, aURI, flags, attrs, &aInfo.mHasHSTS); - cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HPKP, uri, flags, attrs, + cc->SendIsSecureURI(nsISiteSecurityService::HEADER_HPKP, aURI, flags, attrs, &aInfo.mHasHPKP); } else { nsCOMPtr sss = diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 898814ed5103..0ad93052c7df 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -934,9 +934,6 @@ nsresult ContentChild::ProvideWindowCommon( return rv; } - Maybe uriToLoad; - SerializeURI(aURI, uriToLoad); - if (name.LowerCaseEqualsLiteral("_blank")) { name = EmptyString(); } @@ -944,7 +941,7 @@ nsresult ContentChild::ProvideWindowCommon( MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(name)); Unused << SendCreateWindowInDifferentProcess( - aTabOpener, aChromeFlags, aCalledFromJS, aWidthSpecified, uriToLoad, + aTabOpener, aChromeFlags, aCalledFromJS, aWidthSpecified, aURI, features, fullZoom, name, triggeringPrincipal, csp, referrerInfo); // We return NS_ERROR_ABORT, so that the caller knows that we've abandoned @@ -1192,13 +1189,7 @@ nsresult ContentChild::ProvideWindowCommon( return rv; } - Maybe uriToLoad; - if (aURI) { - SerializeURI(aURI, uriToLoad); - } - - SendCreateWindow(aTabOpener, newChild, aChromeFlags, aCalledFromJS, - aWidthSpecified, uriToLoad, features, fullZoom, + SendCreateWindow(aTabOpener, newChild, aChromeFlags, aCalledFromJS, aWidthSpecified, aURI, features, fullZoom, Principal(triggeringPrincipal), csp, referrerInfo, std::move(resolve), std::move(reject)); } @@ -1401,7 +1392,7 @@ void ContentChild::InitXPCOM( } // The stylesheet cache is not ready yet. Store this URL for future use. - nsCOMPtr ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL()); + nsCOMPtr ucsURL = aXPCOMInit.userContentSheetURL(); GlobalStyleSheetCache::SetUserContentCSSURL(ucsURL); GfxInfoBase::SetFeatureStatus(aXPCOMInit.gfxFeatureStatus()); @@ -2365,7 +2356,7 @@ mozilla::ipc::IPCResult ContentChild::RecvNotifyVisited( return IPC_OK(); } for (const VisitedQueryResult& result : aURIs) { - nsCOMPtr newURI = DeserializeURI(result.uri()); + nsCOMPtr newURI = result.uri(); if (!newURI) { return IPC_FAIL_NO_REASON(this); } @@ -2747,38 +2738,35 @@ mozilla::ipc::IPCResult ContentChild::RecvNotifyIdleObserver( } mozilla::ipc::IPCResult ContentChild::RecvLoadAndRegisterSheet( - const URIParams& aURI, const uint32_t& aType) { - nsCOMPtr uri = DeserializeURI(aURI); - if (!uri) { + nsIURI* aURI, const uint32_t& aType) { + if (!aURI) { return IPC_OK(); } nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { - sheetService->LoadAndRegisterSheet(uri, aType); + sheetService->LoadAndRegisterSheet(aURI, aType); } return IPC_OK(); } mozilla::ipc::IPCResult ContentChild::RecvUnregisterSheet( - const URIParams& aURI, const uint32_t& aType) { - nsCOMPtr uri = DeserializeURI(aURI); - if (!uri) { + nsIURI* aURI, const uint32_t& aType) { + if (!aURI) { return IPC_OK(); } nsStyleSheetService* sheetService = nsStyleSheetService::GetInstance(); if (sheetService) { - sheetService->UnregisterSheet(uri, aType); + sheetService->UnregisterSheet(aURI, aType); } return IPC_OK(); } mozilla::ipc::IPCResult ContentChild::RecvDomainSetChanged( - const uint32_t& aSetType, const uint32_t& aChangeType, - const Maybe& aDomain) { + const uint32_t& aSetType, const uint32_t& aChangeType, nsIURI* aDomain) { if (aChangeType == ACTIVATE_POLICY) { if (mPolicy) { return IPC_OK(); @@ -2827,16 +2815,14 @@ mozilla::ipc::IPCResult ContentChild::RecvDomainSetChanged( MOZ_ASSERT(set); - nsCOMPtr uri = DeserializeURI(aDomain); - switch (aChangeType) { case ADD_DOMAIN: - NS_ENSURE_TRUE(uri, IPC_FAIL_NO_REASON(this)); - set->Add(uri); + NS_ENSURE_TRUE(aDomain, IPC_FAIL_NO_REASON(this)); + set->Add(aDomain); break; case REMOVE_DOMAIN: - NS_ENSURE_TRUE(uri, IPC_FAIL_NO_REASON(this)); - set->Remove(uri); + NS_ENSURE_TRUE(aDomain, IPC_FAIL_NO_REASON(this)); + set->Remove(aDomain); break; case CLEAR_DOMAINS: set->Clear(); @@ -3263,7 +3249,7 @@ bool ContentChild::DeallocPURLClassifierChild(PURLClassifierChild* aActor) { } PURLClassifierLocalChild* ContentChild::AllocPURLClassifierLocalChild( - const URIParams& aUri, const nsTArray& aFeatures) { + nsIURI* aUri, const nsTArray& aFeatures) { return new URLClassifierLocalChild(); } @@ -3274,8 +3260,7 @@ bool ContentChild::DeallocPURLClassifierLocalChild( return true; } -PLoginReputationChild* ContentChild::AllocPLoginReputationChild( - const URIParams& aUri) { +PLoginReputationChild* ContentChild::AllocPLoginReputationChild(nsIURI* aUri) { return new PLoginReputationChild(); } diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 0eb0a75e5e04..2d37125161c6 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -60,10 +60,6 @@ using mozilla::loader::PScriptCacheChild; bool IsDevelopmentBuild(); #endif /* !XP_WIN */ -namespace ipc { -class URIParams; -} // namespace ipc - namespace dom { namespace ipc { @@ -88,7 +84,6 @@ class ContentChild final typedef mozilla::dom::ClonedMessageData ClonedMessageData; typedef mozilla::ipc::FileDescriptor FileDescriptor; typedef mozilla::ipc::PFileDescriptorSetChild PFileDescriptorSetChild; - typedef mozilla::ipc::URIParams URIParams; friend class PContentChild; @@ -421,10 +416,10 @@ class ContentChild final mozilla::ipc::IPCResult RecvMinimizeMemoryUsage(); - mozilla::ipc::IPCResult RecvLoadAndRegisterSheet(const URIParams& aURI, + mozilla::ipc::IPCResult RecvLoadAndRegisterSheet(nsIURI* aURI, const uint32_t& aType); - mozilla::ipc::IPCResult RecvUnregisterSheet(const URIParams& aURI, + mozilla::ipc::IPCResult RecvUnregisterSheet(nsIURI* aURI, const uint32_t& aType); void AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS); @@ -439,7 +434,7 @@ class ContentChild final mozilla::ipc::IPCResult RecvDomainSetChanged(const uint32_t& aSetType, const uint32_t& aChangeType, - const Maybe& aDomain); + nsIURI* aDomain); mozilla::ipc::IPCResult RecvShutdown(); @@ -601,11 +596,10 @@ class ContentChild final // PURLClassifierLocalChild PURLClassifierLocalChild* AllocPURLClassifierLocalChild( - const URIParams& aUri, - const nsTArray& aFeatures); + nsIURI* aUri, const nsTArray& aFeatures); bool DeallocPURLClassifierLocalChild(PURLClassifierLocalChild* aActor); - PLoginReputationChild* AllocPLoginReputationChild(const URIParams& aUri); + PLoginReputationChild* AllocPLoginReputationChild(nsIURI* aUri); bool DeallocPLoginReputationChild(PLoginReputationChild* aActor); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 306a575bbece..f93d3a83fe31 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -2398,9 +2398,9 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) { // send the file URL instead. auto* sheetCache = GlobalStyleSheetCache::Singleton(); if (StyleSheet* ucs = sheetCache->GetUserContentSheet()) { - SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL()); + xpcomInit.userContentSheetURL() = ucs->GetSheetURI(); } else { - SerializeURI(nullptr, xpcomInit.userContentSheetURL()); + xpcomInit.userContentSheetURL() = nullptr; } // 1. Build ContentDeviceData first, as it may affect some gfxVars. @@ -2528,22 +2528,17 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) { // shouldn't matter which we look at. for (StyleSheet* sheet : *sheetService->AgentStyleSheets()) { - URIParams uri; - SerializeURI(sheet->GetSheetURI(), uri); - Unused << SendLoadAndRegisterSheet(uri, + Unused << SendLoadAndRegisterSheet(sheet->GetSheetURI(), nsIStyleSheetService::AGENT_SHEET); } for (StyleSheet* sheet : *sheetService->UserStyleSheets()) { - URIParams uri; - SerializeURI(sheet->GetSheetURI(), uri); - Unused << SendLoadAndRegisterSheet(uri, nsIStyleSheetService::USER_SHEET); + Unused << SendLoadAndRegisterSheet(sheet->GetSheetURI(), + nsIStyleSheetService::USER_SHEET); } for (StyleSheet* sheet : *sheetService->AuthorStyleSheets()) { - URIParams uri; - SerializeURI(sheet->GetSheetURI(), uri); - Unused << SendLoadAndRegisterSheet(uri, + Unused << SendLoadAndRegisterSheet(sheet->GetSheetURI(), nsIStyleSheetService::AUTHOR_SHEET); } } @@ -2832,14 +2827,13 @@ mozilla::ipc::IPCResult ContentParent::RecvGetExternalClipboardFormats( return IPC_OK(); } -mozilla::ipc::IPCResult ContentParent::RecvPlaySound(const URIParams& aURI) { - nsCOMPtr soundURI = DeserializeURI(aURI); +mozilla::ipc::IPCResult ContentParent::RecvPlaySound(nsIURI* aURI) { // If the check here fails, it can only mean that this message was spoofed. - if (!soundURI || !soundURI->SchemeIs("chrome")) { + if (!aURI || !aURI->SchemeIs("chrome")) { // PlaySound only accepts a valid chrome URI. return IPC_FAIL_NO_REASON(this); } - nsCOMPtr soundURL(do_QueryInterface(soundURI)); + nsCOMPtr soundURL(do_QueryInterface(aURI)); if (!soundURL) { return IPC_OK(); } @@ -3642,14 +3636,12 @@ bool ContentParent::DeallocPParentToChildStreamParent( already_AddRefed ContentParent::AllocPExternalHelperAppParent( - const Maybe& uri, - const Maybe& aLoadInfoArgs, + nsIURI* 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 Maybe& aReferrer, - const MaybeDiscarded& aContext, + nsIURI* aReferrer, const MaybeDiscarded& aContext, const bool& aShouldCloseWindow) { RefPtr parent = new ExternalHelperAppParent( uri, aContentLength, aWasFileChannel, aContentDisposition, @@ -3658,14 +3650,13 @@ ContentParent::AllocPExternalHelperAppParent( } mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor( - PExternalHelperAppParent* actor, const Maybe& uri, + PExternalHelperAppParent* actor, nsIURI* 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 Maybe& aReferrer, - const MaybeDiscarded& aContext, + nsIURI* aReferrer, const MaybeDiscarded& aContext, const bool& aShouldCloseWindow) { BrowsingContext* context = aContext.IsDiscarded() ? nullptr : aContext.get(); static_cast(actor)->Init( @@ -3738,46 +3729,43 @@ mozilla::ipc::IPCResult ContentParent::RecvPSpeechSynthesisConstructor( #endif mozilla::ipc::IPCResult ContentParent::RecvStartVisitedQueries( - const nsTArray& aUris) { + const nsTArray>& aUris) { nsCOMPtr history = services::GetHistoryService(); if (!history) { return IPC_OK(); } for (const auto& params : aUris) { - nsCOMPtr uri = DeserializeURI(params); - if (NS_WARN_IF(!uri)) { + if (NS_WARN_IF(!params)) { continue; } - history->RegisterVisitedCallback(uri, nullptr); + history->RegisterVisitedCallback(params, nullptr); } return IPC_OK(); } -mozilla::ipc::IPCResult ContentParent::RecvSetURITitle(const URIParams& uri, +mozilla::ipc::IPCResult ContentParent::RecvSetURITitle(nsIURI* uri, const nsString& title) { - nsCOMPtr ourURI = DeserializeURI(uri); - if (!ourURI) { + if (!uri) { return IPC_FAIL_NO_REASON(this); } nsCOMPtr history = services::GetHistoryService(); if (history) { - history->SetURITitle(ourURI, title); + history->SetURITitle(uri, title); } return IPC_OK(); } mozilla::ipc::IPCResult ContentParent::RecvIsSecureURI( - const uint32_t& aType, const URIParams& aURI, const uint32_t& aFlags, + const uint32_t& aType, nsIURI* aURI, const uint32_t& aFlags, const OriginAttributes& aOriginAttributes, bool* aIsSecureURI) { nsCOMPtr sss(do_GetService(NS_SSSERVICE_CONTRACTID)); if (!sss) { return IPC_FAIL_NO_REASON(this); } - nsCOMPtr ourURI = DeserializeURI(aURI); - if (!ourURI) { + if (!aURI) { return IPC_FAIL_NO_REASON(this); } - nsresult rv = sss->IsSecureURI(aType, ourURI, aFlags, aOriginAttributes, + nsresult rv = sss->IsSecureURI(aType, aURI, aFlags, aOriginAttributes, nullptr, nullptr, aIsSecureURI); if (NS_FAILED(rv)) { return IPC_FAIL_NO_REASON(this); @@ -3786,32 +3774,31 @@ mozilla::ipc::IPCResult ContentParent::RecvIsSecureURI( } mozilla::ipc::IPCResult ContentParent::RecvAccumulateMixedContentHSTS( - const URIParams& aURI, const bool& aActive, + nsIURI* aURI, const bool& aActive, const OriginAttributes& aOriginAttributes) { - nsCOMPtr ourURI = DeserializeURI(aURI); - if (!ourURI) { + if (!aURI) { return IPC_FAIL_NO_REASON(this); } - nsMixedContentBlocker::AccumulateMixedContentHSTS(ourURI, aActive, + nsMixedContentBlocker::AccumulateMixedContentHSTS(aURI, aActive, aOriginAttributes); return IPC_OK(); } mozilla::ipc::IPCResult ContentParent::RecvLoadURIExternal( - const URIParams& uri, PBrowserParent* windowContext) { + nsIURI* uri, PBrowserParent* windowContext) { nsCOMPtr extProtService( do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID)); if (!extProtService) { return IPC_OK(); } - nsCOMPtr ourURI = DeserializeURI(uri); - if (!ourURI) { + + if (!uri) { return IPC_FAIL_NO_REASON(this); } RefPtr context = new RemoteWindowContext(static_cast(windowContext)); - extProtService->LoadURI(ourURI, context); + extProtService->LoadURI(uri, context); return IPC_OK(); } @@ -4193,10 +4180,9 @@ nsresult ContentParent::DoSendAsyncMessage(JSContext* aCx, mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI( const nsCString& aKeyword, const bool& aIsPrivateContext, nsString* aProviderName, RefPtr* aPostData, - Maybe* aURI) { + RefPtr* aURI) { *aPostData = nullptr; - *aURI = Nothing(); - + *aURI = nullptr; nsCOMPtr fixup = components::URIFixup::Service(); if (!fixup) { return IPC_OK(); @@ -4210,10 +4196,9 @@ mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI( return IPC_OK(); } info->GetKeywordProviderName(*aProviderName); - nsCOMPtr uri; info->GetPreferredURI(getter_AddRefs(uri)); - SerializeURI(uri, *aURI); + *aURI = uri; return IPC_OK(); } @@ -4238,18 +4223,16 @@ mozilla::ipc::IPCResult ContentParent::RecvNotifyKeywordSearchLoading( } mozilla::ipc::IPCResult ContentParent::RecvCopyFavicon( - const URIParams& aOldURI, const URIParams& aNewURI, - const IPC::Principal& aLoadingPrincipal, const bool& aInPrivateBrowsing) { - nsCOMPtr oldURI = DeserializeURI(aOldURI); - if (!oldURI) { - return IPC_OK(); + nsIURI* aOldURI, nsIURI* aNewURI, const IPC::Principal& aLoadingPrincipal, + const bool& aInPrivateBrowsing) { + if (!aOldURI) { + return IPC_FAIL(this, "aOldURI should not be null"); } - nsCOMPtr newURI = DeserializeURI(aNewURI); - if (!newURI) { - return IPC_OK(); + if (!aNewURI) { + return IPC_FAIL(this, "aNewURI should not be null"); } - nsDocShell::CopyFavicon(oldURI, newURI, aLoadingPrincipal, + nsDocShell::CopyFavicon(aOldURI, aNewURI, aLoadingPrincipal, aInPrivateBrowsing); return IPC_OK(); } @@ -4465,7 +4448,7 @@ void ContentParent::NotifyRebuildFontList() { already_AddRefed ContentParent::AllocPOfflineCacheUpdateParent( - const URIParams& aManifestURI, const URIParams& aDocumentURI, + nsIURI* aManifestURI, nsIURI* aDocumentURI, const PrincipalInfo& aLoadingPrincipalInfo, const bool& aStickDocument, const CookieJarSettingsArgs& aCookieJarSettingsArgs) { RefPtr update = @@ -4474,8 +4457,8 @@ ContentParent::AllocPOfflineCacheUpdateParent( } mozilla::ipc::IPCResult ContentParent::RecvPOfflineCacheUpdateConstructor( - POfflineCacheUpdateParent* aActor, const URIParams& aManifestURI, - const URIParams& aDocumentURI, const PrincipalInfo& aLoadingPrincipal, + POfflineCacheUpdateParent* aActor, nsIURI* aManifestURI, + nsIURI* aDocumentURI, const PrincipalInfo& aLoadingPrincipal, const bool& aStickDocument, const CookieJarSettingsArgs& aCookieJarSettingsArgs) { MOZ_ASSERT(aActor); @@ -4842,10 +4825,10 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow( mozilla::ipc::IPCResult ContentParent::RecvCreateWindow( PBrowserParent* aThisTab, PBrowserParent* aNewTab, const uint32_t& aChromeFlags, const bool& aCalledFromJS, - const bool& aWidthSpecified, const Maybe& aURIToLoad, - const nsCString& aFeatures, const float& aFullZoom, - const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, - nsIReferrerInfo* aReferrerInfo, CreateWindowResolver&& aResolve) { + const bool& aWidthSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures, + const float& aFullZoom, const IPC::Principal& aTriggeringPrincipal, + nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo, + CreateWindowResolver&& aResolve) { nsresult rv = NS_OK; CreatedWindowInfo cwi; @@ -4878,13 +4861,11 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow( const uint64_t nextRemoteTabId = ++sNextRemoteTabId; sNextBrowserParents.Put(nextRemoteTabId, newTab); - const nsCOMPtr uriToLoad = DeserializeURI(aURIToLoad); - nsCOMPtr newRemoteTab; int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW; mozilla::ipc::IPCResult ipcResult = CommonCreateWindow( aThisTab, /* aSetOpener = */ true, aChromeFlags, aCalledFromJS, - aWidthSpecified, uriToLoad, aFeatures, aFullZoom, nextRemoteTabId, + aWidthSpecified, aURIToLoad, aFeatures, aFullZoom, nextRemoteTabId, VoidString(), rv, newRemoteTab, &cwi.windowOpened(), openLocation, aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ false, aCsp); @@ -4918,21 +4899,19 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindow( mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess( PBrowserParent* aThisTab, const uint32_t& aChromeFlags, - const bool& aCalledFromJS, const bool& aWidthSpecified, - const Maybe& aURIToLoad, const nsCString& aFeatures, - const float& aFullZoom, const nsString& aName, + const bool& aCalledFromJS, const bool& aWidthSpecified, nsIURI* aURIToLoad, + const nsCString& aFeatures, const float& aFullZoom, const nsString& aName, nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo) { MOZ_DIAGNOSTIC_ASSERT(!nsContentUtils::IsSpecialName(aName)); nsCOMPtr newRemoteTab; bool windowIsNew; - nsCOMPtr uriToLoad = DeserializeURI(aURIToLoad); int32_t openLocation = nsIBrowserDOMWindow::OPEN_NEWWINDOW; // If we have enough data, check the schemes of the loader and loadee // to make sure they make sense. - if (uriToLoad && uriToLoad->SchemeIs("file") && + if (aURIToLoad && aURIToLoad->SchemeIs("file") && !GetRemoteType().EqualsLiteral(FILE_REMOTE_TYPE) && Preferences::GetBool("browser.tabs.remote.enforceRemoteTypeRestrictions", false)) { @@ -4940,7 +4919,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess( # ifdef DEBUG nsAutoCString uriToLoadStr; nsAutoCString triggeringUriStr; - uriToLoad->GetAsciiSpec(uriToLoadStr); + aURIToLoad->GetAsciiSpec(uriToLoadStr); aTriggeringPrincipal->GetAsciiSpec(triggeringUriStr); NS_WARNING(nsPrintfCString( @@ -4958,7 +4937,7 @@ mozilla::ipc::IPCResult ContentParent::RecvCreateWindowInDifferentProcess( nsresult rv; mozilla::ipc::IPCResult ipcResult = CommonCreateWindow( aThisTab, /* aSetOpener = */ false, aChromeFlags, aCalledFromJS, - aWidthSpecified, uriToLoad, aFeatures, aFullZoom, + aWidthSpecified, aURIToLoad, aFeatures, aFullZoom, /* aNextRemoteTabId = */ 0, aName, rv, newRemoteTab, &windowIsNew, openLocation, aTriggeringPrincipal, aReferrerInfo, /* aLoadUri = */ true, aCsp); @@ -5033,14 +5012,13 @@ mozilla::ipc::IPCResult ContentParent::RecvSetupFamilyCharMap( } mozilla::ipc::IPCResult ContentParent::RecvGetHyphDict( - const mozilla::ipc::URIParams& aURI, - mozilla::ipc::SharedMemoryBasic::Handle* aOutHandle, uint32_t* aOutSize) { - nsCOMPtr uri = DeserializeURI(aURI); - if (!uri) { + nsIURI* aURI, mozilla::ipc::SharedMemoryBasic::Handle* aOutHandle, + uint32_t* aOutSize) { + if (!aURI) { return IPC_FAIL_NO_REASON(this); } nsHyphenationManager::Instance()->ShareHyphDictToProcess( - uri, Pid(), aOutHandle, aOutSize); + aURI, Pid(), aOutHandle, aOutSize); return IPC_OK(); } @@ -5587,7 +5565,7 @@ bool ContentParent::DeallocPURLClassifierParent(PURLClassifierParent* aActor) { // PURLClassifierLocalParent PURLClassifierLocalParent* ContentParent::AllocPURLClassifierLocalParent( - const URIParams& aURI, const nsTArray& aFeatures) { + nsIURI* aURI, const nsTArray& aFeatures) { MOZ_ASSERT(NS_IsMainThread()); RefPtr actor = new URLClassifierLocalParent(); @@ -5595,21 +5573,20 @@ PURLClassifierLocalParent* ContentParent::AllocPURLClassifierLocalParent( } mozilla::ipc::IPCResult ContentParent::RecvPURLClassifierLocalConstructor( - PURLClassifierLocalParent* aActor, const URIParams& aURI, + PURLClassifierLocalParent* aActor, nsIURI* aURI, nsTArray&& aFeatures) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aActor); nsTArray features = std::move(aFeatures); - nsCOMPtr uri = DeserializeURI(aURI); - if (!uri) { - NS_WARNING("Failed to DeserializeURI"); + if (!aURI) { + NS_WARNING("aURI should not be null"); return IPC_FAIL_NO_REASON(this); } auto* actor = static_cast(aActor); - return actor->StartClassify(uri, features); + return actor->StartClassify(aURI, features); } bool ContentParent::DeallocPURLClassifierLocalParent( @@ -5623,7 +5600,7 @@ bool ContentParent::DeallocPURLClassifierLocalParent( } PLoginReputationParent* ContentParent::AllocPLoginReputationParent( - const URIParams& aURI) { + nsIURI* aURI) { MOZ_ASSERT(NS_IsMainThread()); RefPtr actor = new LoginReputationParent(); @@ -5631,17 +5608,16 @@ PLoginReputationParent* ContentParent::AllocPLoginReputationParent( } mozilla::ipc::IPCResult ContentParent::RecvPLoginReputationConstructor( - PLoginReputationParent* aActor, const URIParams& aURI) { + PLoginReputationParent* aActor, nsIURI* aURI) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aActor); - nsCOMPtr uri = DeserializeURI(aURI); - if (!uri) { + if (!aURI) { return IPC_FAIL_NO_REASON(this); } auto* actor = static_cast(aActor); - return actor->QueryReputation(uri); + return actor->QueryReputation(aURI); } bool ContentParent::DeallocPLoginReputationParent( diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index c1c6bd80f6f2..04183943dd76 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -94,7 +94,6 @@ class PrintingParent; namespace ipc { class CrashReporterHost; class PFileDescriptorSetParent; -class URIParams; class TestShellParent; #ifdef FUZZING class ProtocolFuzzerHelper; @@ -149,7 +148,6 @@ class ContentParent final typedef mozilla::ipc::GeckoChildProcessHost GeckoChildProcessHost; 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; @@ -489,13 +487,13 @@ class ContentParent final const ContentParentId& aCpId); already_AddRefed AllocPOfflineCacheUpdateParent( - const URIParams& aManifestURI, const URIParams& aDocumentURI, + nsIURI* aManifestURI, nsIURI* aDocumentURI, const PrincipalInfo& aLoadingPrincipalInfo, const bool& aStickDocument, const CookieJarSettingsArgs& aCookieJarSettingsArgs); virtual mozilla::ipc::IPCResult RecvPOfflineCacheUpdateConstructor( - POfflineCacheUpdateParent* aActor, const URIParams& aManifestURI, - const URIParams& aDocumentURI, const PrincipalInfo& aLoadingPrincipal, + POfflineCacheUpdateParent* aActor, nsIURI* aManifestURI, + nsIURI* aDocumentURI, const PrincipalInfo& aLoadingPrincipal, const bool& stickDocument, const CookieJarSettingsArgs& aCookieJarSettingsArgs) override; @@ -523,7 +521,7 @@ class ContentParent final mozilla::ipc::IPCResult RecvCreateWindow( PBrowserParent* aThisBrowserParent, PBrowserParent* aNewTab, const uint32_t& aChromeFlags, const bool& aCalledFromJS, - const bool& aWidthSpecified, const Maybe& aURIToLoad, + const bool& aWidthSpecified, nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom, const IPC::Principal& aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo, @@ -532,7 +530,7 @@ class ContentParent final mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess( PBrowserParent* aThisTab, const uint32_t& aChromeFlags, const bool& aCalledFromJS, const bool& aWidthSpecified, - const Maybe& aURIToLoad, const nsCString& aFeatures, + nsIURI* aURIToLoad, const nsCString& aFeatures, const float& aFullZoom, const nsString& aName, nsIPrincipal* aTriggeringPrincipal, nsIContentSecurityPolicy* aCsp, nsIReferrerInfo* aReferrerInfo); @@ -567,17 +565,16 @@ class ContentParent final // PURLClassifierLocalParent. PURLClassifierLocalParent* AllocPURLClassifierLocalParent( - const URIParams& aURI, - const nsTArray& aFeatures); + nsIURI* aURI, const nsTArray& aFeatures); virtual mozilla::ipc::IPCResult RecvPURLClassifierLocalConstructor( - PURLClassifierLocalParent* aActor, const URIParams& aURI, + PURLClassifierLocalParent* aActor, nsIURI* aURI, nsTArray&& aFeatures) override; - PLoginReputationParent* AllocPLoginReputationParent(const URIParams& aURI); + PLoginReputationParent* AllocPLoginReputationParent(nsIURI* aURI); virtual mozilla::ipc::IPCResult RecvPLoginReputationConstructor( - PLoginReputationParent* aActor, const URIParams& aURI) override; + PLoginReputationParent* aActor, nsIURI* aURI) override; bool DeallocPLoginReputationParent(PLoginReputationParent* aActor); @@ -891,11 +888,11 @@ class ContentParent final const uint32_t& chromeFlags); mozilla::ipc::IPCResult RecvIsSecureURI( - const uint32_t& aType, const URIParams& aURI, const uint32_t& aFlags, + const uint32_t& aType, nsIURI* aURI, const uint32_t& aFlags, const OriginAttributes& aOriginAttributes, bool* aIsSecureURI); mozilla::ipc::IPCResult RecvAccumulateMixedContentHSTS( - const URIParams& aURI, const bool& aActive, + nsIURI* aURI, const bool& aActive, const OriginAttributes& aOriginAttributes); bool DeallocPHalParent(PHalParent*); @@ -921,25 +918,22 @@ class ContentParent final bool DeallocPNeckoParent(PNeckoParent* necko); already_AddRefed AllocPExternalHelperAppParent( - const Maybe& aUri, - const Maybe& aLoadInfoArgs, + nsIURI* 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 Maybe& aReferrer, - const MaybeDiscarded& aContext, + nsIURI* aReferrer, const MaybeDiscarded& aContext, const bool& aShouldCloseWindow); mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor( - PExternalHelperAppParent* actor, const Maybe& uri, + PExternalHelperAppParent* actor, nsIURI* 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 Maybe& aReferrer, - const MaybeDiscarded& aContext, + nsIURI* aReferrer, const MaybeDiscarded& aContext, const bool& aShouldCloseWindow) override; already_AddRefed AllocPHandlerServiceParent(); @@ -994,7 +988,7 @@ class ContentParent final const int32_t& aWhichClipboard, const bool& aPlainTextOnly, nsTArray* aTypes); - mozilla::ipc::IPCResult RecvPlaySound(const URIParams& aURI); + mozilla::ipc::IPCResult RecvPlaySound(nsIURI* aURI); mozilla::ipc::IPCResult RecvBeep(); mozilla::ipc::IPCResult RecvPlayEventSound(const uint32_t& aEventId); @@ -1004,10 +998,10 @@ class ContentParent final mozilla::ipc::IPCResult RecvGetShowPasswordSetting(bool* showPassword); - mozilla::ipc::IPCResult RecvStartVisitedQueries(const nsTArray&); + mozilla::ipc::IPCResult RecvStartVisitedQueries( + const nsTArray>&); - mozilla::ipc::IPCResult RecvSetURITitle(const URIParams& uri, - const nsString& title); + mozilla::ipc::IPCResult RecvSetURITitle(nsIURI* uri, const nsString& title); bool HasNotificationPermission(const IPC::Principal& aPrincipal); @@ -1025,7 +1019,7 @@ class ContentParent final mozilla::ipc::IPCResult RecvNotificationEvent( const nsString& aType, const NotificationEventData& aData); - mozilla::ipc::IPCResult RecvLoadURIExternal(const URIParams& uri, + mozilla::ipc::IPCResult RecvLoadURIExternal(nsIURI* uri, PBrowserParent* windowContext); mozilla::ipc::IPCResult RecvExtProtocolChannelConnectParent( const uint32_t& registrarId); @@ -1101,14 +1095,14 @@ class ContentParent final const bool& aIsPrivateContext, nsString* aProviderName, RefPtr* aPostData, - Maybe* aURI); + RefPtr* 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); + nsIURI* aOldURI, nsIURI* aNewURI, const IPC::Principal& aLoadingPrincipal, + const bool& aInPrivateBrowsing); virtual void ProcessingError(Result aCode, const char* aMsgName) override; @@ -1170,8 +1164,8 @@ class ContentParent final const mozilla::fontlist::Pointer& aFamilyPtr); mozilla::ipc::IPCResult RecvGetHyphDict( - const mozilla::ipc::URIParams& aURIParams, - mozilla::ipc::SharedMemoryBasic::Handle* aOutHandle, uint32_t* aOutSize); + nsIURI* aURIParams, mozilla::ipc::SharedMemoryBasic::Handle* aOutHandle, + uint32_t* aOutSize); mozilla::ipc::IPCResult RecvNotifyBenchmarkResult(const nsString& aCodecName, const uint32_t& aDecodeFPS); diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 5cac8e4b05aa..4bbb5e44ee04 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -54,7 +54,6 @@ include JavaScriptTypes; include IPCBlob; include IPCStream; include PTabContext; -include URIParams; include PluginTypes; include ProtocolTypes; include PBackgroundSharedTypes; @@ -191,10 +190,10 @@ union FileDescOrError { struct DomainPolicyClone { bool active; - URIParams[] blocklist; - URIParams[] allowlist; - URIParams[] superBlocklist; - URIParams[] superAllowlist; + nsIURI[] blocklist; + nsIURI[] allowlist; + nsIURI[] superBlocklist; + nsIURI[] superAllowlist; }; struct AndroidSystemInfo @@ -282,7 +281,7 @@ struct XPCOMInitData nsString[] dictionaries; ClipboardCapabilities clipboardCaps; DomainPolicyClone domainPolicy; - URIParams? userContentSheetURL; + nsIURI userContentSheetURL; GfxVarUpdate[] gfxNonDefaultVarUpdates; ContentDeviceData contentDeviceData; GfxInfoFeatureStatus[] gfxFeatureStatus; @@ -294,7 +293,7 @@ struct XPCOMInitData struct VisitedQueryResult { - URIParams uri; + nsIURI uri; bool visited; }; @@ -634,8 +633,8 @@ child: /** * Used to manage nsIStyleSheetService across processes. */ - async LoadAndRegisterSheet(URIParams uri, uint32_t type); - async UnregisterSheet(URIParams uri, uint32_t type); + async LoadAndRegisterSheet(nsIURI uri, uint32_t type); + async UnregisterSheet(nsIURI uri, uint32_t type); /** * Notify idle observers in the child @@ -648,7 +647,7 @@ child: LayoutDeviceIntPoint aDragEndPoint, uint32_t aKeyModifiers); - async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, URIParams? aDomain); + async DomainSetChanged(uint32_t aSetType, uint32_t aChangeType, nsIURI aDomain); /** * Notify the child to shutdown. The child will in turn call FinishShutdown @@ -891,11 +890,11 @@ parent: async InitCrashReporter(Shmem shmem, NativeThreadId tid); - sync IsSecureURI(uint32_t aType, URIParams aURI, uint32_t aFlags, + sync IsSecureURI(uint32_t aType, nsIURI aURI, uint32_t aFlags, OriginAttributes aOriginAttributes) returns (bool isSecureURI); - async AccumulateMixedContentHSTS(URIParams aURI, bool aActive, + async AccumulateMixedContentHSTS(nsIURI aURI, bool aActive, OriginAttributes aOriginAttributes); nested(inside_cpow) async PHal(); @@ -923,9 +922,9 @@ parent: sync PURLClassifier(Principal principal) returns (bool success); - async PURLClassifierLocal(URIParams uri, IPCURLClassifierFeature[] features); + async PURLClassifierLocal(nsIURI uri, IPCURLClassifierFeature[] features); - async PLoginReputation(URIParams formURI); + async PLoginReputation(nsIURI formURI); async PSessionStorageObserver(); @@ -938,10 +937,10 @@ parent: // Services remoting - async StartVisitedQueries(URIParams[] uri); - async SetURITitle(URIParams uri, nsString title); + async StartVisitedQueries(nsIURI[] uri); + async SetURITitle(nsIURI uri, nsString title); - async LoadURIExternal(URIParams uri, PBrowser windowContext); + async LoadURIExternal(nsIURI uri, PBrowser windowContext); async ExtProtocolChannelConnectParent(uint32_t registrarId); // PrefService message @@ -997,7 +996,7 @@ parent: // nsIMIMEInfo and other such influences. // Pass true for aShouldCloseWindow to specify that aContext was opened specifically // for this load, and should be closed once we've handled it. - async PExternalHelperApp(URIParams? uri, + async PExternalHelperApp(nsIURI uri, LoadInfoArgs? loadInfoArgs, nsCString aMimeContentType, nsCString aContentDisposition, @@ -1006,7 +1005,7 @@ parent: bool aForceSave, int64_t aContentLength, bool aWasFileChannel, - URIParams? aReferrer, + nsIURI aReferrer, MaybeDiscardedBrowsingContext aContext, bool aShouldCloseWindow); @@ -1046,7 +1045,7 @@ parent: // 'Play', 'Beep' and 'PlayEventSound' are the only nsISound methods used in // the content process. - async PlaySound(URIParams aURL) compress; + async PlaySound(nsIURI aURL) compress; async Beep() compress; async PlayEventSound(uint32_t aEventId) compress; @@ -1065,11 +1064,11 @@ parent: async DeviceReset(); sync KeywordToURI(nsCString keyword, bool isPrivateContext) - returns (nsString providerName, nsIInputStream postData, URIParams? uri); + returns (nsString providerName, nsIInputStream postData, nsIURI uri); sync NotifyKeywordSearchLoading(nsString providerName, nsString keyword); - async CopyFavicon(URIParams oldURI, URIParams newURI, Principal aLoadingPrincipal, bool isPrivate); + async CopyFavicon(nsIURI oldURI, nsIURI newURI, Principal aLoadingPrincipal, bool isPrivate); /** * Notifies the parent about a recording device is starting or shutdown. @@ -1134,7 +1133,7 @@ parent: * @param tabId * To identify which tab owns the app. */ - async POfflineCacheUpdate(URIParams manifestURI, URIParams documentURI, + async POfflineCacheUpdate(nsIURI manifestURI, nsIURI documentURI, PrincipalInfo loadingPrincipal, bool stickDocument, CookieJarSettingsArgs cookieJarSettings); @@ -1348,14 +1347,14 @@ parent: * @param aLoaded * Returns the size in bytes of the resource. */ - sync GetHyphDict(URIParams aURI) returns (Handle aHandle, uint32_t aSize); + sync GetHyphDict(nsIURI aURI) returns (Handle aHandle, uint32_t aSize); async CreateWindow(nullable PBrowser aThisTab, PBrowser aNewTab, uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified, - URIParams? aURIToLoad, + nsIURI aURIToLoad, nsCString aFeatures, float aFullZoom, Principal aTriggeringPrincipal, @@ -1368,7 +1367,7 @@ parent: uint32_t aChromeFlags, bool aCalledFromJS, bool aWidthSpecified, - URIParams? aURIToLoad, + nsIURI aURIToLoad, nsCString aFeatures, float aFullZoom, nsString aName, diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index bfe6a2acc98e..ab757b193d49 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -986,9 +986,8 @@ nsresult nsMixedContentBlocker::ShouldLoad( mozilla::dom::ContentChild* cc = mozilla::dom::ContentChild::GetSingleton(); if (cc) { - mozilla::ipc::URIParams uri; - SerializeURI(innerContentLocation, uri); - cc->SendAccumulateMixedContentHSTS(uri, active, originAttributes); + cc->SendAccumulateMixedContentHSTS(innerContentLocation, active, + originAttributes); } } } diff --git a/intl/hyphenation/glue/nsHyphenator.cpp b/intl/hyphenation/glue/nsHyphenator.cpp index 01a5225b290e..065a1afe17b8 100644 --- a/intl/hyphenation/glue/nsHyphenator.cpp +++ b/intl/hyphenation/glue/nsHyphenator.cpp @@ -64,9 +64,8 @@ already_AddRefed GetHyphDictFromParent( MOZ_ASSERT(!XRE_IsParentProcess()); ipc::SharedMemoryBasic::Handle handle = ipc::SharedMemoryBasic::NULLHandle(); uint32_t size; - ipc::URIParams params; - SerializeURI(aURI, params); - if (!dom::ContentChild::GetSingleton()->SendGetHyphDict(params, &handle, + MOZ_ASSERT(aURI); + if (!dom::ContentChild::GetSingleton()->SendGetHyphDict(aURI, &handle, &size)) { return nullptr; } diff --git a/layout/base/nsStyleSheetService.cpp b/layout/base/nsStyleSheetService.cpp index 45fbd47e71d7..b025d9438444 100644 --- a/layout/base/nsStyleSheetService.cpp +++ b/layout/base/nsStyleSheetService.cpp @@ -169,11 +169,8 @@ nsStyleSheetService::LoadAndRegisterSheet(nsIURI* aSheetURI, return rv; } - mozilla::ipc::URIParams uri; - SerializeURI(aSheetURI, uri); - for (uint32_t i = 0; i < children.Length(); i++) { - Unused << children[i]->SendLoadAndRegisterSheet(uri, aSheetType); + Unused << children[i]->SendLoadAndRegisterSheet(aSheetURI, aSheetType); } } } @@ -327,11 +324,8 @@ nsStyleSheetService::UnregisterSheet(nsIURI* aSheetURI, uint32_t aSheetType) { return NS_OK; } - mozilla::ipc::URIParams uri; - SerializeURI(aSheetURI, uri); - for (uint32_t i = 0; i < children.Length(); i++) { - Unused << children[i]->SendUnregisterSheet(uri, aSheetType); + Unused << children[i]->SendUnregisterSheet(aSheetURI, aSheetType); } } diff --git a/toolkit/components/places/History.cpp b/toolkit/components/places/History.cpp index d3d2ec5d1db3..ef3cc3e4ce18 100644 --- a/toolkit/components/places/History.cpp +++ b/toolkit/components/places/History.cpp @@ -436,7 +436,7 @@ class VisitedQuery final : public AsyncStatementCallback { AutoTArray results; VisitedQueryResult& result = *results.AppendElement(); result.visited() = mIsVisited; - SerializeURI(mURI, result.uri()); + result.uri() = mURI; history->NotifyVisitedParent(results); } } @@ -584,7 +584,7 @@ class NotifyManyVisitsObservers : public Runnable { if (BrowserTabsRemoteAutostart()) { VisitedQueryResult& result = *results.AppendElement(); - SerializeURI(uris[i], result.uri()); + result.uri() = uris[i]; result.visited() = true; } } @@ -596,7 +596,7 @@ class NotifyManyVisitsObservers : public Runnable { if (BrowserTabsRemoteAutostart()) { VisitedQueryResult& result = *results.AppendElement(); - SerializeURI(uris[0], result.uri()); + result.uri() = uris[0]; result.visited() = true; mHistory->NotifyVisitedParent(results); } @@ -1993,12 +1993,9 @@ History::SetURITitle(nsIURI* aURI, const nsAString& aTitle) { } if (XRE_IsContentProcess()) { - URIParams uri; - SerializeURI(aURI, uri); - auto* cpc = dom::ContentChild::GetSingleton(); MOZ_ASSERT(cpc, "Content Protocol is NULL!"); - Unused << cpc->SendSetURITitle(uri, PromiseFlatString(aTitle)); + Unused << cpc->SendSetURITitle(aURI, PromiseFlatString(aTitle)); return NS_OK; } @@ -2206,9 +2203,9 @@ History::IsURIVisited(nsIURI* aURI, mozIVisitedStatusCallback* aCallback) { void History::StartPendingVisitedQueries( const PendingVisitedQueries& aQueries) { if (XRE_IsContentProcess()) { - nsTArray uris(aQueries.Count()); + nsTArray> uris(aQueries.Count()); for (auto iter = aQueries.ConstIter(); !iter.Done(); iter.Next()) { - SerializeURI(iter.Get()->GetKey(), *uris.AppendElement()); + uris.AppendElement(iter.Get()->GetKey()); } auto* cpc = mozilla::dom::ContentChild::GetSingleton(); MOZ_ASSERT(cpc, "Content Protocol is NULL!"); diff --git a/toolkit/components/reputationservice/LoginReputation.cpp b/toolkit/components/reputationservice/LoginReputation.cpp index 1c32a9e8ddab..367b9e2e60bd 100644 --- a/toolkit/components/reputationservice/LoginReputation.cpp +++ b/toolkit/components/reputationservice/LoginReputation.cpp @@ -298,10 +298,7 @@ LoginReputationService::QueryReputationAsync( return NS_ERROR_FAILURE; } - URIParams uri; - SerializeURI(documentURI, uri); - - if (!content->SendPLoginReputationConstructor(uri)) { + if (!content->SendPLoginReputationConstructor(documentURI)) { return NS_ERROR_FAILURE; } } else { diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index 8418dc2e32b7..63e7b528f90f 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -2446,9 +2446,6 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithFeatures( mozilla::SystemGroup::EventTargetFor(mozilla::TaskCategory::Other); content->SetEventTargetForActor(actor, systemGroupEventTarget); - URIParams uri; - SerializeURI(aURI, uri); - nsTArray ipcFeatures; for (nsIUrlClassifierFeature* feature : aFeatures) { nsAutoCString name; @@ -2473,7 +2470,8 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithFeatures( IPCURLClassifierFeature(name, tables, skipHostList)); } - if (!content->SendPURLClassifierLocalConstructor(actor, uri, ipcFeatures)) { + if (!content->SendPURLClassifierLocalConstructor(actor, aURI, + ipcFeatures)) { return NS_ERROR_FAILURE; } diff --git a/uriloader/exthandler/ExternalHelperAppParent.cpp b/uriloader/exthandler/ExternalHelperAppParent.cpp index 7ba2f7806e01..584d0f7e6271 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.cpp +++ b/uriloader/exthandler/ExternalHelperAppParent.cpp @@ -34,11 +34,11 @@ NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsHashPropertyBag, nsIStreamListener, nsIExternalHelperAppParent) ExternalHelperAppParent::ExternalHelperAppParent( - const Maybe& uri, const int64_t& aContentLength, - const bool& aWasFileChannel, const nsCString& aContentDispositionHeader, + nsIURI* uri, const int64_t& aContentLength, const bool& aWasFileChannel, + const nsCString& aContentDispositionHeader, const uint32_t& aContentDispositionHint, const nsString& aContentDispositionFilename) - : mURI(DeserializeURI(uri)), + : mURI(uri), mPending(false) #ifdef DEBUG , @@ -66,7 +66,7 @@ ExternalHelperAppParent::ExternalHelperAppParent( void ExternalHelperAppParent::Init( const Maybe& aLoadInfoArgs, const nsCString& aMimeContentType, const bool& aForceSave, - const Maybe& aReferrer, BrowsingContext* aContext, + nsIURI* aReferrer, BrowsingContext* aContext, const bool& aShouldCloseWindow) { mozilla::ipc::LoadInfoArgsToLoadInfo(aLoadInfoArgs, getter_AddRefs(mLoadInfo)); @@ -75,10 +75,10 @@ void ExternalHelperAppParent::Init( do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID); NS_ASSERTION(helperAppService, "No Helper App Service!"); - nsCOMPtr referrer = DeserializeURI(aReferrer); - if (referrer) + if (aReferrer) { SetPropertyAsInterface(NS_LITERAL_STRING("docshell.internalReferrer"), - referrer); + aReferrer); + } if (aContext) { WindowGlobalParent* parent = @@ -125,7 +125,9 @@ mozilla::ipc::IPCResult ExternalHelperAppParent::RecvOnStartRequest( mozilla::ipc::IPCResult ExternalHelperAppParent::RecvOnDataAvailable( const nsCString& data, const uint64_t& offset, const uint32_t& count) { - if (NS_FAILED(mStatus)) return IPC_OK(); + if (NS_FAILED(mStatus)) { + return IPC_OK(); + } MOZ_ASSERT(!mDiverted, "child forwarding callbacks after request was diverted"); @@ -391,7 +393,9 @@ ExternalHelperAppParent::SetContentDisposition(uint32_t aContentDisposition) { NS_IMETHODIMP ExternalHelperAppParent::GetContentDispositionFilename( nsAString& aContentDispositionFilename) { - if (mContentDispositionFilename.IsEmpty()) return NS_ERROR_NOT_AVAILABLE; + if (mContentDispositionFilename.IsEmpty()) { + return NS_ERROR_NOT_AVAILABLE; + } aContentDispositionFilename = mContentDispositionFilename; return NS_OK; @@ -407,7 +411,9 @@ ExternalHelperAppParent::SetContentDispositionFilename( NS_IMETHODIMP ExternalHelperAppParent::GetContentDispositionHeader( nsACString& aContentDispositionHeader) { - if (mContentDispositionHeader.IsEmpty()) return NS_ERROR_NOT_AVAILABLE; + if (mContentDispositionHeader.IsEmpty()) { + return NS_ERROR_NOT_AVAILABLE; + } aContentDispositionHeader = mContentDispositionHeader; return NS_OK; @@ -415,10 +421,11 @@ ExternalHelperAppParent::GetContentDispositionHeader( NS_IMETHODIMP ExternalHelperAppParent::GetContentLength(int64_t* aContentLength) { - if (mContentLength < 0) + if (mContentLength < 0) { *aContentLength = -1; - else + } else { *aContentLength = mContentLength; + } return NS_OK; } diff --git a/uriloader/exthandler/ExternalHelperAppParent.h b/uriloader/exthandler/ExternalHelperAppParent.h index 59006e6610fa..6ba053d29c6e 100644 --- a/uriloader/exthandler/ExternalHelperAppParent.h +++ b/uriloader/exthandler/ExternalHelperAppParent.h @@ -21,10 +21,6 @@ class nsExternalAppHandler; namespace mozilla { -namespace ipc { -class URIParams; -} // namespace ipc - namespace net { class PChannelDiverterParent; } // namespace net @@ -84,16 +80,15 @@ class ExternalHelperAppParent bool WasFileChannel() override { return mWasFileChannel; } - ExternalHelperAppParent(const Maybe& uri, - const int64_t& contentLength, + ExternalHelperAppParent(nsIURI* 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 Maybe& aReferrer, - BrowsingContext* aContext, const bool& aShouldCloseWindow); + nsIURI* aReferrer, BrowsingContext* aContext, + const bool& aShouldCloseWindow); protected: virtual ~ExternalHelperAppParent(); diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index b1d5612ce21f..609d710cf6d2 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -623,10 +623,6 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper( nsCOMPtr referrer; NS_GetReferrerFromChannel(channel, getter_AddRefs(referrer)); - Maybe uriParams, referrerParams; - SerializeURI(uri, uriParams); - SerializeURI(referrer, referrerParams); - Maybe loadInfoArgs; MOZ_ALWAYS_SUCCEEDS(LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs)); @@ -644,9 +640,9 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper( // DoContent. RefPtr childListener = new ExternalHelperAppChild(); MOZ_ALWAYS_TRUE(child->SendPExternalHelperAppConstructor( - childListener, uriParams, loadInfoArgs, nsCString(aMimeContentType), disp, + childListener, uri, loadInfoArgs, nsCString(aMimeContentType), disp, contentDisposition, fileName, aForceSave, contentLength, wasFileChannel, - referrerParams, aContentContext, shouldCloseWindow)); + referrer, aContentContext, shouldCloseWindow)); NS_ADDREF(*aStreamListener = childListener); @@ -929,12 +925,9 @@ nsExternalHelperAppService::LoadURI(nsIURI* aURI, NS_ENSURE_ARG_POINTER(aURI); if (XRE_IsContentProcess()) { - URIParams uri; - SerializeURI(aURI, uri); - nsCOMPtr browserChild(do_GetInterface(aWindowContext)); mozilla::dom::ContentChild::GetSingleton()->SendLoadURIExternal( - uri, static_cast(browserChild.get())); + aURI, static_cast(browserChild.get())); return NS_OK; } diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index 3581b2495301..b29ab2ee38fb 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -366,10 +366,6 @@ OfflineCacheUpdateChild::Schedule() { return NS_ERROR_FAILURE; } - URIParams manifestURI, documentURI; - SerializeURI(mManifestURI, manifestURI); - SerializeURI(mDocumentURI, documentURI); - nsresult rv = NS_OK; PrincipalInfo loadingPrincipalInfo; rv = PrincipalToPrincipalInfo(mLoadingPrincipal, &loadingPrincipalInfo); @@ -398,7 +394,7 @@ OfflineCacheUpdateChild::Schedule() { } ContentChild::GetSingleton()->SendPOfflineCacheUpdateConstructor( - this, manifestURI, documentURI, loadingPrincipalInfo, stickDocument, + this, mManifestURI, mDocumentURI, loadingPrincipalInfo, stickDocument, csArgs); return NS_OK; diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.cpp b/uriloader/prefetch/OfflineCacheUpdateParent.cpp index f769a9c4215c..fa8e62a1316d 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp @@ -70,7 +70,7 @@ void OfflineCacheUpdateParent::ActorDestroy(ActorDestroyReason why) { } nsresult OfflineCacheUpdateParent::Schedule( - const URIParams& aManifestURI, const URIParams& aDocumentURI, + nsIURI* aManifestURI, nsIURI* aDocumentURI, const PrincipalInfo& aLoadingPrincipalInfo, const bool& stickDocument, const CookieJarSettingsArgs& aCookieJarSettingsArgs) { LOG(("OfflineCacheUpdateParent::RecvSchedule [%p]", this)); @@ -78,41 +78,48 @@ nsresult OfflineCacheUpdateParent::Schedule( nsresult rv; RefPtr update; - nsCOMPtr manifestURI = DeserializeURI(aManifestURI); - if (!manifestURI) return NS_ERROR_FAILURE; + if (!aManifestURI) { + return NS_ERROR_FAILURE; + } mLoadingPrincipal = PrincipalInfoToPrincipal(aLoadingPrincipalInfo, &rv); NS_ENSURE_SUCCESS(rv, rv); nsOfflineCacheUpdateService* service = nsOfflineCacheUpdateService::EnsureService(); - if (!service) return NS_ERROR_FAILURE; + if (!service) { + return NS_ERROR_FAILURE; + } bool offlinePermissionAllowed = false; rv = service->OfflineAppAllowed(mLoadingPrincipal, &offlinePermissionAllowed); NS_ENSURE_SUCCESS(rv, rv); - if (!offlinePermissionAllowed) return NS_ERROR_DOM_SECURITY_ERR; - - nsCOMPtr documentURI = DeserializeURI(aDocumentURI); - if (!documentURI) return NS_ERROR_FAILURE; - - if (!NS_SecurityCompareURIs(manifestURI, documentURI, false)) + if (!offlinePermissionAllowed) { return NS_ERROR_DOM_SECURITY_ERR; + } + + if (!aDocumentURI) { + return NS_ERROR_FAILURE; + } + + if (!NS_SecurityCompareURIs(aManifestURI, aDocumentURI, false)) { + return NS_ERROR_DOM_SECURITY_ERR; + } nsAutoCString originSuffix; rv = mLoadingPrincipal->GetOriginSuffix(originSuffix); NS_ENSURE_SUCCESS(rv, rv); - service->FindUpdate(manifestURI, originSuffix, nullptr, + service->FindUpdate(aManifestURI, originSuffix, nullptr, getter_AddRefs(update)); if (!update) { update = new nsOfflineCacheUpdate(); // Leave aDocument argument null. Only glues and children keep // document instances. - rv = update->Init(manifestURI, documentURI, mLoadingPrincipal, nullptr, + rv = update->Init(aManifestURI, aDocumentURI, mLoadingPrincipal, nullptr, nullptr); NS_ENSURE_SUCCESS(rv, rv); @@ -129,7 +136,7 @@ nsresult OfflineCacheUpdateParent::Schedule( } if (stickDocument) { - update->StickDocument(documentURI); + update->StickDocument(aDocumentURI); } return NS_OK; @@ -138,7 +145,9 @@ nsresult OfflineCacheUpdateParent::Schedule( NS_IMETHODIMP OfflineCacheUpdateParent::UpdateStateChanged(nsIOfflineCacheUpdate* aUpdate, uint32_t state) { - if (mIPCClosed) return NS_ERROR_UNEXPECTED; + if (mIPCClosed) { + return NS_ERROR_UNEXPECTED; + } LOG(("OfflineCacheUpdateParent::StateEvent [%p]", this)); @@ -164,7 +173,9 @@ OfflineCacheUpdateParent::UpdateStateChanged(nsIOfflineCacheUpdate* aUpdate, NS_IMETHODIMP OfflineCacheUpdateParent::ApplicationCacheAvailable( nsIApplicationCache* aApplicationCache) { - if (mIPCClosed) return NS_ERROR_UNEXPECTED; + if (mIPCClosed) { + return NS_ERROR_UNEXPECTED; + } NS_ENSURE_ARG(aApplicationCache); diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.h b/uriloader/prefetch/OfflineCacheUpdateParent.h index 1e5e0ada98ef..b1bc3d90cc3c 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.h +++ b/uriloader/prefetch/OfflineCacheUpdateParent.h @@ -39,7 +39,7 @@ class OfflineCacheUpdateParent : public POfflineCacheUpdateParent, NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER NS_DECL_NSILOADCONTEXT - nsresult Schedule(const URIParams& manifestURI, const URIParams& documentURI, + nsresult Schedule(nsIURI* manifestURI, nsIURI* documentURI, const PrincipalInfo& loadingPrincipalInfo, const bool& stickDocument, const net::CookieJarSettingsArgs& aCookieJarSettingsArgs); diff --git a/widget/nsSoundProxy.cpp b/widget/nsSoundProxy.cpp index bbd1234f1955..e991fa240ecf 100644 --- a/widget/nsSoundProxy.cpp +++ b/widget/nsSoundProxy.cpp @@ -16,16 +16,12 @@ NS_IMPL_ISUPPORTS(nsSoundProxy, nsISound) NS_IMETHODIMP nsSoundProxy::Play(nsIURL* aURL) { MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content); - - nsCOMPtr soundURI(aURL); // Only allow playing a chrome:// URL from the content process. - if (!soundURI || !soundURI->SchemeIs("chrome")) { + if (!aURL || !aURL->SchemeIs("chrome")) { return NS_ERROR_FAILURE; } - mozilla::ipc::URIParams soundParams; - mozilla::ipc::SerializeURI(soundURI, soundParams); - ContentChild::GetSingleton()->SendPlaySound(soundParams); + ContentChild::GetSingleton()->SendPlaySound(aURL); return NS_OK; }