Backed out changeset e0ff6bf01a9f (bug 1521346) for TV and bc failure in browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js
authorshindli <shindli@mozilla.com>
Wed, 23 Jan 2019 07:22:25 +0200
changeset 514952 8dee9d61a77b4613be713577873eac447c1a5ece
parent 514951 519c1045b51e55ece9e463d38412fbf93a37a3d3
child 514953 66a5303cb9ddf8885275f600ccbd6aff1b336275
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1521346
milestone66.0a1
backs oute0ff6bf01a9f82c228a6890026d78c34a1bc95d9
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
Backed out changeset e0ff6bf01a9f (bug 1521346) for TV and bc failure in browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js
browser/base/content/tabbrowser.js
browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js
browser/components/extensions/parent/ext-tabs.js
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -2302,17 +2302,16 @@ window._gBrowser = {
     postData,
     preferredRemoteType,
     referrerPolicy,
     referrerURI,
     relatedToCurrent,
     sameProcessAsFrameLoader,
     skipAnimation,
     skipBackgroundNotify,
-    title,
     triggeringPrincipal,
     userContextId,
     recordExecution,
     replayExecution,
   } = {}) {
     // all callers of addTab that pass a params object need to pass
     // a valid triggeringPrincipal.
     if (!triggeringPrincipal) {
@@ -2547,23 +2546,16 @@ window._gBrowser = {
 
         if (lazyBrowserURI) {
           // Lazy browser must be explicitly registered so tab will appear as
           // a switch-to-tab candidate in autocomplete.
           this.UrlbarProviderOpenTabs.registerOpenTab(lazyBrowserURI.spec,
                                                       userContextId);
           b.registeredOpenURI = lazyBrowserURI;
         }
-        SessionStore.setTabState(t, {
-          entries: [{
-            url: lazyBrowserURI ? lazyBrowserURI.spec : "about:blank",
-            title,
-            triggeringPrincipal_base64: Utils.serializePrincipal(triggeringPrincipal),
-          }],
-        });
       } else {
         this._insertBrowser(t, true);
       }
     } catch (e) {
       Cu.reportError("Failed to create tab");
       Cu.reportError(e);
       t.remove();
       if (t.linkedBrowser) {
@@ -3808,47 +3800,42 @@ window._gBrowser = {
    */
   adoptTab(aTab, aIndex, aSelectTab) {
     // Swap the dropped tab with a new one we create and then close
     // it in the other window (making it seem to have moved between
     // windows). We also ensure that the tab we create to swap into has
     // the same remote type and process as the one we're swapping in.
     // This makes sure we don't get a short-lived process for the new tab.
     let linkedBrowser = aTab.linkedBrowser;
-    let createLazyBrowser = !aTab.linkedPanel;
     let params = {
       eventDetail: { adoptedTab: aTab },
       preferredRemoteType: linkedBrowser.remoteType,
       sameProcessAsFrameLoader: linkedBrowser.frameLoader,
       skipAnimation: true,
       index: aIndex,
-      createLazyBrowser,
-      allowInheritPrincipal: createLazyBrowser,
     };
 
     let numPinned = this._numPinnedTabs;
     if (aIndex < numPinned || (aTab.pinned && aIndex == numPinned)) {
       params.pinned = true;
     }
 
     if (aTab.hasAttribute("usercontextid")) {
       // new tab must have the same usercontextid as the old one
       params.userContextId = aTab.getAttribute("usercontextid");
     }
     let newTab = this.addWebTab("about:blank", params);
     let newBrowser = this.getBrowserForTab(newTab);
 
     aTab.parentNode._finishAnimateTabMove();
 
-    if (!createLazyBrowser) {
-      // Stop the about:blank load.
-      newBrowser.stop();
-      // Make sure it has a docshell.
-      newBrowser.docShell;
-    }
+    // Stop the about:blank load.
+    newBrowser.stop();
+    // Make sure it has a docshell.
+    newBrowser.docShell;
 
     if (!this.swapBrowsersAndCloseOther(newTab, aTab)) {
       // Swapping wasn't permitted. Bail out.
       this.removeTab(newTab);
       return null;
     }
 
     if (aSelectTab) {
--- a/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js
+++ b/browser/base/content/test/tabs/browser_multiselect_tabs_move_to_new_window_contextmenu.js
@@ -39,57 +39,8 @@ add_task(async function test() {
   is(gBrowser.visibleTabs.length, 2, "Two tabs now in the old window");
   is(gBrowser2.visibleTabs.length, 3, "Three tabs in the new window");
   is(gBrowser2.visibleTabs.indexOf(gBrowser2.selectedTab), 1,
     "Previously active tab is still the active tab in the new window");
 
   BrowserTestUtils.closeWindow(newWindow);
   BrowserTestUtils.removeTab(tab4);
 });
-
-add_task(async function testLazyTabs() {
-  let params = {createLazyBrowser: true};
-  let tabs = [];
-  let numTabs = 4;
-  for (let i = 0; i < numTabs; ++i) {
-    tabs.push(BrowserTestUtils.addTab(gBrowser, `http://example.com/?${i}`, params));
-  }
-
-  await BrowserTestUtils.switchTab(gBrowser, tabs[0]);
-  for (let i = 1; i < numTabs; ++i) {
-    await triggerClickOn(tabs[i], { ctrlKey: true });
-  }
-
-  isnot(tabs[0].linkedPanel, "", `Tab 0 shouldn't be lazy`);
-  for (let i = 1; i < numTabs; ++i) {
-    is(tabs[i].linkedPanel, "", `Tab ${i} should be lazy`);
-  }
-
-  is(gBrowser.multiSelectedTabsCount, numTabs, `${numTabs} multiselected tabs`);
-  for (let i = 0; i < numTabs; ++i) {
-    ok(tabs[i].multiselected, `Tab ${i} should be multiselected`);
-  }
-
-  let newWindow = gBrowser.replaceTabsWithWindow(tabs[0]);
-
-  await TestUtils.waitForCondition(() => newWindow.gBrowser, `Wait for gBrowser`);
-  await TestUtils.waitForCondition(() => newWindow.gBrowser.visibleTabs.length == numTabs,
-    `Wait for all ${numTabs} tabs to get moved to the new window`);
-  tabs = newWindow.gBrowser.tabs;
-
-  isnot(tabs[0].linkedPanel, "", `Tab 0 should continue not being lazy`);
-  // FIXME: bug 1521923 - First inactive tab to be moved into another window loses laziness
-  todo_is(tabs[1].linkedPanel, "", `Tab 1 should continue being lazy`);
-  for (let i = 2; i < numTabs; ++i) {
-    is(tabs[i].linkedPanel, "", `Tab ${i} should continue being lazy`);
-  }
-
-  is(tabs[0].linkedBrowser.currentURI.spec, `http://example.com/?0`,
-    `Tab 0 should have the right URL`);
-  todo_is(SessionStore.getLazyTabValue(tabs[1], "url"), `http://example.com/?1`,
-    `Tab 1 should have the right lazy URL`);
-  for (let i = 2; i < numTabs; ++i) {
-    is(SessionStore.getLazyTabValue(tabs[i], "url"), `http://example.com/?${i}`,
-      `Tab ${i} should have the right lazy URL`);
-  }
-
-  BrowserTestUtils.closeWindow(newWindow);
-});
--- a/browser/components/extensions/parent/ext-tabs.js
+++ b/browser/components/extensions/parent/ext-tabs.js
@@ -9,16 +9,18 @@ ChromeUtils.defineModuleGetter(this, "Ex
 ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
                                "resource://gre/modules/PrivateBrowsingUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "PromiseUtils",
                                "resource://gre/modules/PromiseUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "SessionStore",
                                "resource:///modules/sessionstore/SessionStore.jsm");
+ChromeUtils.defineModuleGetter(this, "Utils",
+                               "resource://gre/modules/sessionstore/Utils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "strBundle", function() {
   return Services.strings.createBundle("chrome://global/locale/extensions.properties");
 });
 
 var {
   ExtensionError,
 } = ExtensionUtils;
@@ -627,16 +629,25 @@ this.tabs = class extends ExtensionAPI {
               }
               options.createLazyBrowser = true;
             } else if (createProperties.title) {
               return Promise.reject({message: `Title may only be set for discarded tabs.`});
             }
 
             options.triggeringPrincipal = principal;
             let nativeTab = window.gBrowser.addTab(url, options);
+            if (createProperties.discarded) {
+              SessionStore.setTabState(nativeTab, {
+                entries: [{
+                  url: url,
+                  title: options.title,
+                  triggeringPrincipal_base64: Utils.serializePrincipal(principal),
+                }],
+              });
+            }
 
             if (active) {
               window.gBrowser.selectedTab = nativeTab;
               if (!createProperties.url) {
                 window.focusAndSelectUrlBar();
               }
             }