Bug 1370035 - Remove pending tab optimization now that tabs are injected lazily. r=dao, a=lizzard
authorMike Conley <mconley@mozilla.com>
Tue, 13 Jun 2017 16:48:08 -0400
changeset 411654 5ee30fad7cb7f00d772d6314db0cfb42d041c3d4
parent 411653 9a675b46913409bfefa5dbb3f29e1eca44603912
child 411655 ee70f9647f29d132a7ef11c0dcf5ea8349ce36cf
push id7430
push userryanvm@gmail.com
push dateMon, 19 Jun 2017 14:17:03 +0000
treeherdermozilla-beta@be4a0ad5d6ca [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao, lizzard
bugs1370035
milestone55.0
Bug 1370035 - Remove pending tab optimization now that tabs are injected lazily. r=dao, a=lizzard 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 ]] });