Bug 648882 - TabPriorityQueue updates tabItems when UI is busy [f=raymond, r=ian]
☠☠ backed out by 53339e6932c3 ☠ ☠
authorTim Taubert <tim.taubert@gmx.de>
Thu, 14 Apr 2011 15:33:52 +0200
changeset 68170 b1fc69fab8b2a08ec85025a5e6e16d9fa76a7a31
parent 68169 6726b03c2b25f591f8e580283fc49640943fde7d
child 68171 91e04bb4308f48861b1484b421d3e824f6a5df87
push id19528
push usereakhgari@mozilla.com
push dateFri, 15 Apr 2011 13:35:33 +0000
treeherdermozilla-central@754e793c647e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian
bugs648882
milestone6.0a1
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 648882 - TabPriorityQueue updates tabItems when UI is busy [f=raymond, r=ian]
browser/base/content/tabview/tabitems.js
browser/base/content/test/tabview/Makefile.in
browser/base/content/test/tabview/browser_tabview_bug648882.js
--- a/browser/base/content/tabview/tabitems.js
+++ b/browser/base/content/tabview/tabitems.js
@@ -1138,17 +1138,17 @@ let TabItems = {
   // ----------
   // Function: _checkHeartbeat
   // This periodically checks for tabs waiting to be updated, and calls
   // _update on them.
   // Should only be called by startHeartbeat and resumePainting.
   _checkHeartbeat: function TabItems__checkHeartbeat() {
     this._heartbeat = null;
 
-    if (this.isPaintingPaused() || !UI.isIdle)
+    if (this.isPaintingPaused() || !UI.isIdle())
       return;
 
     let accumTime = 0;
     let items = this._tabsWaitingForUpdate.getItems();
     // Do as many updates as we can fit into a "perceived" amount
     // of time, which is tunable.
     while (accumTime < this._maxTimeForUpdating && items.length) {
       let updateBegin = Date.now();
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -125,16 +125,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug634085.js \
                  browser_tabview_bug634158.js \
                  browser_tabview_bug634672.js \
                  browser_tabview_bug635696.js \
                  browser_tabview_bug640765.js \
                  browser_tabview_bug641802.js \
                  browser_tabview_bug644097.js \
                  browser_tabview_bug645653.js \
+                 browser_tabview_bug648882.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
                  browser_tabview_firstrun_pref.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
                  browser_tabview_multiwindow_search.js \
                  browser_tabview_orphaned_tabs.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug648882.js
@@ -0,0 +1,64 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  waitForExplicitFinish();
+
+  newWindowWithTabView(function (win) {
+    registerCleanupFunction(function () win.close());
+
+    let cw = win.TabView.getContentWindow();
+    let tab = win.gBrowser.tabs[0];
+    let tabItem = tab._tabViewTabItem;
+    let groupItem = cw.GroupItems.groupItems[0];
+    let container = groupItem.container;
+    let resizer = groupItem.$resizer[0];
+
+    let intervalID;
+    let isIdle = false;
+    let numLoops = 10;
+    let interval = cw.UI._maxInteractiveWait - 10;
+
+    let simulateDragDrop = function (target) {
+      EventUtils.synthesizeMouse(target, 5, 5, {type: "mousedown"}, cw);
+      EventUtils.synthesizeMouse(target, 40, 20, {type: "mousemove"}, cw);
+      EventUtils.synthesizeMouse(target, 20, 20, {type: "mouseup"}, cw);
+    }
+
+    let moveGroup = function () {
+      simulateDragDrop(container);
+
+      if (!--numLoops) {
+        numLoops = 10;
+        win.clearInterval(intervalID);
+        intervalID = win.setInterval(resizeGroup, interval);
+      }
+    };
+
+    let resizeGroup = function () {
+      simulateDragDrop(resizer);
+
+      if (!--numLoops) {
+        isIdle = true;
+        win.clearInterval(intervalID);
+      }
+    };
+
+    SimpleTest.waitForFocus(function () {
+      cw.TabItems.pausePainting();
+      cw.TabItems.update(tab);
+
+      tabItem.addSubscriber(tabItem, "updated", function () {
+        tabItem.removeSubscriber(tabItem, "updated");
+        ok(isIdle, "tabItem is updated only when UI is idle");
+        finish();
+      });
+
+      intervalID = win.setInterval(moveGroup, interval);
+      registerCleanupFunction(function () win.clearInterval(intervalID));
+
+      moveGroup();
+      cw.TabItems.resumePainting();
+    }, cw);
+  });
+}