Bug 962963 - Decouple tab expiration code r=margaret
authorMark Finkle <mfinkle@mozilla.com>
Fri, 24 Jan 2014 09:08:01 -0500
changeset 165109 4aed895b4946fedd564296d29dde4a143969be1a
parent 165108 ccadc22d570fccd976969e8e8f8c97cb276fd1bc
child 165110 2d7a30f6595519f2a368951943e03671ad6769f6
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmargaret
bugs962963
milestone29.0a1
Bug 962963 - Decouple tab expiration code r=margaret
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -772,25 +772,23 @@ var BrowserApp = {
     return this._selectedTab;
   },
 
   set selectedTab(aTab) {
     if (this._selectedTab == aTab)
       return;
 
     if (this._selectedTab) {
-      Tabs.touch(this._selectedTab);
       this._selectedTab.setActive(false);
     }
 
     this._selectedTab = aTab;
     if (!aTab)
       return;
 
-    Tabs.touch(aTab);
     aTab.setActive(true);
     aTab.setResolution(aTab._zoom, true);
     this.contentDocumentChanged();
     this.deck.selectedPanel = aTab.browser;
     // Focus the browser so that things like selection will be styled correctly.
     aTab.browser.focus();
   },
 
@@ -3046,16 +3044,18 @@ Tab.prototype = {
     this.savedArticle = null;
   },
 
   // This should be called to update the browser when the tab gets selected/unselected
   setActive: function setActive(aActive) {
     if (!this.browser || !this.browser.docShell)
       return;
 
+    this.lastTouchedAt = Date.now();
+
     if (aActive) {
       this.browser.setAttribute("type", "content-primary");
       this.browser.focus();
       this.browser.docShellIsActive = true;
       Reader.updatePageAction(this);
       ExternalApps.updatePageAction(this.browser.currentURI);
     } else {
       this.browser.setAttribute("type", "content-targetable");
@@ -8289,20 +8289,16 @@ var Tabs = {
         break;
       case "TabOpen":
         // Use opening a new tab as a trigger to expire the most stale tab.
         this.expireLruTab();
         break;
     }
   },
 
-  touch: function(aTab) {
-    aTab.lastTouchedAt = Date.now();
-  },
-
   // Manage the most-recently-used list of tabs. Each tab has a timestamp
   // associated with it that indicates when it was last touched.
   expireLruTab: function() {
     if (!this._enableTabExpiration) {
       return false;
     }
     let expireTimeMs = Services.prefs.getIntPref("browser.tabs.expireTime") * 1000;
     if (expireTimeMs < 0) {