michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function (win) { michael@0: registerCleanupFunction(function () win.close()); michael@0: michael@0: let cw = win.TabView.getContentWindow(); michael@0: let tab = win.gBrowser.tabs[0]; michael@0: let tabItem = tab._tabViewTabItem; michael@0: let isIdle = false; michael@0: michael@0: // We replace UI.isIdle() here to not rely on setTimeout(). While this michael@0: // function returns false (busy) we expect no tabItem updates to happen. michael@0: let busyCount = 5; michael@0: cw.UI.isIdle = function () { michael@0: return isIdle = (0 > --busyCount); michael@0: }; michael@0: michael@0: cw.TabItems.pausePainting(); michael@0: michael@0: tabItem.addSubscriber("updated", function onUpdated() { michael@0: tabItem.removeSubscriber("updated", onUpdated); michael@0: ok(isIdle, "tabItem is updated only when UI is idle"); michael@0: finish(); michael@0: }); michael@0: michael@0: cw.TabItems.update(tab); michael@0: cw.TabItems.resumePainting(); michael@0: }); michael@0: }