Bug 491898 - Random Test Failure (browser_passwordmgrdlg.js); r=dolske

This commit is contained in:
Ehsan Akhgari 2009-05-12 22:23:36 +04:30
Родитель f3eaad63ce
Коммит 7d1a8d37e8
2 изменённых файлов: 25 добавлений и 12 удалений

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

@ -167,14 +167,19 @@ function DeleteAllSignons() {
}
function TogglePasswordVisible() {
if (!showingPasswords && !ConfirmShowPasswords())
return;
if (showingPasswords || ConfirmShowPasswords()) {
showingPasswords = !showingPasswords;
document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
document.getElementById("togglePasswords").accessKey = kSignonBundle.getString(showingPasswords ? "hidePasswordsAccessKey" : "showPasswordsAccessKey");
document.getElementById("passwordCol").hidden = !showingPasswords;
_filterPasswords();
}
showingPasswords = !showingPasswords;
document.getElementById("togglePasswords").label = kSignonBundle.getString(showingPasswords ? "hidePasswords" : "showPasswords");
document.getElementById("togglePasswords").accessKey = kSignonBundle.getString(showingPasswords ? "hidePasswordsAccessKey" : "showPasswordsAccessKey");
document.getElementById("passwordCol").hidden = !showingPasswords;
_filterPasswords();
// Notify observers that the password visibility toggling is
// completed. (Mostly useful for tests)
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(null, "passwordmgr-password-toggle-complete", null);
}
function AskUserShowPasswords() {

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

@ -139,10 +139,9 @@ function test() {
if (showMode) {
let obs = {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "domwindowclosed") {
if (aTopic == "domwindowclosed")
ww.unregisterNotification(this);
setTimeout(func, 0);
} else if (aTopic == "domwindowopened") {
else if (aTopic == "domwindowopened") {
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
win.addEventListener("load", function() {
win.removeEventListener("load", arguments.callee, true);
@ -156,9 +155,18 @@ function test() {
ww.registerNotification(obs);
}
let obsSvc = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
obsSvc.addObserver({
observe: function(aSubject, aTopic, aData) {
if (aTopic == "passwordmgr-password-toggle-complete") {
obsSvc.removeObserver(this, "passwordmgr-password-toggle-complete", false);
func();
}
}
}, "passwordmgr-password-toggle-complete", false);
EventUtils.synthesizeMouse(toggleButton, 1, 1, {}, win);
if (!showMode)
func();
}
function runTests(mode, endFunction) {