Backed out changeset 3bd9591627ce (bug 1442694)
authorDão Gottwald <dao@mozilla.com>
Thu, 07 Mar 2019 11:31:48 +0100
changeset 520780 0a6ad39a784aff0b69f7e02c7704ebe468eb8cf1
parent 520779 c923e07cf0ff04559568f8ef795709b047343a2c
child 520781 c83859672dbe4d96a6f26408eabb139033711d6c
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1442694
milestone67.0a1
backs out3bd9591627cebd542f3ba78648ef641dfd70e446
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 3bd9591627ce (bug 1442694)
browser/components/sessionstore/SessionStore.jsm
browser/components/sessionstore/test/browser.ini
browser/components/sessionstore/test/browser_preopened_apptabs.js
browser/components/sessionstore/test/head.js
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -244,18 +244,18 @@ var SessionStore = {
   setBrowserState: function ss_setBrowserState(aState) {
     SessionStoreInternal.setBrowserState(aState);
   },
 
   getWindowState: function ss_getWindowState(aWindow) {
     return SessionStoreInternal.getWindowState(aWindow);
   },
 
-  setWindowState: function ss_setWindowState(aWindow, aState, aOverwrite, aFirstWindow) {
-    SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite, aFirstWindow);
+  setWindowState: function ss_setWindowState(aWindow, aState, aOverwrite) {
+    SessionStoreInternal.setWindowState(aWindow, aState, aOverwrite);
   },
 
   getTabState: function ss_getTabState(aTab) {
     return SessionStoreInternal.getTabState(aTab);
   },
 
   setTabState: function ss_setTabState(aTab, aState) {
     SessionStoreInternal.setTabState(aTab, aState);
@@ -2495,25 +2495,22 @@ var SessionStoreInternal = {
     if (DyingWindowCache.has(aWindow)) {
       let data = DyingWindowCache.get(aWindow);
       return JSON.stringify({ windows: [data] });
     }
 
     throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
   },
 
-  setWindowState: function ssi_setWindowState(aWindow, aState, aOverwrite, aFirstWindow) {
+  setWindowState: function ssi_setWindowState(aWindow, aState, aOverwrite) {
     if (!aWindow.__SSi) {
       throw Components.Exception("Window is not tracked", Cr.NS_ERROR_INVALID_ARG);
     }
 
-    this.restoreWindows(aWindow, aState, {
-      overwriteTabs: aOverwrite,
-      firstWindow: aFirstWindow,
-    });
+    this.restoreWindows(aWindow, aState, {overwriteTabs: aOverwrite});
 
     // Notify of changes to closed objects.
     this._notifyOfClosedObjectsChange();
   },
 
   getTabState: function ssi_getTabState(aTab) {
     if (!aTab || !aTab.ownerGlobal) {
       throw Components.Exception("Need a valid tab", Cr.NS_ERROR_INVALID_ARG);
--- a/browser/components/sessionstore/test/browser.ini
+++ b/browser/components/sessionstore/test/browser.ini
@@ -108,17 +108,16 @@ support-files = file_formdata_password.h
 skip-if = (verify && (os == 'win' || os == 'mac'))
 [browser_global_store.js]
 [browser_history_persist.js]
 [browser_label_and_icon.js]
 [browser_merge_closed_tabs.js]
 [browser_old_favicon.js]
 [browser_page_title.js]
 [browser_pending_tabs.js]
-[browser_preopened_apptabs.js]
 [browser_privatetabs.js]
 [browser_purge_shistory.js]
 skip-if = e10s # Bug 1271024
 [browser_replace_load.js]
 [browser_restore_redirect.js]
 [browser_restore_cookies_noOriginAttributes.js]
 [browser_scrollPositions.js]
 [browser_scrollPositionsReaderMode.js]
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_preopened_apptabs.js
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-const PREF_RESTORE_ON_DEMAND = "browser.sessionstore.restore_on_demand";
-const PREF_NUM_PINNED_TABS = "browser.tabs.firstWindowRestore.numPinnedTabs";
-
-function muffleMainWindowType() {
-  let oldWinType = document.documentElement.getAttribute("windowtype");
-  // Check if we've already done this to allow calling multiple times:
-  if (oldWinType != "navigator:testrunner") {
-    // Make the main test window not count as a browser window any longer
-    document.documentElement.setAttribute("windowtype", "navigator:testrunner");
-
-    registerCleanupFunction(() => {
-      document.documentElement.setAttribute("windowtype", oldWinType);
-    });
-  }
-}
-
-registerCleanupFunction(function() {
-  Services.prefs.clearUserPref(PREF_NUM_PINNED_TABS);
-});
-
-add_task(async function testPrefSynced() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 3);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 3 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testPrefSyncedSelected() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 3);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 1 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testPrefTooHigh() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 5);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 3 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 5);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testPrefTooLow() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 1);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 3 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 1);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testPrefTooHighSelected() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 5);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 1 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 5);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
-
-add_task(async function testPrefTooLowSelected() {
-  Services.prefs.setIntPref(PREF_NUM_PINNED_TABS, 1);
-
-  let state = { windows: [{ tabs: [
-    { entries: [{ url: "http://example.org/#1", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#2", triggeringPrincipal_base64 }], pinned: true },
-    { entries: [{ url: "http://example.org/#3", triggeringPrincipal_base64 }], pinned: true },
-  ], selected: 1 }] };
-
-  muffleMainWindowType();
-  let win = await BrowserTestUtils.openNewBrowserWindow();
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 1);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 1);
-  await setWindowState(win, state, false, true);
-  Assert.equal([...win.gBrowser.tabs].filter(t => t.pinned).length, 3);
-  Assert.equal([...win.gBrowser.tabs].filter(t => !!t.linkedPanel).length, 4);
-  await BrowserTestUtils.closeWindow(win);
-});
--- a/browser/components/sessionstore/test/head.js
+++ b/browser/components/sessionstore/test/head.js
@@ -185,19 +185,18 @@ function promiseWindowRestored(win) {
   return new Promise(resolve => win.addEventListener("SSWindowRestored", resolve, {once: true}));
 }
 
 async function setBrowserState(state, win = window) {
   ss.setBrowserState(typeof state != "string" ? JSON.stringify(state) : state);
   await promiseWindowRestored(win);
 }
 
-async function setWindowState(win, state, overwrite = false, firstWindow = false) {
-  ss.setWindowState(win, typeof state != "string" ? JSON.stringify(state) : state,
-                    overwrite, firstWindow);
+async function setWindowState(win, state, overwrite = false) {
+  ss.setWindowState(win, typeof state != "string" ? JSON.stringify(state) : state, overwrite);
   await promiseWindowRestored(win);
 }
 
 /**
  * Wait for a content -> chrome message.
  */
 function promiseContentMessage(browser, name) {
   let mm = browser.messageManager;