Bug 1370035 - Remove pending tab optimization now that tabs are injected lazily. r=dao
authorMike Conley <mconley@mozilla.com>
Tue, 13 Jun 2017 16:48:08 -0400
changeset 363924 4180fb6074b11fa29119cdef6a90432be01f0036
parent 363923 70d524455cdaa4ef1ee2980f878ee50d9be69c1e
child 363925 f23dc18a0316fd3d2abf18cab056aa3ad2ef70c7
push id32029
push userarchaeopteryx@coole-files.de
push dateThu, 15 Jun 2017 08:54:25 +0000
treeherdermozilla-central@dced94de288a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs1370035
milestone56.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 1370035 - Remove pending tab optimization now that tabs are injected lazily. r=dao MozReview-Commit-ID: HTWVmFHtFv0
browser/base/content/tabbrowser.css
browser/components/sessionstore/SessionStore.jsm
browser/components/sessionstore/test/browser_background_tab_crash.js
--- a/browser/base/content/tabbrowser.css
+++ b/browser/base/content/tabbrowser.css
@@ -86,26 +86,16 @@ tabpanels {
 .closing-tabs-spacer {
   pointer-events: none;
 }
 
 .tabbrowser-tabs:not(:hover) > .tabbrowser-arrowscrollbox > .closing-tabs-spacer {
   transition: width .15s ease-out;
 }
 
-/**
- * Optimization for tabs that are restored lazily. We can save a good amount of
- * memory that to-be-restored tabs would otherwise consume simply by setting
- * their browsers to 'display: none' as that will prevent them from having to
- * create a presentation and the like.
- */
-browser[pending] {
-  display: none;
-}
-
 browser[blank],
 browser[pendingpaint] {
   opacity: 0;
 }
 
 tabbrowser[pendingpaint] {
   background-image: url(chrome://browser/skin/tabbrowser/pendingpaint.png);
   background-repeat: no-repeat;
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -3609,17 +3609,16 @@ var SessionStoreInternal = {
     // Ensure the index is in bounds.
     let activeIndex = (tabData.index || tabData.entries.length) - 1;
     activeIndex = Math.min(activeIndex, tabData.entries.length - 1);
     activeIndex = Math.max(activeIndex, 0);
 
     // Save the index in case we updated it above.
     tabData.index = activeIndex + 1;
 
-    browser.setAttribute("pending", "true");
     tab.setAttribute("pending", "true");
 
     // If we're restoring this tab, it certainly shouldn't be in
     // the ignored set anymore.
     this._crashedBrowsers.delete(browser.permanentKey);
 
     // Update the persistent tab state cache with |tabData| information.
     TabStateCache.update(browser, {
@@ -3723,20 +3722,16 @@ var SessionStoreInternal = {
     let uri = activePageData ? activePageData.url || null : null;
     if (loadArguments) {
       uri = loadArguments.uri;
       if (loadArguments.userContextId) {
         browser.setAttribute("usercontextid", loadArguments.userContextId);
       }
     }
 
-    // We have to mark this tab as restoring first, otherwise
-    // the "pending" attribute will be applied to the linked
-    // browser, which removes it from the display list. We cannot
-    // flip the remoteness of any browser that is not being displayed.
     this.markTabAsRestoring(aTab);
 
     // We need a new frameloader if we are reloading into a browser with a
     // grouped session history (as we don't support restoring into browsers
     // with grouped session histories directly).
     let newFrameloader =
       aOptions.newFrameloader || !!browser.frameLoader.groupedSHistory;
 
@@ -3798,17 +3793,16 @@ var SessionStoreInternal = {
     // Make sure that this tab is removed from the priority queue.
     TabRestoreQueue.remove(aTab);
 
     // Increase our internal count.
     this._tabsRestoringCount++;
 
     // Set this tab's state to restoring
     browser.__SS_restoreState = TAB_STATE_RESTORING;
-    browser.removeAttribute("pending");
     aTab.removeAttribute("pending");
   },
 
   /**
    * This _attempts_ to restore the next available tab. If the restore fails,
    * then we will attempt the next one.
    * There are conditions where this won't do anything:
    *   if we're in the process of quitting
@@ -4551,17 +4545,16 @@ var SessionStoreInternal = {
 
     // Keep the tab's previous state for later in this method
     let previousState = browser.__SS_restoreState;
 
     // The browser is no longer in any sort of restoring state.
     delete browser.__SS_restoreState;
 
     aTab.removeAttribute("pending");
-    browser.removeAttribute("pending");
 
     if (previousState == TAB_STATE_RESTORING) {
       if (this._tabsRestoringCount)
         this._tabsRestoringCount--;
     } else if (previousState == TAB_STATE_NEEDS_RESTORE) {
       // Make sure that the tab is removed from the list of tabs to restore.
       // Again, this is normally done in restoreTabContent, but that isn't being called
       // for this tab.
--- a/browser/components/sessionstore/test/browser_background_tab_crash.js
+++ b/browser/components/sessionstore/test/browser_background_tab_crash.js
@@ -93,17 +93,17 @@ async function crashBackgroundTabs(tabs)
   await Promise.all(remotenessChangePromises);
   await Promise.all(tabsRevived);
 
   // Both background tabs should now be in the pending restore
   // state.
   for (let tab of tabs) {
     Assert.ok(!tab.linkedBrowser.isRemoteBrowser, "tab is not remote");
     Assert.ok(!tab.linkedBrowser.hasAttribute("crashed"), "tab is not crashed");
-    Assert.ok(tab.linkedBrowser.hasAttribute("pending"), "tab is pending");
+    Assert.ok(tab.hasAttribute("pending"), "tab is pending");
   }
 }
 
 add_task(async function setup() {
   // We'll simplify by making sure we only ever one content process for this
   // test.
   await SpecialPowers.pushPrefEnv({ set: [[ "dom.ipc.processCount", 1 ]] });