2010-11-16 05:06:18 -08:00
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
2011-11-12 03:06:54 -08:00
|
|
|
ignoreAllUncaughtExceptions();
|
2010-11-16 05:06:18 -08:00
|
|
|
|
2010-11-22 02:21:43 -08:00
|
|
|
testCustomize(window, finish);
|
2010-11-16 05:06:18 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
function testCustomize(aWindow, aCallback) {
|
|
|
|
var addonBar = aWindow.document.getElementById("addon-bar");
|
|
|
|
ok(addonBar, "got addon bar");
|
2010-11-22 02:21:43 -08:00
|
|
|
ok(!isElementVisible(addonBar), "addon bar initially hidden");
|
2010-11-16 05:06:18 -08:00
|
|
|
|
|
|
|
// Launch toolbar customization
|
|
|
|
// ctEl is either iframe that contains the customize sheet, or the dialog
|
|
|
|
var ctEl = aWindow.BrowserCustomizeToolbar();
|
|
|
|
|
|
|
|
aWindow.gNavToolbox.addEventListener("beforecustomization", function () {
|
|
|
|
aWindow.gNavToolbox.removeEventListener("beforecustomization", arguments.callee, false);
|
|
|
|
executeSoon(ctInit);
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
function ctInit() {
|
2010-11-22 02:21:43 -08:00
|
|
|
ok(isElementVisible(addonBar),
|
|
|
|
"add-on bar is visible during toolbar customization");
|
|
|
|
|
2010-11-16 05:06:18 -08:00
|
|
|
// Close toolbar customization
|
|
|
|
closeToolbarCustomization(aWindow, ctEl);
|
|
|
|
|
2010-11-22 02:21:43 -08:00
|
|
|
ok(!isElementVisible(addonBar),
|
|
|
|
"addon bar is hidden after toolbar customization");
|
2010-11-16 05:06:18 -08:00
|
|
|
|
|
|
|
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();
|
|
|
|
}
|