Bug 1375244 - Remove sync KeywordToURI and related IPC messages as they are no longer required. r=Gijs,mak,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D89486
This commit is contained in:
@@ -5749,32 +5749,7 @@ already_AddRefed<nsIURIFixupInfo> nsDocShell::KeywordToURI(
|
||||
const nsACString& aKeyword, bool aIsPrivateContext,
|
||||
nsIInputStream** aPostData) {
|
||||
nsCOMPtr<nsIURIFixupInfo> info;
|
||||
if (XRE_IsContentProcess()) {
|
||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||
if (!contentChild) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
info = do_CreateInstance("@mozilla.org/docshell/uri-fixup-info;1");
|
||||
if (NS_WARN_IF(!info)) {
|
||||
return nullptr;
|
||||
}
|
||||
RefPtr<nsIInputStream> postData;
|
||||
RefPtr<nsIURI> uri;
|
||||
nsAutoString providerName;
|
||||
nsAutoCString keyword(aKeyword);
|
||||
// TODO (Bug 1375244): This synchronous IPC messaging should be changed.
|
||||
if (contentChild->SendKeywordToURI(keyword, aIsPrivateContext,
|
||||
&providerName, &postData, &uri)) {
|
||||
NS_ConvertUTF8toUTF16 keywordW(aKeyword);
|
||||
info->SetKeywordAsSent(keywordW);
|
||||
info->SetKeywordProviderName(providerName);
|
||||
if (aPostData) {
|
||||
postData.forget(aPostData);
|
||||
}
|
||||
info->SetPreferredURI(uri);
|
||||
}
|
||||
} else {
|
||||
if (!XRE_IsContentProcess()) {
|
||||
nsCOMPtr<nsIURIFixup> uriFixup = components::URIFixup::Service();
|
||||
if (uriFixup) {
|
||||
uriFixup->KeywordToURI(aKeyword, aIsPrivateContext, aPostData,
|
||||
@@ -12703,14 +12678,6 @@ void nsDocShell::MaybeNotifyKeywordSearchLoading(const nsString& aProvider,
|
||||
return;
|
||||
}
|
||||
|
||||
if (XRE_IsContentProcess()) {
|
||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||
if (contentChild) {
|
||||
contentChild->SendNotifyKeywordSearchLoading(aProvider, aKeyword);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISearchService> searchSvc =
|
||||
do_GetService("@mozilla.org/browser/search-service;1");
|
||||
if (searchSvc) {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/Components.h"
|
||||
#include "mozilla/dom/BrowsingContext.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/LoadURIOptionsBinding.h"
|
||||
#include "mozilla/StaticPrefs_fission.h"
|
||||
|
||||
@@ -252,24 +251,7 @@ nsresult nsDocShellLoadState::CreateFromLoadURIOptions(
|
||||
}
|
||||
|
||||
RefPtr<nsIInputStream> fixupStream;
|
||||
if (XRE_IsContentProcess()) {
|
||||
dom::ContentChild* contentChild = dom::ContentChild::GetSingleton();
|
||||
if (contentChild) {
|
||||
RefPtr<nsIURI> preferredURI;
|
||||
// TODO (Bug 1375244): This synchronous IPC messaging should be changed.
|
||||
if (contentChild->SendGetFixupURIInfo(
|
||||
PromiseFlatString(aURI), fixupFlags,
|
||||
loadFlags &
|
||||
nsIWebNavigation::LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP,
|
||||
&searchProvider, &fixupStream, &preferredURI)) {
|
||||
if (preferredURI) {
|
||||
didFixup = true;
|
||||
rv = NS_OK;
|
||||
uri = preferredURI;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!XRE_IsContentProcess()) {
|
||||
nsCOMPtr<nsIURIFixupInfo> fixupInfo;
|
||||
sURIFixup->GetFixupURIInfo(uriString, fixupFlags,
|
||||
getter_AddRefs(fixupStream),
|
||||
|
||||
@@ -209,13 +209,11 @@
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIScriptError.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISearchService.h"
|
||||
#include "nsIServiceWorkerManager.h"
|
||||
#include "nsISiteSecurityService.h"
|
||||
#include "nsISound.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIURIFixup.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIX509Cert.h"
|
||||
@@ -4538,90 +4536,6 @@ nsresult ContentParent::DoSendAsyncMessage(const nsAString& aMessage,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvKeywordToURI(
|
||||
const nsCString& aKeyword, const bool& aIsPrivateContext,
|
||||
nsString* aProviderName, RefPtr<nsIInputStream>* aPostData,
|
||||
RefPtr<nsIURI>* aURI) {
|
||||
*aPostData = nullptr;
|
||||
*aURI = nullptr;
|
||||
nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service();
|
||||
if (!fixup) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURIFixupInfo> info;
|
||||
|
||||
if (NS_FAILED(fixup->KeywordToURI(aKeyword, aIsPrivateContext,
|
||||
getter_AddRefs(*aPostData),
|
||||
getter_AddRefs(info)))) {
|
||||
return IPC_OK();
|
||||
}
|
||||
info->GetKeywordProviderName(*aProviderName);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
info->GetPreferredURI(getter_AddRefs(uri));
|
||||
*aURI = uri;
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvGetFixupURIInfo(
|
||||
const nsString& aURIString, const uint32_t& aFixupFlags,
|
||||
bool aAllowThirdPartyFixup, nsString* aProviderName,
|
||||
RefPtr<nsIInputStream>* aPostData, RefPtr<nsIURI>* aPreferredURI) {
|
||||
*aPostData = nullptr;
|
||||
*aPreferredURI = nullptr;
|
||||
nsCOMPtr<nsIURIFixup> fixup = components::URIFixup::Service();
|
||||
if (!fixup) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 uriString(aURIString);
|
||||
// Cleanup the empty spaces that might be on each end.
|
||||
uriString.Trim(" ");
|
||||
// Eliminate embedded newlines, which single-line text fields now allow:
|
||||
uriString.StripCRLF();
|
||||
|
||||
nsCOMPtr<nsIURIFixupInfo> info;
|
||||
if (NS_FAILED(fixup->GetFixupURIInfo(uriString, aFixupFlags,
|
||||
getter_AddRefs(*aPostData),
|
||||
getter_AddRefs(info)))) {
|
||||
return IPC_OK();
|
||||
}
|
||||
info->GetKeywordProviderName(*aProviderName);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
info->GetPreferredURI(getter_AddRefs(uri));
|
||||
*aPreferredURI = uri;
|
||||
|
||||
if (aAllowThirdPartyFixup) {
|
||||
nsCOMPtr<nsIObserverService> serv = services::GetObserverService();
|
||||
if (serv) {
|
||||
serv->NotifyObservers(info, "keyword-uri-fixup",
|
||||
PromiseFlatString(aURIString).get());
|
||||
}
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvNotifyKeywordSearchLoading(
|
||||
const nsString& aProvider, const nsString& aKeyword) {
|
||||
nsCOMPtr<nsISearchService> searchSvc =
|
||||
do_GetService("@mozilla.org/browser/search-service;1");
|
||||
if (searchSvc) {
|
||||
nsCOMPtr<nsISearchEngine> searchEngine;
|
||||
searchSvc->GetEngineByName(aProvider, getter_AddRefs(searchEngine));
|
||||
if (searchEngine) {
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obsSvc) {
|
||||
// Note that "keyword-search" refers to a search via the url
|
||||
// bar, not a bookmarks keyword search.
|
||||
obsSvc->NotifyObservers(searchEngine, "keyword-search", aKeyword.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvCopyFavicon(
|
||||
nsIURI* aOldURI, nsIURI* aNewURI, const IPC::Principal& aLoadingPrincipal,
|
||||
const bool& aInPrivateBrowsing) {
|
||||
|
||||
@@ -1138,22 +1138,6 @@ class ContentParent final
|
||||
|
||||
mozilla::ipc::IPCResult RecvDeviceReset();
|
||||
|
||||
mozilla::ipc::IPCResult RecvKeywordToURI(const nsCString& aKeyword,
|
||||
const bool& aIsPrivateContext,
|
||||
nsString* aProviderName,
|
||||
RefPtr<nsIInputStream>* aPostData,
|
||||
RefPtr<nsIURI>* aURI);
|
||||
|
||||
mozilla::ipc::IPCResult RecvGetFixupURIInfo(const nsString& aURIString,
|
||||
const uint32_t& aFixupFlags,
|
||||
bool aAllowThirdPartyFixup,
|
||||
nsString* aProviderName,
|
||||
RefPtr<nsIInputStream>* aPostData,
|
||||
RefPtr<nsIURI>* aPreferredURI);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNotifyKeywordSearchLoading(
|
||||
const nsString& aProvider, const nsString& aKeyword);
|
||||
|
||||
mozilla::ipc::IPCResult RecvCopyFavicon(
|
||||
nsIURI* aOldURI, nsIURI* aNewURI, const IPC::Principal& aLoadingPrincipal,
|
||||
const bool& aInPrivateBrowsing);
|
||||
|
||||
@@ -1139,13 +1139,6 @@ parent:
|
||||
|
||||
async DeviceReset();
|
||||
|
||||
sync KeywordToURI(nsCString keyword, bool isPrivateContext)
|
||||
returns (nsString providerName, nsIInputStream postData, nsIURI uri);
|
||||
sync GetFixupURIInfo(nsString uriString, uint32_t fixupflags, bool aAllowThirdPartyFixup)
|
||||
returns (nsString providerName, nsIInputStream postData, nsIURI preferredURI);
|
||||
|
||||
sync NotifyKeywordSearchLoading(nsString providerName, nsString keyword);
|
||||
|
||||
async CopyFavicon(nsIURI oldURI, nsIURI newURI, Principal aLoadingPrincipal, bool isPrivate);
|
||||
|
||||
/**
|
||||
|
||||
@@ -851,12 +851,6 @@ description = Legacy synchronous clipboard API
|
||||
description = Retrieve supported clipboard formats synchronously
|
||||
[PContent::GetIconForExtension]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PContent::KeywordToURI]
|
||||
description = legacy sync IPC - nsDocshell tries to use the search service from the content process
|
||||
[PContent::GetFixupURIInfo]
|
||||
description = legacy sync IPC - nsDocShellLoadState tries to use the search service from the content process
|
||||
[PContent::NotifyKeywordSearchLoading]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PContent::BeginDriverCrashGuard]
|
||||
description = legacy sync IPC - please add detailed description
|
||||
[PContent::EndDriverCrashGuard]
|
||||
|
||||
Reference in New Issue
Block a user