--- a/browser/components/customizableui/PanelMultiView.jsm
+++ b/browser/components/customizableui/PanelMultiView.jsm
@@ -312,29 +312,30 @@ this.PanelMultiView = class {
* @param {panelview} view View to check, defaults to the currently active view.
* @return {Boolean}
*/
_canGoBack(view = this._currentSubView) {
return !!view.getAttribute("title");
}
setMainView(aNewMainView) {
+ if (this._mainView) {
+ if (!this.panelViews)
+ this._subViews.appendChild(this._mainView);
+ this._mainView.removeAttribute("mainview");
+ }
+ this._mainViewId = aNewMainView.id;
+ aNewMainView.setAttribute("mainview", "true");
if (this.panelViews) {
// If the new main view is not yet in the zeroth position, make sure it's
// inserted there.
if (aNewMainView.parentNode != this._viewStack && this._viewStack.firstChild != aNewMainView) {
this._viewStack.insertBefore(aNewMainView, this._viewStack.firstChild);
}
} else {
- if (this._mainView) {
- this._subViews.appendChild(this._mainView);
- this._mainView.removeAttribute("mainview");
- }
- this._mainViewId = aNewMainView.id;
- aNewMainView.setAttribute("mainview", "true");
this._mainViewContainer.appendChild(aNewMainView);
}
}
showMainView() {
if (this.panelViews) {
this.showSubView(this._mainViewId);
} else {