Bug 1939658 - Replace new URL usage with URL.parse/URL.canParse where possible. r=robwu,Standard8,Gijs,mtigley,pdahiya,settings-reviewers,credential-management-reviewers,devtools-reviewers,tabbrowser-reviewers,places-reviewers,omc-reviewers,migration-reviewers,firefox-desktop-core-reviewers ,home-newtab-reviewers,webcompat-reviewers,urlbar-reviewers,twisniewski,mossop,dao,nchevobbe,webdriver-reviewers,whimboo,issammani,mconley,nbarrett,beth

Differential Revision: https://phabricator.services.mozilla.com/D233071
This commit is contained in:
kernp25
2025-02-04 08:25:28 +00:00
parent 18d3e276be
commit cd2f76670a
79 changed files with 452 additions and 621 deletions

View File

@@ -203,13 +203,11 @@ var gBrowserInit = {
// Hack to ensure that the various initial pages favicon is loaded
// instantaneously, to avoid flickering and improve perceived performance.
this._callWithURIToLoad(uriToLoad => {
let url;
try {
url = Services.io.newURI(uriToLoad);
} catch (e) {
let url = URL.parse(uriToLoad);
if (!url) {
return;
}
let nonQuery = url.prePath + url.filePath;
let nonQuery = url.URI.prePath + url.pathname;
if (nonQuery in gPageIcons) {
gBrowser.setIcon(gBrowser.selectedTab, gPageIcons[nonQuery]);
}