This commit is contained in:
Vivien Nicolas 2011-04-20 16:11:54 +02:00
Родитель d286f5395f fbbca3c550
Коммит 75d9cb1501
3 изменённых файлов: 1 добавлений и 92 удалений

Просмотреть файл

@ -1143,15 +1143,9 @@ let TabItems = {
_checkHeartbeat: function TabItems__checkHeartbeat() {
this._heartbeat = null;
if (this.isPaintingPaused())
if (this.isPaintingPaused() || !UI.isIdle)
return;
// restart the heartbeat to update all waiting tabs once the UI becomes idle
if (!UI.isIdle()) {
this.startHeartbeat();
return;
}
let accumTime = 0;
let items = this._tabsWaitingForUpdate.getItems();
// Do as many updates as we can fit into a "perceived" amount

Просмотреть файл

@ -130,7 +130,6 @@ _BROWSER_FILES = \
browser_tabview_bug641802.js \
browser_tabview_bug644097.js \
browser_tabview_bug645653.js \
browser_tabview_bug648882.js \
browser_tabview_bug649006.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \

Просмотреть файл

@ -1,84 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
testHeartbeatAfterBusyUI(function () {
testTabUpdatesWithBusyUI(finish);
});
}
function testHeartbeatAfterBusyUI(callback) {
newWindowWithTabView(function (win) {
registerCleanupFunction(function () win.close());
let cw = win.TabView.getContentWindow();
let tab = win.gBrowser.tabs[0];
let tabItem = tab._tabViewTabItem;
cw.TabItems.pausePainting();
tabItem.addSubscriber(tabItem, "updated", function () {
tabItem.removeSubscriber(tabItem, "updated");
callback();
});
cw.TabItems.update(tab);
cw.UI.isIdle = function () {
cw.UI.isIdle = function () true;
return false;
}
cw.TabItems.resumePainting();
});
}
function testTabUpdatesWithBusyUI(callback) {
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 / 2;
let simulateBusyUI = function () {
let target = 5 < numLoops-- ? container : resizer;
EventUtils.synthesizeMouse(target, 5, 5, {type: "mousedown"}, cw);
EventUtils.synthesizeMouse(target, 40, 20, {type: "mousemove"}, cw);
EventUtils.synthesizeMouse(target, 20, 20, {type: "mouseup"}, cw);
win.setTimeout(function () {
if (numLoops)
simulateBusyUI();
else
isIdle = true;
}, interval);
};
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");
callback();
});
simulateBusyUI();
win.setTimeout(simulateBusyUI, interval);
cw.TabItems.resumePainting();
}, cw);
});
}