Backed out changeset 13e27937167b (bug 497543)
authorTim Taubert <tim.taubert@gmx.de>
Fri, 20 Jan 2012 12:07:47 +0100
changeset 86176 43588ad492ac9f117d63f90210c7ab421783c0ce
parent 86175 f3cf8f1827a2da608e3ed76a1f64a1a520e3ab05
child 86177 97973b8c04be141e4d6a4cb253adbb7dc45af917
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs497543
milestone12.0a1
backs out13e27937167b8693fa4fe1b0f6d61746b5c12d4e
Backed out changeset 13e27937167b (bug 497543)
browser/base/content/browser-thumbnails.js
browser/base/content/browser.js
deleted file mode 100644
--- a/browser/base/content/browser-thumbnails.js
+++ /dev/null
@@ -1,119 +0,0 @@
-#ifdef 0
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-#endif
-
-/**
- * Keeps thumbnails of open web pages up-to-date.
- */
-let gBrowserThumbnails = {
-  _captureDelayMS: 2000,
-
-  /**
-   * Map of capture() timeouts assigned to their browsers.
-   */
-  _timeouts: null,
-
-  /**
-   * Cache for the PageThumbs module.
-   */
-  _pageThumbs: null,
-
-  /**
-   * List of tab events we want to listen for.
-   */
-  _tabEvents: ["TabClose", "TabSelect"],
-
-  init: function Thumbnails_init() {
-    gBrowser.addTabsProgressListener(this);
-
-    this._tabEvents.forEach(function (aEvent) {
-      gBrowser.tabContainer.addEventListener(aEvent, this, false);
-    }, this);
-
-    this._timeouts = new WeakMap();
-
-    XPCOMUtils.defineLazyModuleGetter(this, "_pageThumbs",
-      "resource:///modules/PageThumbs.jsm", "PageThumbs");
-  },
-
-  uninit: function Thumbnails_uninit() {
-    gBrowser.removeTabsProgressListener(this);
-
-    this._tabEvents.forEach(function (aEvent) {
-      gBrowser.tabContainer.removeEventListener(aEvent, this, false);
-    }, this);
-
-    this._timeouts = null;
-    this._pageThumbs = null;
-  },
-
-  handleEvent: function Thumbnails_handleEvent(aEvent) {
-    switch (aEvent.type) {
-      case "TabSelect":
-        this._delayedCapture(aEvent.target.linkedBrowser);
-        break;
-      case "TabClose": {
-        let browser = aEvent.target.linkedBrowser;
-        if (this._timeouts.has(browser)) {
-          clearTimeout(this._timeouts.get(browser));
-          this._timeouts.delete(browser);
-        }
-        break;
-      }
-    }
-  },
-
-  /**
-   * State change progress listener for all tabs.
-   */
-  onStateChange: function Thumbnails_onStateChange(aBrowser, aWebProgress,
-                                                   aRequest, aStateFlags, aStatus) {
-    if (aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
-        aStateFlags & Ci.nsIWebProgressListener.STATE_IS_NETWORK)
-      this._delayedCapture(aBrowser);
-  },
-
-  _capture: function Thumbnails_capture(aBrowser) {
-    if (this._shouldCapture(aBrowser)) {
-      let canvas = this._pageThumbs.capture(aBrowser.contentWindow);
-      this._pageThumbs.store(aBrowser.currentURI.spec, canvas);
-    }
-  },
-
-  _delayedCapture: function Thumbnails_delayedCapture(aBrowser) {
-    if (this._timeouts.has(aBrowser))
-      clearTimeout(this._timeouts.get(aBrowser));
-
-    let timeout = setTimeout(function () {
-      this._timeouts.delete(aBrowser);
-      this._capture(aBrowser);
-    }.bind(this), this._captureDelayMS);
-
-    this._timeouts.set(aBrowser, timeout);
-  },
-
-  _shouldCapture: function Thumbnails_shouldCapture(aBrowser) {
-    // There's no point in taking screenshot of loading pages.
-    if (aBrowser.docShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
-      return false;
-
-    // Don't take screenshots of about: pages.
-    if (aBrowser.currentURI.schemeIs("about"))
-      return false;
-
-    let channel = aBrowser.docShell.currentDocumentChannel;
-
-    try {
-      // If the channel is a nsIHttpChannel get its http status code.
-      let httpChannel = channel.QueryInterface(Ci.nsIHttpChannel);
-
-      // Continue only if we have a 2xx status code.
-      return Math.floor(httpChannel.responseStatus / 100) == 2;
-    } catch (e) {
-      // Not a http channel, we just assume a success status code.
-      return true;
-    }
-  }
-};
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -191,17 +191,16 @@ let gInitialPages = [
   "about:privatebrowsing",
   "about:sessionrestore"
 ];
 
 #include browser-fullZoom.js
 #include browser-places.js
 #include browser-tabPreviews.js
 #include browser-tabview.js
-#include browser-thumbnails.js
 
 #ifdef MOZ_SERVICES_SYNC
 #include browser-syncui.js
 #endif
 
 XPCOMUtils.defineLazyGetter(this, "Win7Features", function () {
 #ifdef XP_WIN
   const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
@@ -1695,17 +1694,16 @@ function delayedStartup(isLoadingBlank, 
   if (document.mozFullScreen)
     onMozFullScreenChange();
 
 #ifdef MOZ_SERVICES_SYNC
   // initialize the sync UI
   gSyncUI.init();
 #endif
 
-  gBrowserThumbnails.init();
   TabView.init();
 
   setUrlAndSearchBarWidthForConditionalForwardButton();
   window.addEventListener("resize", function resizeHandler(event) {
     if (event.target == window)
       setUrlAndSearchBarWidthForConditionalForwardButton();
   });
 
@@ -1817,17 +1815,16 @@ function BrowserShutdown() {
   } else {
     if (Win7Features)
       Win7Features.onCloseWindow();
 
     gPrefService.removeObserver(ctrlTab.prefName, ctrlTab);
     gPrefService.removeObserver(allTabs.prefName, allTabs);
     ctrlTab.uninit();
     TabView.uninit();
-    gBrowserThumbnails.uninit();
 
     try {
       FullZoom.destroy();
     }
     catch(ex) {
       Components.utils.reportError(ex);
     }