Bug 599325 - Addon bar should be shown when customizing (r=mano, a=blocking)

This commit is contained in:
Dietrich Ayala 2010-11-16 20:06:18 +07:00
parent b3c91154cb
commit 59ade38bb2
3 changed files with 76 additions and 0 deletions

View File

@ -3432,6 +3432,12 @@ function BrowserCustomizeToolbar()
PlacesToolbarHelper.customizeStart();
BookmarksMenuButton.customizeStart();
let addonBar = document.getElementById("addon-bar");
if (addonBar.collapsed) {
addonBar.wasCollapsed = addonBar.collapsed;
addonBar.collapsed = false;
}
var customizeURL = "chrome://global/content/customizeToolbar.xul";
gCustomizeSheet = getBoolPref("toolbar.customization.usesheet", false);
@ -3490,6 +3496,12 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
PlacesToolbarHelper.customizeDone();
BookmarksMenuButton.customizeDone();
let addonBar = document.getElementById("addon-bar");
if (addonBar.wasCollapsed === true) {
addonBar.collapsed = true;
delete addonBar.wasCollapsed;
}
// The url bar splitter state is dependent on whether stop/reload
// and the location bar are combined, so we need this ordering
CombinedStopReload.init();

View File

@ -160,6 +160,7 @@ _BROWSER_FILES = \
browser_bug595507.js \
browser_bug596687.js \
browser_bug597218.js \
browser_bug599325.js \
browser_bug609700.js \
browser_contextSearchTabPosition.js \
browser_ctrlTab.js \

View File

@ -0,0 +1,63 @@
function test() {
waitForExplicitFinish();
// test the main (normal) browser window
testCustomize(window, testChromeless);
}
function testChromeless() {
// test a chromeless window
var newWin = openDialog("chrome://browser/content/", "_blank",
"chrome,dialog=no,toolbar=no", "about:blank");
ok(newWin, "got new window");
function runWindowTest() {
function finalize() {
newWin.removeEventListener("load", runWindowTest, false);
newWin.close();
finish();
}
testCustomize(newWin, finalize);
}
newWin.addEventListener("load", runWindowTest, false);
}
function testCustomize(aWindow, aCallback) {
var addonBar = aWindow.document.getElementById("addon-bar");
ok(addonBar, "got addon bar");
is(addonBar.collapsed, true, "addon bar initially disabled");
// Launch toolbar customization
// ctEl is either iframe that contains the customize sheet, or the dialog
var ctEl = aWindow.BrowserCustomizeToolbar();
is(addonBar.collapsed, false,
"file menu is not collapsed during toolbar customization");
aWindow.gNavToolbox.addEventListener("beforecustomization", function () {
aWindow.gNavToolbox.removeEventListener("beforecustomization", arguments.callee, false);
executeSoon(ctInit);
}, false);
function ctInit() {
// Close toolbar customization
closeToolbarCustomization(aWindow, ctEl);
is(addonBar.getAttribute("collapsed"), "true",
"addon bar is collapsed after toolbar customization");
if (aCallback)
aCallback();
}
}
function closeToolbarCustomization(aWindow, aCTWindow) {
// Force the cleanup code to be run now instead of onunload.
// This also hides the sheet on Mac.
aCTWindow.finishToolbarCustomization();
// On windows and linux, need to explicitly close the window.
if (!gCustomizeSheet)
aCTWindow.close();
}