Bug 1439358 - Part 7 - Close the main view synchronously before opening it in a different panel. r=Gijs

This also updates the AppMenu mozscreenshots module to work with the Photon main menu.

MozReview-Commit-ID: FciQH815F95
This commit is contained in:
Paolo Amadini
2018-02-22 11:25:10 +00:00
parent 265883cc33
commit 3480d5905c
3 changed files with 48 additions and 52 deletions

View File

@@ -336,15 +336,6 @@ const PanelUI = {
this._isReady = true;
},
/**
* Switch the panel to the main view if it's not already
* in that view.
*/
showMainView() {
this._ensureEventListenersAdded();
this.multiView.showMainView();
},
/**
* Switch the panel to the help view if it's not already
* in that view.
@@ -415,19 +406,11 @@ const PanelUI = {
tempPanel.classList.toggle("cui-widget-panelWithFooter",
viewNode.querySelector(".panel-subview-footer"));
// If the panelview is already selected in another PanelMultiView instance
// as a subview, make sure to properly hide it there.
let oldMultiView = viewNode.panelMultiView;
if (oldMultiView && oldMultiView.current == viewNode) {
await oldMultiView.showMainView();
}
let multiView = document.createElement("panelmultiview");
multiView.setAttribute("id", "customizationui-widget-multiview");
multiView.setAttribute("viewCacheId", "appMenu-viewCache");
multiView.setAttribute("mainViewId", viewNode.id);
multiView.setAttribute("ephemeral", true);
document.getElementById("appMenu-viewCache").appendChild(viewNode);
tempPanel.appendChild(multiView);
viewNode.classList.add("cui-widget-panelview");