зеркало из https://github.com/mozilla/gecko-dev.git
Bug 551540 followup - Wait for the Organizer window to be closed before proceeding; r=dolske a=orange-fix
This commit is contained in:
Родитель
ed75b830df
Коммит
dd643517ab
|
@ -38,6 +38,24 @@
|
|||
// This test makes sure that the Forget This Site command is hidden for multiple
|
||||
// selections.
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
||||
|
||||
function test() {
|
||||
// initialization
|
||||
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
|
@ -61,6 +79,7 @@ function test() {
|
|||
ww.unregisterNotification(observer);
|
||||
let organizer = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
executeSoon(function() {
|
||||
// Select History in the left pane.
|
||||
organizer.PlacesOrganizer.selectLeftPaneQuery('History');
|
||||
let PO = organizer.PlacesOrganizer;
|
||||
|
@ -86,10 +105,19 @@ function test() {
|
|||
"be hidden with " + selectionCount + " items selected");
|
||||
// Close the context menu
|
||||
contextmenu.hidePopup();
|
||||
// Wait for the Organizer window to actually be closed
|
||||
function closeObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "domwindowclosed")
|
||||
return;
|
||||
ww.unregisterNotification(closeObserver);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
// Proceed
|
||||
funcNext();
|
||||
});
|
||||
}
|
||||
ww.registerNotification(closeObserver);
|
||||
// Close Library window.
|
||||
organizer.close();
|
||||
// Proceed
|
||||
funcNext();
|
||||
}, false);
|
||||
// Get cell coordinates
|
||||
var x = {}, y = {}, width = {}, height = {};
|
||||
|
@ -97,6 +125,7 @@ function test() {
|
|||
x, y, width, height);
|
||||
// Initiate a context menu for the selected cell
|
||||
EventUtils.synthesizeMouse(tree.body, x + 4, y + 4, {type: "contextmenu"}, organizer);
|
||||
});
|
||||
}, organizer);
|
||||
}
|
||||
|
||||
|
@ -111,9 +140,7 @@ function test() {
|
|||
testForgetThisSiteVisibility(1, function() {
|
||||
testForgetThisSiteVisibility(2, function() {
|
||||
// Cleanup
|
||||
history.QueryInterface(Ci.nsIBrowserHistory)
|
||||
.removeAllPages();
|
||||
finish();
|
||||
waitForClearHistory(finish);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -38,6 +38,24 @@
|
|||
// This test makes sure that the Forget This Site command is hidden in private
|
||||
// browsing mode.
|
||||
|
||||
/**
|
||||
* Clears history invoking callback when done.
|
||||
*/
|
||||
function waitForClearHistory(aCallback) {
|
||||
const TOPIC_EXPIRATION_FINISHED = "places-expiration-finished";
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
Services.obs.removeObserver(this, TOPIC_EXPIRATION_FINISHED);
|
||||
aCallback();
|
||||
}
|
||||
};
|
||||
Services.obs.addObserver(observer, TOPIC_EXPIRATION_FINISHED, false);
|
||||
|
||||
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||
getService(Ci.nsINavHistoryService);
|
||||
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
|
||||
}
|
||||
|
||||
function test() {
|
||||
// initialization
|
||||
let pb = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
|
@ -60,6 +78,7 @@ function test() {
|
|||
Services.ww.unregisterNotification(observer);
|
||||
let organizer = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
executeSoon(function() {
|
||||
// Select History in the left pane.
|
||||
let PO = organizer.PlacesOrganizer;
|
||||
PO.selectLeftPaneQuery('History');
|
||||
|
@ -85,10 +104,19 @@ function test() {
|
|||
"The Forget This Site command should " + (expected ? "not " : "") + "be disabled");
|
||||
// Close the context menu
|
||||
contextmenu.hidePopup();
|
||||
// Wait for the Organizer window to actually be closed
|
||||
function closeObserver(aSubject, aTopic, aData) {
|
||||
if (aTopic != "domwindowclosed")
|
||||
return;
|
||||
Services.ww.unregisterNotification(closeObserver);
|
||||
SimpleTest.waitForFocus(function() {
|
||||
// Proceed
|
||||
funcNext();
|
||||
});
|
||||
}
|
||||
Services.ww.registerNotification(closeObserver);
|
||||
// Close Library window.
|
||||
organizer.close();
|
||||
// Proceed
|
||||
funcNext();
|
||||
}, false);
|
||||
// Get cell coordinates
|
||||
var x = {}, y = {}, width = {}, height = {};
|
||||
|
@ -96,6 +124,7 @@ function test() {
|
|||
x, y, width, height);
|
||||
// Initiate a context menu for the selected cell
|
||||
EventUtils.synthesizeMouse(tree.body, x + 4, y + 4, {type: "contextmenu"}, organizer);
|
||||
});
|
||||
}, organizer);
|
||||
}
|
||||
|
||||
|
@ -115,9 +144,7 @@ function test() {
|
|||
pb.privateBrowsingEnabled = false;
|
||||
testForgetThisSiteVisibility(true, function() {
|
||||
// Cleanup
|
||||
history.QueryInterface(Ci.nsIBrowserHistory)
|
||||
.removeAllPages();
|
||||
finish();
|
||||
waitForClearHistory(finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче