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
parent 71ffeedec0
commit e6e16dae76
2 changed files with 25 additions and 12 deletions

View File

@ -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() {

View File

@ -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) {