зеркало из https://github.com/mozilla/gecko-dev.git
Bug 984843 - Try to fix intermittent timeouts and leaks r=ehsan
From 55be314a97a4934167ad466dc884fb5c933dea1e Mon Sep 17 00:00:00 2001
This commit is contained in:
Родитель
24d3f3ce26
Коммит
18f1360735
|
@ -7,10 +7,6 @@ function test() {
|
|||
waitForExplicitFinish();
|
||||
|
||||
newWindowWithTabView(function(win) {
|
||||
registerCleanupFunction(function() {
|
||||
win.close();
|
||||
});
|
||||
|
||||
cw = win.TabView.getContentWindow();
|
||||
|
||||
let groupItemOne = cw.GroupItems.groupItems[0];
|
||||
|
@ -22,11 +18,13 @@ function test() {
|
|||
let groupItemThree = createGroupItemWithBlankTabs(win, 300, 300, 40, 2);
|
||||
is(groupItemThree.getChildren().length, 2, "Group three has 2 tab items");
|
||||
|
||||
testMoreRecentlyUsedGroup(groupItemOne, groupItemTwo, function() {
|
||||
testMoreRecentlyUsedGroup(groupItemOne, groupItemThree, function() {
|
||||
testRemoveGroupAndCheckMoreRecentlyUsedGroup(groupItemOne, groupItemTwo);
|
||||
waitForFocus(() => {
|
||||
testMoreRecentlyUsedGroup(groupItemOne, groupItemTwo, function() {
|
||||
testMoreRecentlyUsedGroup(groupItemOne, groupItemThree, function() {
|
||||
testRemoveGroupAndCheckMoreRecentlyUsedGroup(groupItemOne, groupItemTwo);
|
||||
});
|
||||
});
|
||||
});
|
||||
}, cw);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -81,7 +79,10 @@ function testRemoveGroupAndCheckMoreRecentlyUsedGroup(groupItemOne, groupItemTwo
|
|||
is(groupItemTwo.getActiveTab(), tabItem, "The first item in the group two is still active after group one is closed");
|
||||
is(cw.GroupItems.getActiveGroupItem(), groupItemTwo, "The group two is still active after group one is closed");
|
||||
|
||||
finish();
|
||||
promiseWindowClosed(cw.top).then(() => {
|
||||
cw = null;
|
||||
finish();
|
||||
});
|
||||
});
|
||||
// close the tab item and the group item
|
||||
let closeButton = tabItemInGroupItemOne.container.getElementsByClassName("close");
|
||||
|
@ -89,4 +90,3 @@ function testRemoveGroupAndCheckMoreRecentlyUsedGroup(groupItemOne, groupItemTwo
|
|||
EventUtils.sendMouseEvent({ type: "mousedown" }, closeButton[0], cw);
|
||||
EventUtils.sendMouseEvent({ type: "mouseup" }, closeButton[0], cw);
|
||||
}
|
||||
|
||||
|
|
|
@ -400,3 +400,21 @@ function whenAppTabIconAdded(groupItem, callback) {
|
|||
executeSoon(callback);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Chrome windows aren't closed synchronously. Provide a helper method to close
|
||||
* a window and wait until we received the "domwindowclosed" notification for it.
|
||||
*/
|
||||
function promiseWindowClosed(win) {
|
||||
let deferred = Promise.defer();
|
||||
|
||||
Services.obs.addObserver(function obs(subject, topic) {
|
||||
if (subject == win) {
|
||||
Services.obs.removeObserver(obs, topic);
|
||||
deferred.resolve();
|
||||
}
|
||||
}, "domwindowclosed", false);
|
||||
|
||||
win.close();
|
||||
return deferred.promise;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче