Bug 1430153 - Warm up tabs in the Ctrl+Tab panel. r?mconley draft
authorDão Gottwald <dao@mozilla.com>
Fri, 12 Jan 2018 17:09:15 +0100
changeset 719678 7745af45211c9505984049aac0a5e9c6b1fa9f5a
parent 719593 d2edd256c3aadb1cea48da0c8f62f725bd53cb76
child 745868 6ddeb04ae1bb96475d8d05f6cc93bc42354ca53c
push id95333
push userdgottwald@mozilla.com
push dateFri, 12 Jan 2018 16:10:01 +0000
reviewersmconley
bugs1430153
milestone59.0a1
Bug 1430153 - Warm up tabs in the Ctrl+Tab panel. r?mconley MozReview-Commit-ID: IlXLt90MsrB
browser/base/content/browser-ctrlTab.js
--- a/browser/base/content/browser-ctrlTab.js
+++ b/browser/base/content/browser-ctrlTab.js
@@ -283,16 +283,20 @@ var ctrlTab = {
 
     if (this._selectedIndex == -1) {
       // Focus is already in the panel.
       this.previews[selectedIndex].focus();
     } else {
       this._selectedIndex = selectedIndex;
     }
 
+    if (this.previews[selectedIndex]._tab) {
+      gBrowser.warmupTab(this.previews[selectedIndex]._tab);
+    }
+
     if (this._timer) {
       clearTimeout(this._timer);
       this._timer = null;
       this._openPanel();
     }
   },
 
   _mouseOverFocus: function ctrlTab_mouseOverFocus(aPreview) {
@@ -343,16 +347,17 @@ var ctrlTab = {
   open: function ctrlTab_open() {
     if (this.isOpen)
       return;
 
     document.addEventListener("keyup", this, true);
 
     this.updatePreviews();
     this._selectedIndex = 1;
+    gBrowser.warmupTab(this.selected._tab);
 
     // Add a slight delay before showing the UI, so that a quick
     // "ctrl-tab" keypress just flips back to the MRU tab.
     this._timer = setTimeout(function(self) {
       self._timer = null;
       self._openPanel();
     }, 200, this);
   },