Bug 1267388 - Add additional "state" checks, in preparation for using common prompt checking helper. r?MattN draft
authorJustin Dolske <dolske@mozilla.com>
Mon, 25 Apr 2016 13:17:39 -0700
changeset 356152 386ffc4ccae1b5272d7b1e74af3db1746e0b645b
parent 356151 e577ba5f7e03eb231f0c332f7326cdc73efbd7a1
child 356153 8bc34423f0961b7932bd975b4037275f6cc8bd3d
push id16458
push userjdolske@mozilla.com
push dateMon, 25 Apr 2016 20:17:50 +0000
reviewersMattN
bugs1267388
milestone49.0a1
Bug 1267388 - Add additional "state" checks, in preparation for using common prompt checking helper. r?MattN MozReview-Commit-ID: F4oqUTGiH4d
toolkit/components/passwordmgr/test/mochitest/prompt_common.js
toolkit/components/passwordmgr/test/mochitest/test_prompt.html
--- a/toolkit/components/passwordmgr/test/mochitest/prompt_common.js
+++ b/toolkit/components/passwordmgr/test/mochitest/prompt_common.js
@@ -66,23 +66,113 @@ function getDialogDoc() {
         if (childDoc.location.href == "chrome://global/content/commonDialog.xul")
           return childDoc;
     }
   }
 
   return null;
 }
 
-function checkPromptState(promptState, expectedState) {
-    // is(promptState.title,       expectedState.title,       "Checking expected title");
-    is(promptState.msg,         expectedState.msg,         "Checking expected message");
-    is(promptState.textValue, expectedState.textValue, "Checking textbox value");
-    is(promptState.passValue, expectedState.passValue, "Checking passbox value");
-}
-
 function getPromptState(ui) {
   let state = {};
   state.msg         = ui.infoBody.textContent;
-  state.title       = ui.infoTitle.textContent;
+  state.titleHidden = ui.infoTitle.getAttribute("hidden") == "true";
+  state.textHidden  = ui.loginContainer.hidden;
+  state.passHidden  = ui.password1Container.hidden;
+  state.checkHidden = ui.checkboxContainer.hidden;
+  state.checkMsg    = ui.checkbox.label;
+  state.checked     = ui.checkbox.checked;
+  // tab-modal prompts don't have an infoIcon
+  state.iconClass   = ui.infoIcon ? ui.infoIcon.className : null;
   state.textValue   = ui.loginTextbox.getAttribute("value");
   state.passValue   = ui.password1Textbox.getAttribute("value");
+
+  state.butt0Label  = ui.button0.label;
+  state.butt1Label  = ui.button1.label;
+  state.butt2Label  = ui.button2.label;
+
+  state.butt0Disabled = ui.button0.disabled;
+  state.butt1Disabled = ui.button1.disabled;
+  state.butt2Disabled = ui.button2.disabled;
+
+  function isDefaultButton(b) {
+      return (b.hasAttribute("default") &&
+              b.getAttribute("default") == "true");
+  }
+  state.defButton0 = isDefaultButton(ui.button0);
+  state.defButton1 = isDefaultButton(ui.button1);
+  state.defButton2 = isDefaultButton(ui.button2);
+
+  let fm = Cc["@mozilla.org/focus-manager;1"].
+           getService(Ci.nsIFocusManager);
+  let e = fm.focusedElement;
+
+  if (e == null) {
+    state.focused = null;
+  } else if (ui.button0.isSameNode(e)) {
+    state.focused = "button0";
+  } else if (ui.button1.isSameNode(e)) {
+    state.focused = "button1";
+  } else if (ui.button2.isSameNode(e)) {
+    state.focused = "button2";
+  } else if (ui.loginTextbox.inputField.isSameNode(e)) {
+    state.focused = "textField";
+  } else if (ui.password1Textbox.inputField.isSameNode(e)) {
+    state.focused = "passField";
+  } else if (ui.infoBody.isSameNode(e)) {
+    state.focused = "infoBody";
+  } else {
+    state.focused = "ERROR: unexpected element focused: " + (e ? e.localName : "<null>");
+  }
+
   return state;
 }
