Bug 1385630 fix extension sidebar restore after app update, r=Gijs

MozReview-Commit-ID: IR0UDJgrp58

--HG--
extra : rebase_source : 6bb066650a94c3991e05c72ff3fb28cdb0e5a021
This commit is contained in:
Shane Caraveo 2017-09-10 13:36:54 -07:00
Родитель 94dc2ab943
Коммит 73b473d1aa
2 изменённых файлов: 8 добавлений и 2 удалений

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

@ -235,6 +235,13 @@ var SidebarUI = {
// refers to no longer exists, so we should assume this sidebar
// panel has been uninstalled. (249883)
this._box.removeAttribute("sidebarcommand");
// On a startup in which the startup cache was invalidated (e.g. app update)
// extensions will not be started prior to delayedLoad, thus the
// sidebarcommand element will not exist yet. Store the commandID so
// extensions may reopen if necessary. A startup cache invalidation
// can be forced (for testing) by deleting compatibility.ini from the
// profile.
this.lastOpenedId = commandID;
}
},

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

@ -134,11 +134,10 @@ this.sidebarAction = class extends ExtensionAPI {
(evt, tab) => { this.updateWindow(tab.ownerGlobal); });
let install = this.extension.startupReason === "ADDON_INSTALL";
let upgrade = ["ADDON_UPGRADE", "ADDON_DOWNGRADE"].includes(this.extension.startupReason);
for (let window of windowTracker.browserWindows()) {
this.updateWindow(window);
let {SidebarUI} = window;
if (install || (upgrade && SidebarUI.lastOpenedId == this.id)) {
if (install || SidebarUI.lastOpenedId == this.id) {
SidebarUI.show(this.id);
}
}