1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug648882.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,33 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + 1.10 + newWindowWithTabView(function (win) { 1.11 + registerCleanupFunction(function () win.close()); 1.12 + 1.13 + let cw = win.TabView.getContentWindow(); 1.14 + let tab = win.gBrowser.tabs[0]; 1.15 + let tabItem = tab._tabViewTabItem; 1.16 + let isIdle = false; 1.17 + 1.18 + // We replace UI.isIdle() here to not rely on setTimeout(). While this 1.19 + // function returns false (busy) we expect no tabItem updates to happen. 1.20 + let busyCount = 5; 1.21 + cw.UI.isIdle = function () { 1.22 + return isIdle = (0 > --busyCount); 1.23 + }; 1.24 + 1.25 + cw.TabItems.pausePainting(); 1.26 + 1.27 + tabItem.addSubscriber("updated", function onUpdated() { 1.28 + tabItem.removeSubscriber("updated", onUpdated); 1.29 + ok(isIdle, "tabItem is updated only when UI is idle"); 1.30 + finish(); 1.31 + }); 1.32 + 1.33 + cw.TabItems.update(tab); 1.34 + cw.TabItems.resumePainting(); 1.35 + }); 1.36 +}