+
+var isTabModal = false;
+var isOSX = ("nsILocalFileMac" in SpecialPowers.Ci);
+var isLinux = ("@mozilla.org/gnome-gconf-service;1" in SpecialPowers.Cc);
+var isE10S = SpecialPowers.Services.appinfo.processType == 2;
+
+function checkPromptState(promptState, expectedState) {
+    // XXX check title? OS X has title in content
+    is(promptState.msg,         expectedState.msg,         "Checking expected message");
+    if (isOSX && !isTabModal)
+      ok(!promptState.titleHidden, "Checking title always visible on OS X");
+    else
+      is(promptState.titleHidden, expectedState.titleHidden, "Checking title visibility");
+    is(promptState.textHidden,  expectedState.textHidden,  "Checking textbox visibility");
+    is(promptState.passHidden,  expectedState.passHidden,  "Checking passbox visibility");
+    is(promptState.checkHidden, expectedState.checkHidden, "Checking checkbox visibility");
+    is(promptState.checkMsg,    expectedState.checkMsg,    "Checking checkbox label");
+    is(promptState.checked,     expectedState.checked,     "Checking checkbox checked");
+    if (!isTabModal)
+      is(promptState.iconClass, "spaced " + expectedState.iconClass, "Checking expected icon CSS class");
+    is(promptState.textValue, expectedState.textValue, "Checking textbox value");
+    is(promptState.passValue, expectedState.passValue, "Checking passbox value");
+
+    if (expectedState.butt0Label) {
+        is(promptState.butt0Label, expectedState.butt0Label, "Checking accept-button label");
+    }
+    if (expectedState.butt1Label) {
+        is(promptState.butt1Label, expectedState.butt1Label, "Checking cancel-button label");
+    }
+    if (expectedState.butt2Label) {
+        is(promptState.butt2Label, expectedState.butt2Label, "Checking extra1-button label");
+    }
+
+    // For prompts with a time-delay button.
+    if (expectedState.butt0Disabled) {
+        is(promptState.butt0Disabled, true,  "Checking accept-button is disabled");
+        is(promptState.butt1Disabled, false, "Checking cancel-button isn't disabled");
+    }
+
+    is(promptState.defButton0, expectedState.defButton == "button0", "checking button0 default");
+    is(promptState.defButton1, expectedState.defButton == "button1", "checking button1 default");
+    is(promptState.defButton2, expectedState.defButton == "button2", "checking button2 default");
+
+    if (isLinux && (!promptState.focused || isE10S)) {
+        todo(false, "Focus seems missing or wrong on Linux"); // bug 1265077
+    } else if (isOSX && expectedState.focused && expectedState.focused.startsWith("button")) {
+        is(promptState.focused, "infoBody", "buttons don't focus on OS X, but infoBody does instead");
+    } else {
+        is(promptState.focused, expectedState.focused, "Checking focused element");
+    }
+}
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt.html
@@ -316,16 +316,25 @@ function handleLoad() {
       is(username, "mochiuser1", "Checking for echoed username");
       is(password, "mochipass1", "Checking for echoed password");
 
       state = {
         msg         : "A username and password are being requested by http://mochi.test:8888. The site says: \"mochitest2\"",
         title       : "Authentication Required",
         textValue   : "mochiuser2",
         passValue   : "mochipass2",
+        iconClass   : "authentication-icon question-icon",
+        titleHidden : true,
+        textHidden  : false,
+        passHidden  : false,
+        checkHidden : true,
+        checkMsg    : "",
+        checked     : false,
+        focused     : "textField",
+        defButton   : "button0",
       };
       action = {
         buttonClick : "ok",
       };
       startCallbackTimer();
       // We've already authenticated to this host:port. For this next
       // request, the existing auth should be sent, we'll get a 401 reply,
       // and we should prompt for new auth.
@@ -350,16 +359,25 @@ function handleLoad() {
       // Same realm we've already authenticated to, but with a different
       // expected password (to trigger an auth prompt, and change-password
       // popup notification).
       state = {
         msg         : "A username and password are being requested by http://mochi.test:8888. The site says: \"mochitest\"",
         title       : "Authentication Required",
         textValue   : "mochiuser1",
         passValue   : "mochipass1",
+        iconClass   : "authentication-icon question-icon",
+        titleHidden : true,
+        textHidden  : false,
+        passHidden  : false,
+        checkHidden : true,
+        checkMsg    : "",
+        checked     : false,
+        focused     : "textField",
+        defButton   : "button0",
       };
       action = {
         buttonClick : "ok",
         passField   : "mochipass1-new",
       };
       startCallbackTimer();
       iframe.src = "authenticate.sjs?user=mochiuser1&pass=mochipass1-new";
       break;
@@ -387,16 +405,25 @@ function handleLoad() {
       // Same as last test, but for a realm we haven't already authenticated
       // to (but have an existing saved login for, so that we'll trigger
       // a change-password popup notification.
       state = {
         msg         : "A username and password are being requested by http://mochi.test:8888. The site says: \"mochitest3\"",
         title       : "Authentication Required",
         textValue   : "mochiuser3",
         passValue   : "mochipass3-old",
+        iconClass   : "authentication-icon question-icon",
+        titleHidden : true,
+        textHidden  : false,
+        passHidden  : false,
+        checkHidden : true,
+        checkMsg    : "",
+        checked     : false,
+        focused     : "textField",
+        defButton   : "button0",
       };
       action = {
         buttonClick : "ok",
         passField   : "mochipass3-new",
       };
       startCallbackTimer();
       iframe.src = "authenticate.sjs?user=mochiuser3&pass=mochipass3-new&realm=mochitest3";
       break;
@@ -406,16 +433,25 @@ function handleLoad() {
       is(username, "mochiuser3", "Checking for echoed username");
       is(password, "mochipass3-new", "Checking for echoed password");
 
       state = {
         msg         : "A username and password are being requested by http://mochi.test:8888. The site says: \"mochitest3\"",
         title       : "Authentication Required",
         textValue   : "",
         passValue   : "",
+        iconClass   : "authentication-icon question-icon",
+        titleHidden : true,
+        textHidden  : false,
+        passHidden  : false,
+        checkHidden : true,
+        checkMsg    : "",
+        checked     : false,
+        focused     : "textField",
+        defButton   : "button0",
       };
       action = {
         buttonClick : "ok",
         textField   : "mochiuser3",
         passField   : "mochipass3-old",
       };
       // Housekeeping: change it back to the original login4. Actually,
       // just delete it and we'll re-add it as the next test.
@@ -521,16 +557,25 @@ function doTests() {
 
   // ===== test 1 =====
   testNum = 1;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "abc",
     passValue   : "",
+    iconClass   : "question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : true,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     textField   : "xyz",
   };
   startCallbackTimer();
   isOk = prompter1.prompt(defaultTitle, defaultMsg, "http://example.com",
                           Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER, "abc", result);
@@ -541,16 +586,25 @@ function doTests() {
 
   // ===== test 2 =====
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "abc",
     passValue   : "",
+    iconClass   : "question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : true,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "cancel",
   };
   startCallbackTimer();
   isOk = prompter1.prompt(defaultTitle, defaultMsg, "http://example.com",
                           Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER, "abc", result);
   ok(didDialog, "handleDialog was invoked");
@@ -559,16 +613,25 @@ function doTests() {
   // ===== test 10 =====
   // Default password provided, existing logins are ignored.
   testNum = 10;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "inputpw",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "secret",
   };
   pword.value = "inputpw";
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "http://example.com",
@@ -580,16 +643,25 @@ function doTests() {
   // ===== test 11 =====
   // Default password provided, existing logins are ignored.
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "inputpw",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "cancel",
   };
   pword.value = "inputpw";
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "http://example.com",
                                   Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER, pword);
@@ -599,16 +671,25 @@ function doTests() {
   // ===== test 12 =====
   // No default password provided, realm does not match existing login.
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "secret",
   };
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "http://nonexample.com",
@@ -630,16 +711,25 @@ function doTests() {
   // No default password provided, none of the logins from this host are
   // password-only so the user is prompted.
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "secret",
   };
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "http://example2.com",
@@ -698,16 +788,25 @@ function doTests() {
   // ===== test 30 =====
   // We don't pre-fill or save for NS_GetAuthKey-generated realms, but we should still prompt
   testNum = 30;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "fill2pass",
   };
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "example2.com:80 (somerealm)",
@@ -719,16 +818,25 @@ function doTests() {
   // ===== test 31 =====
   // We don't pre-fill or save for NS_GetAuthKey-generated realms, but we should still prompt
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : true,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "passField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "fill2pass",
   };
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptPassword(defaultTitle, defaultMsg, "example2.com:80 (somerealm)",
@@ -739,16 +847,25 @@ function doTests() {
 
   // ===== test 100 =====
   testNum = 100;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "inuser",
     passValue   : "inpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     textField   : "outuser",
     passField   : "outpass",
   };
   uname.value = "inuser";
   pword.value = "inpass";
@@ -762,16 +879,25 @@ function doTests() {
 
   // ===== test 101 =====
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "inuser",
     passValue   : "inpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "cancel",
   };
   uname.value = "inuser";
   pword.value = "inpass";
   startCallbackTimer();
   isOk = prompter1.promptUsernameAndPassword(defaultTitle, defaultMsg, "http://nonexample.com",
@@ -782,16 +908,25 @@ function doTests() {
   // ===== test 102 =====
   // test filling in existing password-only login
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "examplepass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   uname.value = null;
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptUsernameAndPassword(defaultTitle, defaultMsg, "http://example.com",
@@ -805,16 +940,25 @@ function doTests() {
   // test filling in existing login (undetermined from multiple selection)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   uname.value = null;
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptUsernameAndPassword(defaultTitle, defaultMsg, "http://example2.com",
@@ -827,16 +971,25 @@ function doTests() {
   // ===== test 104 =====
   // test filling in existing login (user1 from multiple selection)
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   uname.value = "user1name";
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptUsernameAndPassword(defaultTitle, defaultMsg, "http://example2.com",
@@ -849,16 +1002,25 @@ function doTests() {
   // ===== test 105 =====
   // test filling in existing login (user2 from multiple selection)
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "user2name",
     passValue   : "user2pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   uname.value = "user2name";
   pword.value = null;
   startCallbackTimer();
   isOk = prompter1.promptUsernameAndPassword(defaultTitle, defaultMsg, "http://example2.com",
@@ -871,16 +1033,25 @@ function doTests() {
   // ===== test 106 =====
   // test changing password
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "user2name",
     passValue   : "user2pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "NEWuser2pass",
   };
   uname.value = "user2name";
   pword.value = null;
   startCallbackTimer();
@@ -894,16 +1065,25 @@ function doTests() {
   // ===== test 107 =====
   // test changing password (back to original value)
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "user2name",
     passValue   : "NEWuser2pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : false,
+    checkMsg    : "Use Password Manager to remember this password.",
+    checked     : true,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     passField   : "user2pass",
   };
   uname.value = "user2name";
   pword.value = null;
   startCallbackTimer();
@@ -917,16 +1097,25 @@ function doTests() {
   // ===== test 120 =====
   // We don't pre-fill or save for NS_GetAuthKey-generated realms, but we should still prompt
   testNum = 120;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     textField   : "fill2user",
     passField   : "fill2pass",
   };
   uname.value = null;
   pword.value = null;
@@ -941,16 +1130,25 @@ function doTests() {
   // ===== test 121 =====
   // We don't pre-fill or save for NS_GetAuthKey-generated realms, but we should still prompt
   testNum++;
   state = {
     msg         : "the message",
     title       : "the title",
     textValue   : "",
     passValue   : "",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     textField   : "fill2user",
     passField   : "fill2pass",
   };
   uname.value = null;
   pword.value = null;
@@ -985,16 +1183,25 @@ function doTests() {
 
   // ===== test 500 =====
   testNum = 500;
   state = {
     msg         : "A username and password are being requested by http://example.com. The site says: \"some realm\"",
     title       : "Authentication Required",
     textValue   : "inuser",
     passValue   : "inpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
     textField   : "outuser",
     passField   : "outpass",
   };
   authinfo.username = "inuser";
   authinfo.password = "inpass";
@@ -1010,16 +1217,25 @@ function doTests() {
 
   // ===== test 501 =====
   testNum++;
   state = {
     msg         : "A username and password are being requested by http://example.com. The site says: \"some realm\"",
     title       : "Authentication Required",
     textValue   : "outuser",
     passValue   : "outpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "cancel",
   };
   startCallbackTimer();
   isOk = prompter2.promptAuth(channel1, level, authinfo);
 
   ok(!isOk, "Checking dialog return value (cancel)");
@@ -1028,16 +1244,25 @@ function doTests() {
   // ===== test 502 =====
   // test filling in password-only login
   testNum++;
   state = {
     msg         : "A username and password are being requested by http://example.com. The site says: \"http://example.com\"",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "examplepass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   authinfo.username = "";
   authinfo.password = "";
   authinfo.realm    = "http://example.com";
 
@@ -1053,16 +1278,25 @@ function doTests() {
   // test filling in existing login (undetermined from multiple selection)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "A username and password are being requested by http://example2.com. The site says: \"http://example2.com\"",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   authinfo.username = "";
   authinfo.password = "";
   authinfo.realm    = "http://example2.com";
 
@@ -1078,16 +1312,25 @@ function doTests() {
   // test filling in existing login (undetermined --> user1)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "A username and password are being requested by http://example2.com. The site says: \"http://example2.com\"",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   // enter one of the known logins, test 504+505 exercise the two possible states.
   action = {
     buttonClick : "ok",
     textField   : "user1name",
     passField   : "user1pass",
   };
   authinfo.username = "";
@@ -1106,16 +1349,25 @@ function doTests() {
   // test filling in existing login (undetermined --> user2)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "A username and password are being requested by http://example2.com. The site says: \"http://example2.com\"",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   // enter one of the known logins, test 504+505 exercise the two possible states.
   action = {
     buttonClick : "ok",
     textField   : "user2name",
     passField   : "user2pass",
   };
   authinfo.username = "";
@@ -1135,16 +1387,25 @@ function doTests() {
   // test changing a password (undetermined --> user2 w/ newpass)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "A username and password are being requested by http://example2.com. The site says: \"http://example2.com\"",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   // force to user2, and change the password
   action = {
     buttonClick : "ok",
     textField   : "user2name",
     passField   : "NEWuser2pass",
   };
   authinfo.username = "";
@@ -1164,16 +1425,25 @@ function doTests() {
   // test changing a password (undetermined --> user2 w/ origpass)
   testNum++;
   // user2name/user2pass would also be valid to fill here.
   state = {
     msg         : "A username and password are being requested by http://example2.com. The site says: \"http://example2.com\"",
     title       : "Authentication Required",
     textValue   : "user1name",
     passValue   : "user1pass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   // force to user2, and change the password back
   action = {
     buttonClick : "ok",
     textField   : "user2name",
     passField   : "user2pass",
   };
   authinfo.username = "";
@@ -1192,16 +1462,25 @@ function doTests() {
   // ===== test 508 =====
   // test proxy login (default = no autologin), make sure it prompts.
   testNum++;
   state = {
     msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password. The site says: \"Proxy Realm\"",
     title       : "Authentication Required",
     textValue   : "proxuser",
     passValue   : "proxpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   proxyAuthinfo.username = "";
   proxyAuthinfo.password = "";
   proxyAuthinfo.realm    = "Proxy Realm";
   proxyAuthinfo.flags    = Ci.nsIAuthInformation.AUTH_PROXY;
@@ -1242,16 +1521,25 @@ function doTests() {
   // ===== test 510 =====
   // test proxy login (with autologin), ensure it prompts after a failed auth.
   testNum++;
   state = {
     msg         : "The proxy moz-proxy://127.0.0.1:8888 is requesting a username and password. The site says: \"Proxy Realm\"",
     title       : "Authentication Required",
     textValue   : "proxuser",
     passValue   : "proxpass",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
 
   proxyAuthinfo.username = "";
   proxyAuthinfo.password = "";
   proxyAuthinfo.realm    = "Proxy Realm";
@@ -1303,16 +1591,25 @@ function doTests() {
 
   // ===== test 1000 =====
   testNum = 1000;
   state = {
     msg         : "A username and password are being requested by http://mochi.test:8888. The site says: \"mochitest\"",
     title       : "Authentication Required",
     textValue   : "mochiuser1",
     passValue   : "mochipass1",
+    iconClass   : "authentication-icon question-icon",
+    titleHidden : true,
+    textHidden  : false,
+    passHidden  : false,
+    checkHidden : true,
+    checkMsg    : "",
+    checked     : false,
+    focused     : "textField",
+    defButton   : "button0",
   };
   action = {
     buttonClick : "ok",
   };
   startCallbackTimer();
   iframe.src = "authenticate.sjs?user=mochiuser1&pass=mochipass1";
 
   // ...remaining tests are driven by handleLoad()...