browser/components/tabview/test/browser_tabview_bug648882.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e5a784a01688
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 waitForExplicitFinish();
6
7 newWindowWithTabView(function (win) {
8 registerCleanupFunction(function () win.close());
9
10 let cw = win.TabView.getContentWindow();
11 let tab = win.gBrowser.tabs[0];
12 let tabItem = tab._tabViewTabItem;
13 let isIdle = false;
14
15 // We replace UI.isIdle() here to not rely on setTimeout(). While this
16 // function returns false (busy) we expect no tabItem updates to happen.
17 let busyCount = 5;
18 cw.UI.isIdle = function () {
19 return isIdle = (0 > --busyCount);
20 };
21
22 cw.TabItems.pausePainting();
23
24 tabItem.addSubscriber("updated", function onUpdated() {
25 tabItem.removeSubscriber("updated", onUpdated);
26 ok(isIdle, "tabItem is updated only when UI is idle");
27 finish();
28 });
29
30 cw.TabItems.update(tab);
31 cw.TabItems.resumePainting();
32 });
33 }

mercurial