Bug 1347514 - Regression test. r?dao
MozReview-Commit-ID: 98EE9BUsVtz
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -143,12 +143,13 @@ skip-if = os == "linux" # crashing on Li
tags = fullscreen
skip-if = os == "mac"
[browser_1087303_button_preferences.js]
[browser_1089591_still_customizable_after_reset.js]
[browser_1096763_seen_widgets_post_reset.js]
[browser_1161838_inserted_new_default_buttons.js]
[browser_bootstrapped_custom_toolbar.js]
[browser_customizemode_contextmenu_menubuttonstate.js]
+[browser_exit_background_customize_mode.js]
[browser_panel_toggle.js]
[browser_switch_to_customize_mode.js]
[browser_synced_tabs_menu.js]
[browser_check_tooltips_in_navbar.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_exit_background_customize_mode.js
@@ -0,0 +1,36 @@
+"use strict";
+
+/**
+ * Tests that if customize mode is currently attached to a background
+ * tab, and that tab browses to a new location, that customize mode
+ * is detached from that tab.
+ */
+add_task(function* test_exit_background_customize_mode() {
+ let nonCustomizingTab = gBrowser.selectedTab;
+
+ Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
+ null,
+ "Should not have a tab marked as being the customize tab now.");
+
+ yield startCustomizing();
+ is(gBrowser.tabs.length, 2, "Should have 2 tabs");
+
+ let custTab = gBrowser.selectedTab;
+
+ let finishedCustomizing = BrowserTestUtils.waitForEvent(gNavToolbox, "aftercustomization");
+ yield BrowserTestUtils.switchTab(gBrowser, nonCustomizingTab);
+ yield finishedCustomizing;
+
+ custTab.linkedBrowser.loadURI("http://example.com");
+ yield BrowserTestUtils.browserLoaded(custTab.linkedBrowser);
+
+ Assert.equal(gBrowser.tabContainer.querySelector("tab[customizemode=true]"),
+ null,
+ "Should not have a tab marked as being the customize tab now.");
+
+ yield startCustomizing();
+ is(gBrowser.tabs.length, 3, "Should have 3 tabs now");
+
+ yield endCustomizing();
+ yield BrowserTestUtils.removeTab(custTab);
+});