Bug 521233 - waitForFocus(callback) times out in browser chrome tests. use it in browser_bug304198.js, r=enn

This commit is contained in:
Marco Bonardo 2009-10-28 17:22:59 +01:00
parent 5ea0a853b4
commit cc70be0e78
2 changed files with 7 additions and 6 deletions

View File

@ -38,13 +38,10 @@
function test() { function test() {
waitForExplicitFinish(); waitForExplicitFinish();
if (Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager).activeWindow != waitForFocus(continue_test);
window) { }
setTimeout(test, 0);
window.focus();
return;
}
function continue_test() {
let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL; let charsToDelete, deletedURLTab, fullURLTab, partialURLTab, testPartialURL, testURL;
charsToDelete = 5; charsToDelete = 5;

View File

@ -238,6 +238,10 @@ SimpleTest.waitForFocus = function (callback, targetWindow) {
var fm = Components.classes["@mozilla.org/focus-manager;1"]. var fm = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager); getService(Components.interfaces.nsIFocusManager);
var usedTargetWindow = {};
fm.getFocusedElementForWindow(targetWindow, true, usedTargetWindow);
targetWindow = usedTargetWindow.value;
function debugFocusLog(prefix) { function debugFocusLog(prefix) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");