diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index 0b7f8791c7a..5407bcbd38d 100644
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3505,19 +3505,13 @@ function BrowserCustomizeToolbar()
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
if (gCustomizeSheet) {
- var sheetFrame = document.getElementById("customizeToolbarSheetIFrame");
- var panel = document.getElementById("customizeToolbarSheetPopup");
- sheetFrame.hidden = false;
+ let sheetFrame = document.createElement("iframe");
+ let panel = document.getElementById("customizeToolbarSheetPopup");
+ sheetFrame.id = "customizeToolbarSheetIFrame";
sheetFrame.toolbox = gNavToolbox;
sheetFrame.panel = panel;
-
- // The document might not have been loaded yet, if this is the first time.
- // If it is already loaded, reload it so that the onload initialization code
- // re-runs.
- if (sheetFrame.getAttribute("src") == customizeURL)
- sheetFrame.contentWindow.location.reload()
- else
- sheetFrame.setAttribute("src", customizeURL);
+ sheetFrame.setAttribute("style", panel.getAttribute("sheetstyle"));
+ panel.appendChild(sheetFrame);
// Open the panel, but make it invisible until the iframe has loaded so
// that the user doesn't see a white flash.
@@ -3526,6 +3520,9 @@ function BrowserCustomizeToolbar()
gNavToolbox.removeEventListener("beforecustomization", onBeforeCustomization, false);
panel.style.removeProperty("visibility");
}, false);
+
+ sheetFrame.setAttribute("src", customizeURL);
+
panel.openPopup(gNavToolbox, "after_start", 0, 0);
return sheetFrame.contentWindow;
} else {
@@ -3538,8 +3535,9 @@ function BrowserCustomizeToolbar()
function BrowserToolboxCustomizeDone(aToolboxChanged) {
if (gCustomizeSheet) {
- document.getElementById("customizeToolbarSheetIFrame").hidden = true;
document.getElementById("customizeToolbarSheetPopup").hidePopup();
+ let iframe = document.getElementById("customizeToolbarSheetIFrame");
+ iframe.parentNode.removeChild(iframe);
}
// Update global UI elements that may have been added or removed
diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul
index 4308c176fea..d27269677ce 100644
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -344,11 +344,8 @@
+ noautohide="true"
+ sheetstyle="&dialog.dimensions;"/>