зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1536473 - ext-menu onWindowOpen handler should wait for SidebarUI to be fully initialized. r=mixedpuppy,Gijs
Differential Revision: https://phabricator.services.mozilla.com/D24034 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
50dc489a10
Коммит
6813669d75
|
@ -65,6 +65,12 @@ var SidebarUI = {
|
|||
_switcherArrow: null,
|
||||
_inited: false,
|
||||
|
||||
_initDeferred: PromiseUtils.defer(),
|
||||
|
||||
get promiseInitialized() {
|
||||
return this._initDeferred.promise;
|
||||
},
|
||||
|
||||
get initialized() {
|
||||
return this._inited;
|
||||
},
|
||||
|
@ -83,6 +89,8 @@ var SidebarUI = {
|
|||
});
|
||||
|
||||
this._inited = true;
|
||||
|
||||
this._initDeferred.resolve();
|
||||
},
|
||||
|
||||
uninit() {
|
||||
|
|
|
@ -983,7 +983,7 @@ const menuTracker = {
|
|||
gMenuBuilder.build(subject);
|
||||
},
|
||||
|
||||
onWindowOpen(window) {
|
||||
async onWindowOpen(window) {
|
||||
for (const id of menuTracker.menuIds) {
|
||||
const menu = window.document.getElementById(id);
|
||||
menu.addEventListener("popupshowing", menuTracker);
|
||||
|
@ -991,7 +991,10 @@ const menuTracker = {
|
|||
|
||||
const sidebarHeader = window.document.getElementById("sidebar-switcher-target");
|
||||
sidebarHeader.addEventListener("SidebarShown", menuTracker.onSidebarShown);
|
||||
if (window.SidebarUI.currentID === "viewBookmarksSidebar") {
|
||||
|
||||
await window.SidebarUI.promiseInitialized;
|
||||
|
||||
if (!window.closed && window.SidebarUI.currentID === "viewBookmarksSidebar") {
|
||||
menuTracker.onSidebarShown({currentTarget: sidebarHeader});
|
||||
}
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче