Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | function test() { |
michael@0 | 5 | waitForExplicitFinish(); |
michael@0 | 6 | |
michael@0 | 7 | newWindowWithTabView(function (win) { |
michael@0 | 8 | registerCleanupFunction(function () win.close()); |
michael@0 | 9 | |
michael@0 | 10 | let cw = win.TabView.getContentWindow(); |
michael@0 | 11 | let tab = win.gBrowser.tabs[0]; |
michael@0 | 12 | let tabItem = tab._tabViewTabItem; |
michael@0 | 13 | let isIdle = false; |
michael@0 | 14 | |
michael@0 | 15 | // We replace UI.isIdle() here to not rely on setTimeout(). While this |
michael@0 | 16 | // function returns false (busy) we expect no tabItem updates to happen. |
michael@0 | 17 | let busyCount = 5; |
michael@0 | 18 | cw.UI.isIdle = function () { |
michael@0 | 19 | return isIdle = (0 > --busyCount); |
michael@0 | 20 | }; |
michael@0 | 21 | |
michael@0 | 22 | cw.TabItems.pausePainting(); |
michael@0 | 23 | |
michael@0 | 24 | tabItem.addSubscriber("updated", function onUpdated() { |
michael@0 | 25 | tabItem.removeSubscriber("updated", onUpdated); |
michael@0 | 26 | ok(isIdle, "tabItem is updated only when UI is idle"); |
michael@0 | 27 | finish(); |
michael@0 | 28 | }); |
michael@0 | 29 | |
michael@0 | 30 | cw.TabItems.update(tab); |
michael@0 | 31 | cw.TabItems.resumePainting(); |
michael@0 | 32 | }); |
michael@0 | 33 | } |