Bug 1622619 - Replace URIParams with nsIURI in PContent.ipdl r=valentin

Differential Revision: https://phabricator.services.mozilla.com/D67729

--HG--
extra : moz-landing-system : lando
This commit is contained in:
sonakshi 2020-03-31 13:38:55 +00:00
Родитель 141254c68d
Коммит fc4a38cd03
23 изменённых файлов: 230 добавлений и 313 удалений

Просмотреть файл

@ -29,11 +29,8 @@ static nsresult BroadcastDomainSetChange(DomainSetType aSetType,
return NS_OK;
}
Maybe<URIParams> 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<URIParams>& aDomains, nsIDomainSet* aSet) {
static void CopyURIs(const nsTArray<RefPtr<nsIURI>>& aDomains,
nsIDomainSet* aSet) {
for (uint32_t i = 0; i < aDomains.Length(); i++) {
nsCOMPtr<nsIURI> 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<nsIURI> 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<nsIURI> 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<URIParams>* aDomains) {
void DomainSet::CloneSet(nsTArray<RefPtr<nsIURI>>* 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);
}
}

Просмотреть файл

@ -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<mozilla::ipc::URIParams>* aDomains);
void CloneSet(nsTArray<RefPtr<nsIURI>>* aDomains);
protected:
virtual ~DomainSet() {}

Просмотреть файл

@ -389,7 +389,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
}
RefPtr<nsIInputStream> postData;
Maybe<mozilla::ipc::URIParams> uri;
RefPtr<nsIURI> uri;
nsAutoString providerName;
if (!contentChild->SendKeywordToURI(keyword, aIsPrivateContext,
&providerName, &postData, &uri)) {
@ -403,8 +403,7 @@ nsDefaultURIFixup::KeywordToURI(const nsACString& aKeyword,
postData.forget(aPostData);
}
nsCOMPtr<nsIURI> temp = DeserializeURI(uri);
info->mPreferredURI = std::move(temp);
info->mPreferredURI = uri.forget();
return NS_OK;
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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<nsISiteSecurityService> sss =

Просмотреть файл

@ -934,9 +934,6 @@ nsresult ContentChild::ProvideWindowCommon(
return rv;
}
Maybe<URIParams> 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<URIParams> 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<nsIURI> ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL());
nsCOMPtr<nsIURI> 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<nsIURI> newURI = DeserializeURI(result.uri());
nsCOMPtr<nsIURI> 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<nsIURI> 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<nsIURI> 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<URIParams>& 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<nsIURI> 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<IPCURLClassifierFeature>& aFeatures) {
nsIURI* aUri, const nsTArray<IPCURLClassifierFeature>& 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();
}

Просмотреть файл

@ -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<URIParams>& aDomain);
nsIURI* aDomain);
mozilla::ipc::IPCResult RecvShutdown();
@ -601,11 +596,10 @@ class ContentChild final
// PURLClassifierLocalChild
PURLClassifierLocalChild* AllocPURLClassifierLocalChild(
const URIParams& aUri,
const nsTArray<IPCURLClassifierFeature>& aFeatures);
nsIURI* aUri, const nsTArray<IPCURLClassifierFeature>& aFeatures);
bool DeallocPURLClassifierLocalChild(PURLClassifierLocalChild* aActor);
PLoginReputationChild* AllocPLoginReputationChild(const URIParams& aUri);
PLoginReputationChild* AllocPLoginReputationChild(nsIURI* aUri);
bool DeallocPLoginReputationChild(PLoginReputationChild* aActor);

Просмотреть файл

