зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset fddb4d2af447 (bug 1488296) for browser-chrome failures on browser/components/originattributes/test/browser/browser_favicon_userContextId.js
This commit is contained in:
Родитель
79b8525535
Коммит
70d09db423
|
@ -34,10 +34,10 @@ class LinkHandlerChild extends ActorChild {
|
|||
Services.prefs.getBoolPref("browser.chrome.site_icons", true)) {
|
||||
// Inject the default icon. Use documentURIObject so that we do the right
|
||||
// thing with about:-style error pages. See bug 453442
|
||||
let pageURI = this.content.document.documentURIObject;
|
||||
if (["http", "https"].includes(pageURI.scheme)) {
|
||||
let baseURI = this.content.document.documentURIObject;
|
||||
if (["http", "https"].includes(baseURI.scheme)) {
|
||||
this.seenTabIcon = true;
|
||||
this.iconLoader.addDefaultIcon(pageURI);
|
||||
this.iconLoader.addDefaultIcon(baseURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,11 +137,13 @@ class LinkHandlerChild extends ActorChild {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.iconLoader.addIconFromLink(link, isRichIcon)) {
|
||||
let iconInfo = FaviconLoader.makeFaviconFromLink(link, isRichIcon);
|
||||
if (iconInfo) {
|
||||
iconAdded = true;
|
||||
if (!isRichIcon) {
|
||||
this.seenTabIcon = true;
|
||||
}
|
||||
this.iconLoader.addIcon(iconInfo);
|
||||
}
|
||||
break;
|
||||
case "search":
|
||||
|
|
|
@ -3658,8 +3658,7 @@ const DOMEventHandler = {
|
|||
break;
|
||||
|
||||
case "Link:SetIcon":
|
||||
this.setIconFromLink(aMsg.target, aMsg.data.pageURL,
|
||||
aMsg.data.originalURL, aMsg.data.canUseForTab,
|
||||
this.setIconFromLink(aMsg.target, aMsg.data.originalURL, aMsg.data.canUseForTab,
|
||||
aMsg.data.expiration, aMsg.data.iconURL);
|
||||
break;
|
||||
|
||||
|
@ -3697,15 +3696,14 @@ const DOMEventHandler = {
|
|||
tab.removeAttribute("pendingicon");
|
||||
},
|
||||
|
||||
setIconFromLink(aBrowser, aPageURL, aOriginalURL, aCanUseForTab, aExpiration, aIconURL) {
|
||||
setIconFromLink(aBrowser, aOriginalURL, aCanUseForTab, aExpiration, aIconURL) {
|
||||
let tab = gBrowser.getTabForBrowser(aBrowser);
|
||||
if (!tab) {
|
||||
if (!tab)
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
PlacesUIUtils.loadFavicon(aBrowser, Services.scriptSecurityManager.getSystemPrincipal(),
|
||||
makeURI(aPageURL), makeURI(aOriginalURL),
|
||||
aExpiration, makeURI(aIconURL));
|
||||
makeURI(aOriginalURL), aExpiration, makeURI(aIconURL));
|
||||
} catch (ex) {
|
||||
Cu.reportError(ex);
|
||||
}
|
||||
|
|
|
@ -163,9 +163,9 @@ let InternalFaviconLoader = {
|
|||
});
|
||||
},
|
||||
|
||||
loadFavicon(browser, principal, pageURI, uri, expiration, iconURI) {
|
||||
loadFavicon(browser, principal, uri, expiration, iconURI) {
|
||||
this.ensureInitialized();
|
||||
let {ownerGlobal: win, innerWindowID} = browser;
|
||||
let win = browser.ownerGlobal;
|
||||
if (!gFaviconLoadDataMap.has(win)) {
|
||||
gFaviconLoadDataMap.set(win, []);
|
||||
let unloadHandler = event => {
|
||||
|
@ -179,6 +179,8 @@ let InternalFaviconLoader = {
|
|||
win.addEventListener("unload", unloadHandler, true);
|
||||
}
|
||||
|
||||
let {innerWindowID, currentURI} = browser;
|
||||
|
||||
// First we do the actual setAndFetch call:
|
||||
let loadType = PrivateBrowsingUtils.isWindowPrivate(win)
|
||||
? PlacesUtils.favicons.FAVICON_LOAD_PRIVATE
|
||||
|
@ -191,8 +193,8 @@ let InternalFaviconLoader = {
|
|||
expiration, principal);
|
||||
}
|
||||
|
||||
let request = PlacesUtils.favicons.setAndFetchFaviconForPage(
|
||||
pageURI, uri, false, loadType, callback, principal);
|
||||
let request = PlacesUtils.favicons.setAndFetchFaviconForPage(currentURI, uri, false,
|
||||
loadType, callback, principal);
|
||||
|
||||
// Now register the result so we can cancel it if/when necessary.
|
||||
if (!request) {
|
||||
|
|
|
@ -377,7 +377,6 @@ class IconLoader {
|
|||
|
||||
if (LOCAL_FAVICON_SCHEMES.includes(iconInfo.iconUri.scheme)) {
|
||||
this.mm.sendAsyncMessage("Link:SetIcon", {
|
||||
pageURL: iconInfo.pageUri.spec,
|
||||
originalURL: iconInfo.iconUri.spec,
|
||||
canUseForTab: !iconInfo.isRichIcon,
|
||||
expiration: undefined,
|
||||
|
@ -397,7 +396,6 @@ class IconLoader {
|
|||
let { dataURL, expiration } = await this._loader.load();
|
||||
|
||||
this.mm.sendAsyncMessage("Link:SetIcon", {
|
||||
pageURL: iconInfo.pageUri.spec,
|
||||
originalURL: iconInfo.iconUri.spec,
|
||||
canUseForTab: !iconInfo.isRichIcon,
|
||||
expiration,
|
||||
|
@ -455,28 +453,21 @@ class FaviconLoader {
|
|||
}
|
||||
}
|
||||
|
||||
addIconFromLink(aLink, aIsRichIcon) {
|
||||
let iconInfo = makeFaviconFromLink(aLink, aIsRichIcon);
|
||||
if (iconInfo) {
|
||||
this.iconInfos.push(iconInfo);
|
||||
this.iconTask.arm();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
addIcon(iconInfo) {
|
||||
this.iconInfos.push(iconInfo);
|
||||
this.iconTask.arm();
|
||||
}
|
||||
|
||||
addDefaultIcon(pageUri) {
|
||||
addDefaultIcon(baseURI) {
|
||||
// Currently ImageDocuments will just load the default favicon, see bug
|
||||
// 403651 for discussion.
|
||||
this.iconInfos.push({
|
||||
pageUri,
|
||||
iconUri: pageUri.mutate().setPathQueryRef("/favicon.ico").finalize(),
|
||||
this.addIcon({
|
||||
iconUri: baseURI.mutate().setPathQueryRef("/favicon.ico").finalize(),
|
||||
width: -1,
|
||||
isRichIcon: false,
|
||||
type: TYPE_ICO,
|
||||
node: this.mm.content.document,
|
||||
});
|
||||
this.iconTask.arm();
|
||||
}
|
||||
|
||||
onPageShow() {
|
||||
|
@ -494,22 +485,21 @@ class FaviconLoader {
|
|||
this.iconTask.disarm();
|
||||
this.iconInfos = [];
|
||||
}
|
||||
}
|
||||
|
||||
function makeFaviconFromLink(aLink, aIsRichIcon) {
|
||||
let iconUri = getLinkIconURI(aLink);
|
||||
if (!iconUri)
|
||||
return null;
|
||||
|
||||
// Extract the size type and width.
|
||||
let width = extractIconSize(aLink.sizes);
|
||||
|
||||
return {
|
||||
pageUri: aLink.ownerDocument.documentURIObject,
|
||||
iconUri,
|
||||
width,
|
||||
isRichIcon: aIsRichIcon,
|
||||
type: aLink.type,
|
||||
node: aLink,
|
||||
};
|
||||
|
||||
static makeFaviconFromLink(aLink, aIsRichIcon) {
|
||||
let iconUri = getLinkIconURI(aLink);
|
||||
if (!iconUri)
|
||||
return null;
|
||||
|
||||
// Extract the size type and width.
|
||||
let width = extractIconSize(aLink.sizes);
|
||||
|
||||
return {
|
||||
iconUri,
|
||||
width,
|
||||
isRichIcon: aIsRichIcon,
|
||||
type: aLink.type,
|
||||
node: aLink,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче