diff --git a/browser/components/customizableui/CustomizeMode.jsm b/browser/components/customizableui/CustomizeMode.jsm index c435c86ed032..0f142100c963 100644 --- a/browser/components/customizableui/CustomizeMode.jsm +++ b/browser/components/customizableui/CustomizeMode.jsm @@ -210,10 +210,7 @@ CustomizeMode.prototype = { return; } if (!gTab.selected) { - // This will force another .enter() to be called via the - // onlocationchange handler of the tabbrowser, so we return early. gTab.ownerGlobal.gBrowser.selectedTab = gTab; - return; } gTab.ownerGlobal.focus(); if (gTab.ownerDocument != this.document) { diff --git a/browser/components/customizableui/test/browser.ini b/browser/components/customizableui/test/browser.ini index 3bea51ae8dc2..03d0cf5803c8 100644 --- a/browser/components/customizableui/test/browser.ini +++ b/browser/components/customizableui/test/browser.ini @@ -147,4 +147,3 @@ skip-if = os == "mac" [browser_bootstrapped_custom_toolbar.js] [browser_customizemode_contextmenu_menubuttonstate.js] [browser_panel_toggle.js] -[browser_switch_to_customize_mode.js] diff --git a/browser/components/customizableui/test/browser_switch_to_customize_mode.js b/browser/components/customizableui/test/browser_switch_to_customize_mode.js deleted file mode 100644 index b6011fc2650b..000000000000 --- a/browser/components/customizableui/test/browser_switch_to_customize_mode.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; - -add_task(function*() { - yield startCustomizing(); - is(gBrowser.tabs.length, 2, "Should have 2 tabs"); - - let paletteKidCount = document.getElementById("customization-palette").childElementCount; - let nonCustomizingTab = gBrowser.tabContainer.querySelector("tab:not([customizemode=true])"); - let finishedCustomizing = BrowserTestUtils.waitForEvent(gNavToolbox, "aftercustomization"); - yield BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab); - yield finishedCustomizing; - - let startedCount = 0; - let handler = e => startedCount++; - gNavToolbox.addEventListener("customizationstarting", handler); - yield startCustomizing(); - CustomizableUI.removeWidgetFromArea("home-button"); - yield gCustomizeMode.reset().catch(e => { - ok(false, "Threw an exception trying to reset after making modifications in customize mode: " + e); - }); - - let newKidCount = document.getElementById("customization-palette").childElementCount; - is(newKidCount, paletteKidCount, "Should have just as many items in the palette as before."); - yield endCustomizing(); - is(startedCount, 1, "Should have only started once"); - let customizableToolbars = document.querySelectorAll("toolbar[customizable=true]:not([autohide=true])"); - for (let toolbar of customizableToolbars) { - ok(!toolbar.hasAttribute("customizing"), "Toolbar " + toolbar.id + " is no longer customizing"); - } - let menuitem = document.getElementById("PanelUI-customize"); - isnot(menuitem.getAttribute("label"), menuitem.getAttribute("exitLabel"), "Should have exited successfully"); -}); diff --git a/browser/components/customizableui/test/head.js b/browser/components/customizableui/test/head.js index 7d9fea44b92e..b4d09f864ada 100644 --- a/browser/components/customizableui/test/head.js +++ b/browser/components/customizableui/test/head.js @@ -191,7 +191,27 @@ function endCustomizing(aWindow=window) { aWindow.gNavToolbox.addEventListener("aftercustomization", onCustomizationEnds); aWindow.gCustomizeMode.exit(); - return deferredEndCustomizing.promise; + return deferredEndCustomizing.promise.then(function() { + let deferredLoadNewTab = Promise.defer(); + + //XXXgijs so some tests depend on this tab being about:blank. Make it so. + let newTabBrowser = aWindow.gBrowser.selectedBrowser; + newTabBrowser.stop(); + + // If we stop early enough, this might actually be about:blank. + if (newTabBrowser.currentURI.spec == "about:blank") { + return null; + } + + // Otherwise, make it be about:blank, and wait for that to be done. + function onNewTabLoaded(e) { + newTabBrowser.removeEventListener("load", onNewTabLoaded, true); + deferredLoadNewTab.resolve(); + } + newTabBrowser.addEventListener("load", onNewTabLoaded, true); + newTabBrowser.loadURI("about:blank"); + return deferredLoadNewTab.promise; + }); } function startCustomizing(aWindow=window) {