Bug 631662 - We are painting thumbnails while in the background [r=ian, a=blocking2.0:final+]
authorTim Taubert <tim.taubert@gmx.de>
Sat, 05 Feb 2011 10:06:41 +0100
changeset 61993 378f8ebcc920cae1a9574d0a69e396b7434b147f
parent 61992 20ffcaad9700b0add9cf1a91b38f2256d3622945
child 61994 5bf94fcd5115692b32da8c5aeecba23ef2f4ca71
push id18572
push userphilringnalda@gmail.com
push dateSat, 05 Feb 2011 23:43:13 +0000
treeherderautoland@5bf94fcd5115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian, blocking2.0
bugs631662
milestone2.0b12pre
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 631662 - We are painting thumbnails while in the background [r=ian, a=blocking2.0:final+]
browser/base/content/tabview/tabitems.js
browser/base/content/test/tabview/Makefile.in
browser/base/content/test/tabview/browser_tabview_bug631662.js
--- a/browser/base/content/tabview/tabitems.js
+++ b/browser/base/content/tabview/tabitems.js
@@ -701,16 +701,18 @@ TabItem.prototype = Utils.extend(new Ite
 
     $tab.addClass("front");
 
     let animateZoom = gPrefBranch.getBoolPref("animate_zoom");
     if (animateZoom) {
       // The scaleCheat of 2 here is a clever way to speed up the zoom-out
       // code. See getZoomTransform() below.
       let transform = this.getZoomTransform(2);
+      TabItems.pausePainting();
+
       $canvas.css({
         '-moz-transform': transform.transform,
         '-moz-transform-origin': transform.transformOrigin
       });
 
       $canvas.animate({ "-moz-transform": "scale(1.0)" }, {
         duration: 300,
         easing: 'cubic-bezier', // note that this is legal easing, even without parameters
@@ -1098,16 +1100,17 @@ let TabItems = {
 
    // ----------
    // Function: resumePainting
    // Undoes a call to <pausePainting>. For instance, if you called
    // pausePainting three times in a row, you'll need to call resumePainting
    // three times before TabItems will start updating thumbnails again.
    resumePainting: function TabItems_resumePainting() {
      this.paintingPaused--;
+     Utils.assert(this.paintingPaused > -1, "paintingPaused should not go below zero");
      if (!this.isPaintingPaused())
        this.startHeartbeat();
    },
 
   // ----------
   // Function: isPaintingPaused
   // Returns a boolean indicating whether painting
   // is paused or not.
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -103,16 +103,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug626525.js \
                  browser_tabview_bug627288.js \
                  browser_tabview_bug627736.js \
                  browser_tabview_bug628165.js \
                  browser_tabview_bug628270.js \
                  browser_tabview_bug629195.js \
                  browser_tabview_bug630102.js \
                  browser_tabview_bug630157.js \
+                 browser_tabview_bug631662.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
                  browser_tabview_multiwindow_search.js \
                  browser_tabview_orphaned_tabs.js \
                  browser_tabview_privatebrowsing.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug631662.js
@@ -0,0 +1,75 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  let cw;
+  let prefix;
+  let timestamp;
+
+  let storeTimestamp = function () {
+    timestamp = cw.TabItems._lastUpdateTime;
+  }
+
+  let checkTimestamp = function () {
+    is(timestamp, cw.TabItems._lastUpdateTime, prefix +
+       ": tabs were not updated");
+  }
+
+  let actionAddTab = function () {
+    storeTimestamp();
+    gBrowser.addTab("about:home");
+
+    afterAllTabsLoaded(function () {
+      checkTimestamp();
+      next();
+    });
+  }
+
+  let actionMoveTab = function () {
+    storeTimestamp();
+    gBrowser.moveTabTo(gBrowser.tabs[0], 1);
+    gBrowser.moveTabTo(gBrowser.tabs[1], 0);
+    checkTimestamp();
+    next();
+  }
+
+  let actionSelectTab = function () {
+    storeTimestamp();
+    gBrowser.selectedTab = gBrowser.tabs[1]
+    gBrowser.selectedTab = gBrowser.tabs[0]
+    checkTimestamp();
+    next();
+  }
+
+  let actionRemoveTab = function () {
+    storeTimestamp();
+    gBrowser.removeTab(gBrowser.tabs[1]);
+    checkTimestamp();
+    next();
+  }
+
+  let actions = [
+    {name: "add", func: actionAddTab},
+    {name: "move", func: actionMoveTab},
+    {name: "select", func: actionSelectTab},
+    {name: "remove", func: actionRemoveTab}
+  ];
+
+  let next = function () {
+    let action = actions.shift();
+
+    if (action) {
+      prefix = action.name;
+      action.func();
+    } else {
+      finish();
+    }
+  }
+
+  waitForExplicitFinish();
+
+  showTabView(function () {
+    cw = TabView.getContentWindow();
+    hideTabView(next);
+  });
+}