Bug 648882 - TabPriorityQueue updates tabItems when UI is busy [f=raymond, r=ian]

This commit is contained in:
Tim Taubert 2011-04-14 15:33:52 +02:00
Родитель 21749702ec
Коммит 757e0a5ccc
3 изменённых файлов: 66 добавлений и 1 удалений

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

@ -1143,7 +1143,7 @@ let TabItems = {
_checkHeartbeat: function TabItems__checkHeartbeat() {
this._heartbeat = null;
if (this.isPaintingPaused() || !UI.isIdle)
if (this.isPaintingPaused() || !UI.isIdle())
return;
let accumTime = 0;

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

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

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

@ -0,0 +1,64 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
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 - 10;
let simulateDragDrop = function (target) {
EventUtils.synthesizeMouse(target, 5, 5, {type: "mousedown"}, cw);
EventUtils.synthesizeMouse(target, 40, 20, {type: "mousemove"}, cw);
EventUtils.synthesizeMouse(target, 20, 20, {type: "mouseup"}, cw);
}
let moveGroup = function () {
simulateDragDrop(container);
if (!--numLoops) {
numLoops = 10;
win.clearInterval(intervalID);
intervalID = win.setInterval(resizeGroup, interval);
}
};
let resizeGroup = function () {
simulateDragDrop(resizer);
if (!--numLoops) {
isIdle = true;
win.clearInterval(intervalID);
}
};
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");
finish();
});
intervalID = win.setInterval(moveGroup, interval);
registerCleanupFunction(function () win.clearInterval(intervalID));
moveGroup();
cw.TabItems.resumePainting();
}, cw);
});
}