Bug 1376973 - Part 1: Making the favicon of the allTabs menu obeys originAttributes and rename attribute 'iconLoadingPrincipal' to 'iconloadingprincipal'. r=arthuredelstein,dao

MozReview-Commit-ID: AqjIr7xkXs9

--HG--
extra : rebase_source : 2dc0a20df7fb8a105ff68105b8a7c7c81916f288
This commit is contained in:
Tim Huang 2017-10-20 09:19:57 +08:00
Родитель 64bb4e051b
Коммит ef781411f3
5 изменённых файлов: 13 добавлений и 11 удалений

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

@ -1010,14 +1010,14 @@
if (sizedIconUrl) {
if (!browser.mIconLoadingPrincipal ||
!browser.mIconLoadingPrincipal.equals(loadingPrincipal)) {
aTab.setAttribute("iconLoadingPrincipal",
aTab.setAttribute("iconloadingprincipal",
this.serializationHelper.serializeToString(loadingPrincipal));
aTab.setAttribute("requestcontextid", requestContextID);
browser.mIconLoadingPrincipal = loadingPrincipal;
}
aTab.setAttribute("image", sizedIconUrl);
} else {
aTab.removeAttribute("iconLoadingPrincipal");
aTab.removeAttribute("iconloadingprincipal");
delete browser.mIconLoadingPrincipal;
aTab.removeAttribute("image");
}
@ -7760,7 +7760,7 @@
anonid="tab-throbber"
class="tab-throbber"
layer="true"/>
<xul:image xbl:inherits="src=image,loadingprincipal=iconLoadingPrincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
<xul:image xbl:inherits="src=image,loadingprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
anonid="tab-icon-image"
class="tab-icon-image"
validate="never"
@ -8249,8 +8249,10 @@
if (aTab.hasAttribute("busy")) {
aMenuitem.setAttribute("busy", aTab.getAttribute("busy"));
aMenuitem.removeAttribute("iconloadingprincipal");
aMenuitem.removeAttribute("image");
} else {
aMenuitem.setAttribute("iconloadingprincipal", aTab.getAttribute("iconloadingprincipal"));
aMenuitem.setAttribute("image", aTab.getAttribute("image"));
aMenuitem.removeAttribute("busy");
}

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

@ -12,12 +12,12 @@ this.EXPORTED_SYMBOLS = ["TabAttributes"];
// 'muted' should not be accessed directly but handled by using the
// tab.linkedBrowser.audioMuted/toggleMuteAudio methods.
// 'pending' is used internal by sessionstore and managed accordingly.
// 'iconLoadingPrincipal' is same as 'image' that it should be handled by
// 'iconloadingprincipal' is same as 'image' that it should be handled by
// using the gBrowser.getIcon()/setIcon() methods.
// 'activemedia-blocked' should not be accessed directly but handled by using
// tab's toggleMuteAudio() or linkedBrowser's methods
// activeMediaBlockStarted()/activeMediaBlockBlockStopped().
const ATTRIBUTES_TO_SKIP = new Set(["image", "muted", "pending", "iconLoadingPrincipal",
const ATTRIBUTES_TO_SKIP = new Set(["image", "muted", "pending", "iconloadingprincipal",
"skipbackgroundnotify", "activemedia-blocked"]);
// A set of tab attributes to persist. We will read a given list of tab

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

@ -30,9 +30,9 @@ add_task(async function test() {
return gBrowser.getIcon(tab) != null;
}, "wait for favicon load to finish", 100, 5);
// Check that the tab has 'image' and 'iconLoadingPrincipal' attributes.
// Check that the tab has 'image' and 'iconloadingprincipal' attributes.
ok(tab.hasAttribute("image"), "tab.image exists");
ok(tab.hasAttribute("iconLoadingPrincipal"), "tab.iconLoadingPrincipal exists");
ok(tab.hasAttribute("iconloadingprincipal"), "tab.iconloadingprincipal exists");
tab.toggleMuteAudio();
// Check that the tab has a 'muted' attribute.
@ -45,11 +45,11 @@ add_task(async function test() {
// Make sure we do not persist 'image','muted' and 'activemedia-blocked' attributes.
ss.persistTabAttribute("image");
ss.persistTabAttribute("muted");
ss.persistTabAttribute("iconLoadingPrincipal");
ss.persistTabAttribute("iconloadingprincipal");
ss.persistTabAttribute("activemedia-blocked");
let {attributes} = JSON.parse(ss.getTabState(tab));
ok(!("image" in attributes), "'image' attribute not saved");
ok(!("iconLoadingPrincipal" in attributes), "'iconLoadingPrincipal' attribute not saved");
ok(!("iconloadingprincipal" in attributes), "'iconloadingprincipal' attribute not saved");
ok(!("muted" in attributes), "'muted' attribute not saved");
ok(!("custom" in attributes), "'custom' attribute not saved");
ok(!("activemedia-blocked" in attributes), "'activemedia-blocked' attribute not saved");

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

@ -41,7 +41,7 @@ add_task(async function test_label_and_icon() {
let serhelper = Cc["@mozilla.org/network/serialization-helper;1"]
.getService(Ci.nsISerializationHelper);
let serializedPrincipal = tab.getAttribute("iconLoadingPrincipal");
let serializedPrincipal = tab.getAttribute("iconloadingprincipal");
let iconLoadingPrincipal = serhelper.deserializeObject(serializedPrincipal)
.QueryInterface(Ci.nsIPrincipal);
is(iconLoadingPrincipal.origin, "about:robots", "correct loadingPrincipal used");

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

@ -214,7 +214,7 @@
<content>
<xul:hbox class="menu-iconic-left" align="center" pack="center"
xbl:inherits="selected,_moz-menuactive,disabled,checked">
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,validate,src"/>
<xul:image class="menu-iconic-icon" xbl:inherits="src=image,loadingprincipal=iconloadingprincipal,validate,src"/>
</xul:hbox>
<xul:label class="menu-iconic-text" flex="1" xbl:inherits="value=label,accesskey,crop,highlightable" crop="right"/>
<xul:label class="menu-iconic-highlightable-text" xbl:inherits="xbl:text=label,crop,accesskey,highlightable" crop="right"/>