зеркало из https://github.com/mozilla/pjs.git
Bug 595076 - App tab icons should be updated when the tab's favicon becomes available; r=dietrich a=blocking-betaN+
This commit is contained in:
Родитель
6e34094a3f
Коммит
6105a5d01b
|
@ -1481,18 +1481,55 @@ let GroupItems = {
|
|||
_inited: false,
|
||||
_activeGroupItem: null,
|
||||
_activeOrphanTab: null,
|
||||
_cleanupFunctions: [],
|
||||
|
||||
// ----------
|
||||
// Function: init
|
||||
init: function GroupItems_init() {
|
||||
let self = this;
|
||||
|
||||
// setup attr modified handler, and prepare for its uninit
|
||||
function handleAttrModified(xulTab) {
|
||||
self._handleAttrModified(xulTab);
|
||||
}
|
||||
|
||||
AllTabs.register("attrModified", handleAttrModified);
|
||||
this._cleanupFunctions.push(function() {
|
||||
AllTabs.unregister("attrModified", handleAttrModified);
|
||||
});
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: uninit
|
||||
uninit : function GroupItems_uninit () {
|
||||
this._cleanupFunctions.forEach(function(func) {
|
||||
func();
|
||||
});
|
||||
|
||||
this._cleanupFunctions = [];
|
||||
|
||||
this.groupItems = null;
|
||||
},
|
||||
|
||||
// ----------
|
||||
// watch for icon changes on app tabs
|
||||
_handleAttrModified: function GroupItems__handleAttrModified(xulTab) {
|
||||
if (xulTab.ownerDocument.defaultView != gWindow || !xulTab.pinned)
|
||||
return;
|
||||
|
||||
let iconUrl = xulTab.image || Utils.defaultFaviconURL;
|
||||
this.groupItems.forEach(function(groupItem) {
|
||||
iQ(".appTabIcon", groupItem.$appTabTray).each(function(icon) {
|
||||
let $icon = iQ(icon);
|
||||
if ($icon.data("xulTab") != xulTab)
|
||||
return;
|
||||
|
||||
if (iconUrl != $icon.attr("src"))
|
||||
$icon.attr("src", iconUrl);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// ----------
|
||||
// Function: getNextID
|
||||
// Returns the next unused groupItem ID.
|
||||
|
|
Загрузка…
Ссылка в новой задаче