@ -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<nsIURI> 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<nsIURL> soundURL(do_QueryInterface(soundURI));
nsCOMPtr<nsIURL> soundURL(do_QueryInterface(aURI));
if (!soundURL) {
return IPC_OK();
}
@ -3642,14 +3636,12 @@ bool ContentParent::DeallocPParentToChildStreamParent(
already_AddRefed<PExternalHelperAppParent>
ContentParent::AllocPExternalHelperAppParent(
const Maybe<URIParams>& uri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
nsIURI* uri, const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer,
const MaybeDiscarded<BrowsingContext>& aContext,
nsIURI* aReferrer, const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldCloseWindow) {
RefPtr<ExternalHelperAppParent> parent = new ExternalHelperAppParent(
uri, aContentLength, aWasFileChannel, aContentDisposition,
@ -3658,14 +3650,13 @@ ContentParent::AllocPExternalHelperAppParent(
}
mozilla::ipc::IPCResult ContentParent::RecvPExternalHelperAppConstructor(
PExternalHelperAppParent* actor, const Maybe<URIParams>& uri,
PExternalHelperAppParent* actor, nsIURI* uri,
const Maybe<LoadInfoArgs>& loadInfoArgs, const nsCString& aMimeContentType,
const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer,
const MaybeDiscarded<BrowsingContext>& aContext,
nsIURI* aReferrer, const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldCloseWindow) {
BrowsingContext* context = aContext.IsDiscarded() ? nullptr : aContext.get();
static_cast<ExternalHelperAppParent*>(actor)->Init(
@ -3738,46 +3729,43 @@ mozilla::ipc::IPCResult ContentParent::RecvPSpeechSynthesisConstructor(
#endif
mozilla::ipc::IPCResult ContentParent::RecvStartVisitedQueries(
const nsTArray<URIParams>& aUris) {
const nsTArray<RefPtr<nsIURI>>& aUris) {
nsCOMPtr<IHistory> history = services::GetHistoryService();
if (!history) {
return IPC_OK();
}
for (const auto& params : aUris) {
nsCOMPtr<nsIURI> 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<nsIURI> ourURI = DeserializeURI(uri);
if (!ourURI) {
if (!uri) {
return IPC_FAIL_NO_REASON(this);
}
nsCOMPtr<IHistory> 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<nsISiteSecurityService> sss(do_GetService(NS_SSSERVICE_CONTRACTID));
if (!sss) {
return IPC_FAIL_NO_REASON(this);
}
nsCOMPtr<nsIURI> 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<nsIURI> 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<nsIExternalProtocolService> extProtService(
do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID));
if (!extProtService) {
return IPC_OK();
}
nsCOMPtr<nsIURI> ourURI = DeserializeURI(uri);
if (!ourURI) {
if (!uri) {
return IPC_FAIL_NO_REASON(this);
}
RefPtr<RemoteWindowContext> context =
new RemoteWindowContext(static_cast<BrowserParent*>(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<nsIInputStream>* aPostData,
Maybe<URIParams>* aURI) {
RefPtr<nsIURI>* aURI) {
*aPostData = nullptr;
*aURI = Nothing();
*aURI = nullptr;
nsCOMPtr<nsIURIFixup> 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<nsIURI> 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<nsIURI> 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<nsIURI> 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<mozilla::docshell::POfflineCacheUpdateParent>
ContentParent::AllocPOfflineCacheUpdateParent(
const URIParams& aManifestURI, const URIParams& aDocumentURI,
nsIURI* aManifestURI, nsIURI* aDocumentURI,
const PrincipalInfo& aLoadingPrincipalInfo, const bool& aStickDocument,
const CookieJarSettingsArgs& aCookieJarSettingsArgs) {
RefPtr<mozilla::docshell::OfflineCacheUpdateParent> 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<URIParams>& 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<nsIURI> uriToLoad = DeserializeURI(aURIToLoad);
nsCOMPtr<nsIRemoteTab> 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<URIParams>& 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<nsIRemoteTab> newRemoteTab;
bool windowIsNew;
nsCOMPtr<nsIURI> 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<nsIURI> 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<IPCURLClassifierFeature>& aFeatures) {
nsIURI* aURI, const nsTArray<IPCURLClassifierFeature>& aFeatures) {
MOZ_ASSERT(NS_IsMainThread());
RefPtr<URLClassifierLocalParent> 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<IPCURLClassifierFeature>&& aFeatures) {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aActor);
nsTArray<IPCURLClassifierFeature> features = std::move(aFeatures);
nsCOMPtr<nsIURI> 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<URLClassifierLocalParent*>(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<LoginReputationParent> 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<nsIURI> uri = DeserializeURI(aURI);
if (!uri) {
if (!aURI) {
return IPC_FAIL_NO_REASON(this);
}
auto* actor = static_cast<LoginReputationParent*>(aActor);
return actor->QueryReputation(uri);
return actor->QueryReputation(aURI);
}
bool ContentParent::DeallocPLoginReputationParent(

Просмотреть файл

@ -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<POfflineCacheUpdateParent> 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<URIParams>& 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<URIParams>& 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<IPCURLClassifierFeature>& aFeatures);
nsIURI* aURI, const nsTArray<IPCURLClassifierFeature>& aFeatures);
virtual mozilla::ipc::IPCResult RecvPURLClassifierLocalConstructor(
PURLClassifierLocalParent* aActor, const URIParams& aURI,
PURLClassifierLocalParent* aActor, nsIURI* aURI,
nsTArray<IPCURLClassifierFeature>&& 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<PExternalHelperAppParent> AllocPExternalHelperAppParent(
const Maybe<URIParams>& aUri,
const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
nsIURI* aUri, const Maybe<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer,
const MaybeDiscarded<BrowsingContext>& aContext,
nsIURI* aReferrer, const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldCloseWindow);
mozilla::ipc::IPCResult RecvPExternalHelperAppConstructor(
PExternalHelperAppParent* actor, const Maybe<URIParams>& uri,
PExternalHelperAppParent* actor, nsIURI* uri,
const Maybe<LoadInfoArgs>& loadInfoArgs,
const nsCString& aMimeContentType, const nsCString& aContentDisposition,
const uint32_t& aContentDispositionHint,
const nsString& aContentDispositionFilename, const bool& aForceSave,
const int64_t& aContentLength, const bool& aWasFileChannel,
const Maybe<URIParams>& aReferrer,
const MaybeDiscarded<BrowsingContext>& aContext,
nsIURI* aReferrer, const MaybeDiscarded<BrowsingContext>& aContext,
const bool& aShouldCloseWindow) override;
already_AddRefed<PHandlerServiceParent> AllocPHandlerServiceParent();
@ -994,7 +988,7 @@ class ContentParent final
const int32_t& aWhichClipboard, const bool& aPlainTextOnly,
nsTArray<nsCString>* 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<URIParams>&);
mozilla::ipc::IPCResult RecvStartVisitedQueries(
const nsTArray<RefPtr<nsIURI>>&);
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<nsIInputStream>* aPostData,
Maybe<URIParams>* aURI);
RefPtr<nsIURI>* 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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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);
}
}
}

Просмотреть файл

@ -64,9 +64,8 @@ already_AddRefed<ipc::SharedMemoryBasic> 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;
}

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -436,7 +436,7 @@ class VisitedQuery final : public AsyncStatementCallback {
AutoTArray<VisitedQueryResult, 1> 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<URIParams> uris(aQueries.Count());
nsTArray<RefPtr<nsIURI>> 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!");

Просмотреть файл

@ -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 {

Просмотреть файл

@ -2446,9 +2446,6 @@ nsUrlClassifierDBService::AsyncClassifyLocalWithFeatures(
mozilla::SystemGroup::EventTargetFor(mozilla::TaskCategory::Other);
content->SetEventTargetForActor(actor, systemGroupEventTarget);
URIParams uri;
SerializeURI(aURI, uri);
nsTArray<IPCURLClassifierFeature> 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;
}

Просмотреть файл

@ -34,11 +34,11 @@ NS_IMPL_ISUPPORTS_INHERITED(ExternalHelperAppParent, nsHashPropertyBag,
nsIStreamListener, nsIExternalHelperAppParent)
ExternalHelperAppParent::ExternalHelperAppParent(
const Maybe<URIParams>& 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<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const bool& aForceSave,
const Maybe<URIParams>& 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<nsIURI> 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;
}

Просмотреть файл

@ -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<mozilla::ipc::URIParams>& 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<mozilla::net::LoadInfoArgs>& aLoadInfoArgs,
const nsCString& aMimeContentType, const bool& aForceSave,
const Maybe<mozilla::ipc::URIParams>& aReferrer,
BrowsingContext* aContext, const bool& aShouldCloseWindow);
nsIURI* aReferrer, BrowsingContext* aContext,
const bool& aShouldCloseWindow);
protected:
virtual ~ExternalHelperAppParent();

Просмотреть файл

@ -623,10 +623,6 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper(
nsCOMPtr<nsIURI> referrer;
NS_GetReferrerFromChannel(channel, getter_AddRefs(referrer));
Maybe<URIParams> uriParams, referrerParams;
SerializeURI(uri, uriParams);
SerializeURI(referrer, referrerParams);
Maybe<mozilla::net::LoadInfoArgs> loadInfoArgs;
MOZ_ALWAYS_SUCCEEDS(LoadInfoToLoadInfoArgs(loadInfo, &loadInfoArgs));
@ -644,9 +640,9 @@ nsresult nsExternalHelperAppService::DoContentContentProcessHelper(
// DoContent.
RefPtr<ExternalHelperAppChild> 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<nsIBrowserChild> browserChild(do_GetInterface(aWindowContext));
mozilla::dom::ContentChild::GetSingleton()->SendLoadURIExternal(
uri, static_cast<dom::BrowserChild*>(browserChild.get()));
aURI, static_cast<dom::BrowserChild*>(browserChild.get()));
return NS_OK;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<nsOfflineCacheUpdate> update;
nsCOMPtr<nsIURI> 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<nsIURI> 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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -16,16 +16,12 @@ NS_IMPL_ISUPPORTS(nsSoundProxy, nsISound)
NS_IMETHODIMP
nsSoundProxy::Play(nsIURL* aURL) {
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Content);
nsCOMPtr<nsIURI> 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;
}