Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 "use strict";
7 // Create a new window, then move the home button to the menu and check both windows have
8 // customizationchange events fire on the toolbox:
9 add_task(function() {
10 let newWindow = yield openAndLoadWindow();
11 let otherToolbox = newWindow.gNavToolbox;
13 let handlerCalledCount = 0;
14 let handler = (ev) => {
15 handlerCalledCount++;
16 };
18 let homeButton = document.getElementById("home-button");
20 gNavToolbox.addEventListener("customizationchange", handler);
21 otherToolbox.addEventListener("customizationchange", handler);
23 gCustomizeMode.addToPanel(homeButton);
25 is(handlerCalledCount, 2, "Should be called for both windows.");
27 // If the test is run in isolation and the panel has never been open,
28 // the button will be in the palette. Deal with this case:
29 if (homeButton.parentNode.id == "BrowserToolbarPalette") {
30 yield PanelUI.ensureReady();
31 isnot(homeButton.parentNode.id, "BrowserToolbarPalette", "Home button should now be in panel");
32 }
34 handlerCalledCount = 0;
35 gCustomizeMode.addToToolbar(homeButton);
36 is(handlerCalledCount, 2, "Should be called for both windows.");
38 gNavToolbox.removeEventListener("customizationchange", handler);
39 otherToolbox.removeEventListener("customizationchange", handler);
41 yield promiseWindowClosed(newWindow);
42 });
44 add_task(function asyncCleanup() {
45 yield resetCustomization();
46 });