Backed out 2 changesets (bug 1442694) for breaking session restores on update a=backout
authorshindli <shindli@mozilla.com>
Tue, 26 Feb 2019 18:32:20 +0200
changeset 518912 4a87b6ac14c030bea86c2ccd5a9a48c0470a29dc
parent 518911 110ea2a7c3d4f34b5079c195f7ea57966748e6da
child 518957 2e02ffdb852e490a3467743fb91b2320721ff38c
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)
reviewersbackout
bugs1442694
milestone67.0a1
backs outf100f8631f78c50427ecd50f0dee4009d06ca4e1
7a20c79a0e1236116417ef0b317e065f4e274b9f
first release with
nightly linux32
4a87b6ac14c0 / 67.0a1 / 20190226163248 / files
nightly linux64
4a87b6ac14c0 / 67.0a1 / 20190226163248 / files
nightly mac
4a87b6ac14c0 / 67.0a1 / 20190226163248 / files
nightly win32
4a87b6ac14c0 / 67.0a1 / 20190226163248 / files
nightly win64
4a87b6ac14c0 / 67.0a1 / 20190226163248 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1442694) for breaking session restores on update a=backout Backed out changeset f100f8631f78 (bug 1442694) Backed out changeset 7a20c79a0e12 (bug 1442694)
browser/base/content/tabbrowser.css
browser/base/content/tabbrowser.js
browser/base/content/tabbrowser.xml
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
browser/modules/BrowserWindowTracker.jsm
--- a/browser/base/content/tabbrowser.css
+++ b/browser/base/content/tabbrowser.css
@@ -17,21 +17,16 @@
 .tab-throbber:not([busy]),
 .tab-icon-sound:not([soundplaying]):not([muted]):not([activemedia-blocked]),
 .tab-icon-sound[pinned],
 .tab-sharing-icon-overlay,
 .tab-icon-overlay {
   display: none;
 }
 
-.tab-icon-pending[preopened],
-.tab-icon-image[preopened] {
-  visibility: hidden;
-}
-
 .tab-sharing-icon-overlay[sharing]:not([selected]),
 .tab-icon-overlay[soundplaying][pinned],
 .tab-icon-overlay[muted][pinned],
 .tab-icon-overlay[activemedia-blocked][pinned],
 .tab-icon-overlay[crashed] {
   display: -moz-box;
 }
 
