Bug 1634031, lazy load appmenu and extension notification panel by using a template r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D73389
This commit is contained in:
@@ -252,7 +252,7 @@ class ExtensionControlledPopup {
|
||||
|
||||
// Find the elements we need.
|
||||
let doc = win.document;
|
||||
let panel = doc.getElementById("extension-notification-panel");
|
||||
let panel = ExtensionControlledPopup._getAndMaybeCreatePanel(doc);
|
||||
let popupnotification = doc.getElementById(this.popupnotificationId);
|
||||
let urlBarWasFocused = win.gURLBar.focused;
|
||||
|
||||
@@ -323,7 +323,6 @@ class ExtensionControlledPopup {
|
||||
anchorButton = action || doc.getElementById("PanelUI-menu-button");
|
||||
}
|
||||
let anchor = anchorButton.icon;
|
||||
panel.hidden = false;
|
||||
popupnotification.show();
|
||||
panel.openPopup(anchor);
|
||||
}
|
||||
@@ -426,4 +425,14 @@ class ExtensionControlledPopup {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
static _getAndMaybeCreatePanel(doc) {
|
||||
// // Lazy load the extension-notification panel the first time we need to display it.
|
||||
let template = doc.getElementById("extensionNotificationTemplate");
|
||||
if (template) {
|
||||
template.replaceWith(template.content);
|
||||
}
|
||||
|
||||
return doc.getElementById("extension-notification-panel");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user