Bug 1504567 - Don't prematurely insert lazy tabs in customize mode. r=dao
authorOriol Brufau <oriol-bugzilla@hotmail.com>
Tue, 02 Apr 2019 12:58:40 +0000
changeset 468615 0c487b484577f639879f47bd7fdb2c7bab4713a4
parent 468614 bba6d1554446f902ce948c8700406c53a5f662de
child 468616 b58bc30029527864cb1b36658440e9242fa8524e
push id35843
push usernbeleuzu@mozilla.com
push dateTue, 09 Apr 2019 22:08:13 +0000
treeherdermozilla-central@a31032a16330 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1504567
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1504567 - Don't prematurely insert lazy tabs in customize mode. r=dao Differential Revision: https://phabricator.services.mozilla.com/D24657
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/test/browser.ini
browser/components/customizableui/test/browser_open_in_lazy_tab.js
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -184,17 +184,19 @@ CustomizeMode.prototype = {
       closeGlobalTab();
     }
 
     gTab = aTab;
 
     gTab.setAttribute("customizemode", "true");
     SessionStore.persistTabAttribute("customizemode");
 
-    gTab.linkedBrowser.stop();
+    if (gTab.linkedPanel) {
+      gTab.linkedBrowser.stop();
+    }
 
     let win = gTab.ownerGlobal;
 
     win.gBrowser.setTabTitle(gTab);
     win.gBrowser.setIcon(gTab,
                          "chrome://browser/skin/customize.svg");
 
     gTab.addEventListener("TabClose", unregisterGlobalTab);
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -168,16 +168,17 @@ tags = fullscreen
 [browser_synced_tabs_menu.js]
 [browser_backfwd_enabled_post_customize.js]
 [browser_check_tooltips_in_navbar.js]
 [browser_editcontrols_update.js]
 subsuite = clipboard
 [browser_customization_context_menus.js]
 [browser_newtab_button_customizemode.js]
 [browser_open_from_popup.js]
+[browser_open_in_lazy_tab.js]
 [browser_PanelMultiView_focus.js]
 [browser_reload_tab.js]
 [browser_sidebar_toggle.js]
 skip-if = verify
 [browser_tabbar_big_widgets.js]
 [browser_remote_tabs_button.js]
 skip-if = (verify && debug && (os == 'linux' || os == 'mac'))
 [browser_widget_animation.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_open_in_lazy_tab.js
@@ -0,0 +1,32 @@
+"use strict";
+
+/**
+ * Check that customize mode can be loaded in a lazy tab.
+ */
+add_task(async function open_customize_mode_in_lazy_tab() {
+  let tab = BrowserTestUtils.addTab(gBrowser, "about:blank", {createLazyBrowser: true});
+  gCustomizeMode.setTab(tab);
+
+  is(tab.linkedPanel, "", "Tab should be lazy");
+
+  let tabLoaded = new Promise((resolve) => {
+    gBrowser.addTabsProgressListener({async onLocationChange(aBrowser) {
+      if (tab.linkedBrowser == aBrowser) {
+        gBrowser.removeTabsProgressListener(this);
+        await Promise.resolve();
+        resolve();
+      }
+    }});
+  });
+  let customizePromise = BrowserTestUtils.waitForEvent(gNavToolbox, "customizationready");
+  gCustomizeMode.enter();
+  await customizePromise;
+  await tabLoaded;
+
+  is(tab.getAttribute("customizemode"), "true", "Tab should be in customize mode");
+
+  let customizationContainer = document.getElementById("customization-container");
+  is(customizationContainer.hidden, false, "Customization container should be visible");
+
+  await endCustomizing();
+});