--- a/browser/base/content/tabbrowser.js
+++ b/browser/base/content/tabbrowser.js
@@ -27,17 +27,16 @@ window._gBrowser = {
     Services.els.addSystemEventListener(document, "keydown", this, false);
     if (AppConstants.platform == "macosx") {
       Services.els.addSystemEventListener(document, "keypress", this, false);
     }
     window.addEventListener("sizemodechange", this);
     window.addEventListener("occlusionstatechange", this);
 
     this._setupInitialBrowserAndTab();
-    this._preopenPinnedTabs();
 
     if (Services.prefs.getBoolPref("browser.display.use_system_colors")) {
       this.tabpanels.style.backgroundColor = "-moz-default-background-color";
     } else if (Services.prefs.getIntPref("browser.display.document_color_use") == 2) {
       this.tabpanels.style.backgroundColor =
         Services.prefs.getCharPref("browser.display.background_color");
     }
 
@@ -379,39 +378,16 @@ window._gBrowser = {
     let filter = Cc["@mozilla.org/appshell/component/browser-status-filter;1"]
                   .createInstance(Ci.nsIWebProgress);
     filter.addProgressListener(tabListener, Ci.nsIWebProgress.NOTIFY_ALL);
     this._tabListeners.set(tab, tabListener);
     this._tabFilters.set(tab, filter);
     browser.webProgress.addProgressListener(filter, Ci.nsIWebProgress.NOTIFY_ALL);
   },
 
-  _preopenPinnedTabs() {
-    let numPinnedTabs = 0;
-    let windows = browserWindows();
-    windows.getNext();
-    let isOnlyWindow = !windows.hasMoreElements();
-    if (isOnlyWindow) {
-      numPinnedTabs = Services.prefs.getIntPref("browser.tabs.firstWindowRestore.numPinnedTabs", 0);
-    }
-
-    for (let i = 0; i < numPinnedTabs; i++) {
-      let tab = this.addTrustedTab("about:blank", {
-        skipAnimation: true,
-        noInitialLabel: true,
-        skipBackgroundNotify: true,
-        createLazyBrowser: true,
-        pinned: true,
-        isForFirstWindowRestore: true,
-      });
-
-      tab.setAttribute("preopened", "true");
-    }
-  },
-
   /**
    * BEGIN FORWARDED BROWSER PROPERTIES.  IF YOU ADD A PROPERTY TO THE BROWSER ELEMENT
    * MAKE SURE TO ADD IT HERE AS WELL.
    */
   get canGoBack() {
     return this.selectedBrowser.canGoBack;
   },
 
@@ -612,66 +588,46 @@ window._gBrowser = {
   },
 
   _updateTabBarForPinnedTabs() {
     this.tabContainer._unlockTabSizing();
     this.tabContainer._positionPinnedTabs();
     this.tabContainer._updateCloseButtons();
   },
 
-  _sendPinnedTabContentMessage(aTab) {
+  _notifyPinnedStatus(aTab) {
     this.getBrowserForTab(aTab).messageManager.sendAsyncMessage("Browser:AppTab", { isAppTab: aTab.pinned });
-  },
-
-  _notifyPinnedStatus(aTab, aDeferContentMessage = false) {
-    if (!aDeferContentMessage) {
-      this._sendPinnedTabContentMessage(aTab);
-    }
 
     let event = document.createEvent("Events");
     event.initEvent(aTab.pinned ? "TabPinned" : "TabUnpinned", true, false);
     aTab.dispatchEvent(event);
   },
 
-  _maybeUpdateNumPinnedTabsPref() {
-    if (BrowserWindowTracker.getTopWindow() == window) {
-      Services.prefs.setIntPref("browser.tabs.firstWindowRestore.numPinnedTabs",
-                                this._numPinnedTabs);
-    }
-  },
-
-  activatePreopenedPinnedTab(aTab) {
-    this._insertBrowser(aTab);
-    this._sendPinnedTabContentMessage(aTab);
-  },
-
   pinTab(aTab) {
     if (aTab.pinned)
       return;
 
     if (aTab.hidden)
       this.showTab(aTab);
 
     this.moveTabTo(aTab, this._numPinnedTabs);
     aTab.setAttribute("pinned", "true");
     this._updateTabBarForPinnedTabs();
     this._notifyPinnedStatus(aTab);
-    this._maybeUpdateNumPinnedTabsPref();
   },
 
   unpinTab(aTab) {
     if (!aTab.pinned)
       return;
 
     this.moveTabTo(aTab, this._numPinnedTabs - 1);
     aTab.removeAttribute("pinned");
     aTab.style.marginInlineStart = "";
     this._updateTabBarForPinnedTabs();
     this._notifyPinnedStatus(aTab);
-    this._maybeUpdateNumPinnedTabsPref();
   },
 
   previewTab(aTab, aCallback) {
     let currentTab = this.selectedTab;
     try {
       // Suppress focus, ownership and selected tab changes
       this._previewMode = true;
       this.selectedTab = aTab;
@@ -2335,17 +2291,16 @@ window._gBrowser = {
     bulkOrderedOpen,
     charset,
     createLazyBrowser,
     eventDetail,
     focusUrlBar,
     forceNotRemote,
     fromExternal,
     index,
-    isForFirstWindowRestore,
     lazyTabTitle,
     name,
     nextTabParentId,
     noInitialLabel,
     noReferrer,
     opener,
     openerBrowser,
     originPrincipal,
@@ -2519,19 +2474,16 @@ window._gBrowser = {
       if (tabAfter) {
         this._updateTabsAfterInsert();
       } else {
         t._tPos = index;
       }
 
       if (pinned) {
         this._updateTabBarForPinnedTabs();
-        if (!isForFirstWindowRestore) {
-          this._maybeUpdateNumPinnedTabsPref();
-        }
       }
       this.tabContainer._setPositionalAttributes();
 
       TabBarVisibility.update();
 
       // If we don't have a preferred remote type, and we have a remote
       // opener, use the opener's remote type.
       if (!preferredRemoteType && openerBrowser) {
@@ -2601,25 +2553,23 @@ 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;
         }
-        if (!isForFirstWindowRestore) {
-          SessionStore.setTabState(t, {
-            entries: [{
-              url: lazyBrowserURI ? lazyBrowserURI.spec : "about:blank",
-              title: lazyTabTitle,
-              triggeringPrincipal_base64: E10SUtils.serializePrincipal(triggeringPrincipal),
-            }],
-          });
-        }
+        SessionStore.setTabState(t, {
+          entries: [{
+            url: lazyBrowserURI ? lazyBrowserURI.spec : "about:blank",
+            title: lazyTabTitle,
+            triggeringPrincipal_base64: E10SUtils.serializePrincipal(triggeringPrincipal),
+          }],
+        });
       } else {
         this._insertBrowser(t, true);
       }
     } catch (e) {
       Cu.reportError("Failed to create tab");
       Cu.reportError(e);
       t.remove();
       if (t.linkedBrowser) {
@@ -2647,19 +2597,17 @@ window._gBrowser = {
       if (!aURIObject ||
           (doGetProtocolFlags(aURIObject) & URI_INHERITS_SECURITY_CONTEXT)) {
         b.createAboutBlankContentViewer(originPrincipal);
       }
     }
 
     // If we didn't swap docShells with a preloaded browser
     // then let's just continue loading the page normally.
-    if (!usingPreloadedContent &&
-        !createLazyBrowser &&
-        (!uriIsAboutBlank || !allowInheritPrincipal)) {
+    if (!usingPreloadedContent && (!uriIsAboutBlank || !allowInheritPrincipal)) {
       // pretend the user typed this so it'll be available till
       // the document successfully loads
       if (aURI && !gInitialPages.includes(aURI)) {
         b.userTypedValue = aURI;
       }
 
       let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
       if (allowThirdPartyFixup) {
@@ -2702,17 +2650,17 @@ window._gBrowser = {
       requestAnimationFrame(function() {
         // kick the animation off
         t.setAttribute("fadein", "true");
       });
     }
 
     // Additionally send pinned tab events
     if (pinned) {
-      this._notifyPinnedStatus(t, isForFirstWindowRestore);
+      this._notifyPinnedStatus(t);
     }
 
     return t;
   },
 
   moveTabsToStart(contextTab) {
     let tabs = contextTab.multiselected ?
       this.selectedTabs :
@@ -3200,20 +3148,18 @@ window._gBrowser = {
     if (aTab.hidden)
       this.tabContainer._updateHiddenTabsStatus();
 
     // ... and fix up the _tPos properties immediately.
     for (let i = aTab._tPos; i < this.tabs.length; i++)
       this.tabs[i]._tPos = i;
 
     if (!this._windowIsClosing) {
-      if (wasPinned) {
+      if (wasPinned)
         this.tabContainer._positionPinnedTabs();
-        this._maybeUpdateNumPinnedTabsPref();
-      }
 
       // update tab close buttons state
       this.tabContainer._updateCloseButtons();
 
       setTimeout(function(tabs) {
         tabs._lastTabClosedByMouse = false;
       }, 0, this.tabContainer);
     }
@@ -3888,16 +3834,17 @@ window._gBrowser = {
     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")) {
@@ -5064,17 +5011,16 @@ class TabProgressListener {
           // remoteness or is a new tab/window).
           this.mBrowser.urlbarChangeTracker.startedLoad();
         }
         delete this.mBrowser.initialPageLoadedFromUserAction;
         // If the browser is loading it must not be crashed anymore
         this.mTab.removeAttribute("crashed");
       }
 
-      this.mTab.removeAttribute("preopened");
       if (this._shouldShowProgress(aRequest)) {
         if (!(aStateFlags & Ci.nsIWebProgressListener.STATE_RESTORING) &&
             aWebProgress && aWebProgress.isTopLevel) {
           this.mTab.setAttribute("busy", "true");
           gBrowser._tabAttrModified(this.mTab, ["busy"]);
           this.mTab._notselectedsinceload = !this.mTab.selected;
           gBrowser.syncThrobberAnimations(this.mTab);
         }
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -1932,20 +1932,20 @@
                   anonid="tab-loading-burst"
                   class="tab-loading-burst"/>
         <xul:hbox xbl:inherits="pinned,selected=visuallyselected,titlechanged,attention"
                   class="tab-content" align="center">
           <xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected"
                     anonid="tab-throbber"
                     class="tab-throbber"
                     layer="true"/>
-          <xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected,pendingicon,preopened"
+          <xul:hbox xbl:inherits="fadein,pinned,busy,progress,selected=visuallyselected,pendingicon"
                     anonid="tab-icon-pending"
                     class="tab-icon-pending"/>
-          <xul:image xbl:inherits="src=image,triggeringprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing,preopened"
+          <xul:image xbl:inherits="src=image,triggeringprincipal=iconloadingprincipal,requestcontextid,fadein,pinned,selected=visuallyselected,busy,crashed,sharing"
                      anonid="tab-icon-image"
                      class="tab-icon-image"
                      validate="never"
                      role="presentation"/>
           <xul:image xbl:inherits="sharing,selected=visuallyselected,pinned"
                      anonid="sharing-icon"
                      class="tab-sharing-icon-overlay"
                      role="presentation"/>
--- 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);
@@ -726,17 +726,16 @@ var SessionStoreInternal = {
 
     this._max_tabs_undo = this._prefBranch.getIntPref("sessionstore.max_tabs_undo");
     this._prefBranch.addObserver("sessionstore.max_tabs_undo", this, true);
 
     this._max_windows_undo = this._prefBranch.getIntPref("sessionstore.max_windows_undo");
     this._prefBranch.addObserver("sessionstore.max_windows_undo", this, true);
 
     this._restore_on_demand = this._prefBranch.getBoolPref("sessionstore.restore_on_demand");
-    this._restore_pinned_tabs_on_demand = this._prefBranch.getBoolPref("sessionstore.restore_pinned_tabs_on_demand");
     this._prefBranch.addObserver("sessionstore.restore_on_demand", this, true);
 
     gResistFingerprintingEnabled = Services.prefs.getBoolPref("privacy.resistFingerprinting");
     Services.prefs.addObserver("privacy.resistFingerprinting", this);
   },
 
   /**
    * Called on application shutdown, after notifications:
@@ -2495,25 +2494,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);
@@ -3202,17 +3198,16 @@ var SessionStoreInternal = {
     } catch (e) {}
 
     // Start the throbber to pretend we're doing something while actually
     // waiting for data from the frame script. This throbber is disabled
     // if the URI is a local about: URI.
     if (!uriObj || (uriObj && !window.gBrowser.isLocalAboutURI(uriObj))) {
       tab.setAttribute("busy", "true");
     }
-    tab.removeAttribute("preopened");
 
     // Hack to ensure that the about:home, about:newtab, and about:welcome
     // favicon is loaded instantaneously, to avoid flickering and improve
     // perceived performance.
     window.gBrowser.setDefaultIcon(tab, uriObj);
 
     TAB_STATE_FOR_BROWSER.set(tab.linkedBrowser, TAB_STATE_WILL_RESTORE);
 
@@ -3650,29 +3645,26 @@ var SessionStoreInternal = {
 
     // disable smooth scrolling while adding, moving, removing and selecting tabs
     let arrowScrollbox = tabbrowser.tabContainer.arrowScrollbox;
     let smoothScroll = arrowScrollbox.smoothScroll;
     arrowScrollbox.smoothScroll = false;
 
     // We need to keep track of the initially open tabs so that they
     // can be moved to the end of the restored tabs.
-    let initialTabs = [];
+    let initialTabs;
     if (!overwriteTabs && firstWindow) {
       initialTabs = Array.slice(tabbrowser.tabs);
     }
 
     // Get rid of tabs that aren't needed anymore.
     if (overwriteTabs) {
       for (let i = tabbrowser.browsers.length - 1; i >= 0; i--) {
-        if (!tabbrowser.tabs[i].selected &&
-            !tabbrowser.tabs[i].hasAttribute("preopened")) {
+        if (!tabbrowser.tabs[i].selected) {
           tabbrowser.removeTab(tabbrowser.tabs[i]);
-        } else if (tabbrowser.tabs[i].hasAttribute("preopened")) {
-          initialTabs.push(tabbrowser.tabs[i]);
         }
       }
     }
 
     let restoreTabsLazily = this._prefBranch.getBoolPref("sessionstore.restore_tabs_lazily") && this._restore_on_demand;
 
     for (var t = 0; t < newTabCount; t++) {
       let tabData = winData.tabs[t];
@@ -3681,34 +3673,23 @@ var SessionStoreInternal = {
       let select = t == selectTab - 1;
       let tab;
 
       // Re-use existing selected tab if possible to avoid the overhead of
       // selecting a new tab.
       if (select &&
           tabbrowser.selectedTab.userContextId == userContextId) {
         tab = tabbrowser.selectedTab;
-        if (tab.pinned && !tabData.pinned) {
+        if (!tabData.pinned) {
           tabbrowser.unpinTab(tab);
-        } else if (!tab.pinned && tabData.pinned) {
-          tabbrowser.removeTab(tabbrowser.tabs[t]);
-          tabbrowser.pinTab(tab);
-          tabbrowser.moveTabTo(tab, t);
         }
-
         tabbrowser.moveTabToEnd();
         if (aWindow.gMultiProcessBrowser && !tab.linkedBrowser.isRemoteBrowser) {
           tabbrowser.updateBrowserRemoteness(tab.linkedBrowser, true);
         }
-      } else if (tabData.pinned &&
-          tabbrowser.tabs[t] &&
-          tabbrowser.tabs[t].pinned &&
-          !tabbrowser.tabs[t].linkedPanel) {
-        tab = tabbrowser.tabs[t];
-        tabbrowser.activatePreopenedPinnedTab(tab);
       }
 
       // Add a new tab if needed.
       if (!tab) {
         let createLazyBrowser = restoreTabsLazily && !select && !tabData.pinned;
 
         let url = "about:blank";
         if (createLazyBrowser && tabData.entries && tabData.entries.length) {
@@ -3747,24 +3728,21 @@ var SessionStoreInternal = {
       }
 
       if (tabData.pinned) {
         tabbrowser.pinTab(tab);
       }
     }
 
     // Move the originally open tabs to the end.
-    let endPosition = tabbrowser.tabs.length - 1;
-    for (let tab of initialTabs) {
-      if (tab.hasAttribute("preopened") &&
-          !tab.linkedPanel) {
-        tabbrowser.removeTab(tab);
-      } else if (!tab.hasAttribute("preopened")) {
-        tabbrowser.unpinTab(tab);
-        tabbrowser.moveTabTo(tab, endPosition);
+    if (initialTabs) {
+      let endPosition = tabbrowser.tabs.length - 1;
+      for (let i = 0; i < initialTabs.length; i++) {
+        tabbrowser.unpinTab(initialTabs[i]);
+        tabbrowser.moveTabTo(initialTabs[i], endPosition);
       }
     }
 
     // We want to correlate the window with data from the last session, so
     // assign another id if we have one. Otherwise clear so we don't do
     // anything with it.
     delete aWindow.__SS_lastSessionWindowID;
     if (winData.__lastSessionWindowID)
@@ -4015,19 +3993,16 @@ var SessionStoreInternal = {
     if (selectedIndex > -1) {
       this.restoreTab(tabbrowser.selectedTab, aTabData[selectedIndex]);
     }
 
     // Restore all tabs.
     for (let t = 0; t < aTabs.length; t++) {
       if (t != selectedIndex) {
         this.restoreTab(aTabs[t], aTabData[t]);
-        if (this._restore_pinned_tabs_on_demand) {
-          aTabs[t].removeAttribute("preopened");
-        }
       }
     }
   },
 
   // Restores the given tab state for a given tab.
   restoreTab(tab, tabData, options = {}) {
     let browser = tab.linkedBrowser;
 
--- 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;
--- a/browser/modules/BrowserWindowTracker.jsm
+++ b/browser/modules/BrowserWindowTracker.jsm
@@ -91,21 +91,16 @@ function _trackWindowOrder(window) {
 }
 
 function _untrackWindowOrder(window) {
   let idx = _trackedWindows.indexOf(window);
   if (idx >= 0)
     _trackedWindows.splice(idx, 1);
 }
 
-function _trackPinnedTabs(window) {
-  Services.prefs.setIntPref("browser.tabs.firstWindowRestore.numPinnedTabs",
-                            window.gBrowser._numPinnedTabs);
-}
-
 // Methods that impact a window. Put into single object for organization.
 var WindowHelper = {
   addWindow(window) {
     // Add event listeners
     TAB_EVENTS.forEach(function(event) {
       window.gBrowser.tabContainer.addEventListener(event, _handleEvent);
     });
     WINDOW_EVENTS.forEach(function(event) {
@@ -138,17 +133,16 @@ var WindowHelper = {
 
   onActivate(window) {
     // If this window was the last focused window, we don't need to do anything
     if (window == _trackedWindows[0])
       return;
 
     _untrackWindowOrder(window);
     _trackWindowOrder(window);
-    _trackPinnedTabs(window);
 
     _updateCurrentContentOuterWindowID(window.gBrowser.selectedBrowser);
   },
 };
 
 this.BrowserWindowTracker = {
   /**
    * Get the most recent browser window.