Bug 1628906 - First search in a tab from location bar could trigger an "Invalid URL" error page. r=Gijs,nika,mattwoodrow

Before 1496578, URIFixup::keywordToURI used to do a synchronous IPC call to be
able to access search engines from the content process. Consumers of URIFixup
didn't care. Bug 1496578 moved the IPC messaging to the callers, in particular
nsDocShell, but assumed nsDocShellLoadState wasn't loading from content.
It looks like in some cases it does, so this adds another sync IPC call for
GetFixupURIInfo.
The total numer of sync IPCs should not change from before Bug 1496578, URIFIxup
was just doing it internally, while now it happens at the call point.
Note the long term plan would be for these docshell objects callers to just
handle URIs, while the UI code should do fixup.
Bug 1375244 tracks the removal of these sync IPC messages.

Differential Revision: https://phabricator.services.mozilla.com/D70607
This commit is contained in:
Marco Bonardo
2020-04-15 22:39:38 +00:00
parent a923c367b1
commit a6761dedd6
10 changed files with 153 additions and 23 deletions

View File

@@ -1082,13 +1082,12 @@ nsScriptSecurityManager::CheckLoadURIStrWithPrincipal(
return rv;
}
// URIFixup's keyword and alternate flags can only fixup to http/https, so we
// can skip testing them. This simplifies our life because this code can be
// invoked from the content process where the search service would not be
// available.
uint32_t flags[] = {nsIURIFixup::FIXUP_FLAG_NONE,
nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS,
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP,
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI,
nsIURIFixup::FIXUP_FLAG_ALLOW_KEYWORD_LOOKUP |
nsIURIFixup::FIXUP_FLAGS_MAKE_ALTERNATE_URI};
nsIURIFixup::FIXUP_FLAG_FIX_SCHEME_TYPOS};
for (uint32_t i = 0; i < ArrayLength(flags); ++i) {
uint32_t fixupFlags = flags[i];
if (aPrincipal->OriginAttributesRef().mPrivateBrowsingId > 0) {