Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <head> |
michael@0 | 4 | <title>Test for Login Manager</title> |
michael@0 | 5 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 6 | <script type="text/javascript" src="pwmgr_common.js"></script> |
michael@0 | 7 | <script type="text/javascript" src="notification_common.js"></script> |
michael@0 | 8 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 9 | </head> |
michael@0 | 10 | <body> |
michael@0 | 11 | Login Manager test: notifications |
michael@0 | 12 | <p id="display"></p> |
michael@0 | 13 | |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | <iframe id="iframe"></iframe> |
michael@0 | 16 | </div> |
michael@0 | 17 | |
michael@0 | 18 | <pre id="test"> |
michael@0 | 19 | <script class="testbody" type="text/javascript"> |
michael@0 | 20 | |
michael@0 | 21 | SimpleTest.expectAssertions(23); |
michael@0 | 22 | |
michael@0 | 23 | /** Test for Login Manager: notifications. **/ |
michael@0 | 24 | |
michael@0 | 25 | // Set testpath to the directory where we live. Used to load tests from |
michael@0 | 26 | // alternate Mochitest servers (different hostnames, same content). |
michael@0 | 27 | var testpath = document.location.pathname + "/../"; |
michael@0 | 28 | |
michael@0 | 29 | var subtests = [ |
michael@0 | 30 | "subtst_notifications_1.html", // 1 |
michael@0 | 31 | "subtst_notifications_1.html", // 2 |
michael@0 | 32 | "subtst_notifications_1.html", // 3 |
michael@0 | 33 | "subtst_notifications_1.html", // 4 |
michael@0 | 34 | "subtst_notifications_1.html", // 5 |
michael@0 | 35 | "subtst_notifications_1.html", // 6 |
michael@0 | 36 | "subtst_notifications_1.html", // 7 |
michael@0 | 37 | "subtst_notifications_1.html", // 8 |
michael@0 | 38 | "subtst_notifications_2.html", // 9 |
michael@0 | 39 | "subtst_notifications_3.html", // 10 |
michael@0 | 40 | "subtst_notifications_4.html", // 11 |
michael@0 | 41 | "subtst_notifications_5.html", // 12 |
michael@0 | 42 | "subtst_notifications_1.html", // 13 |
michael@0 | 43 | "subtst_notifications_6.html", // 14 |
michael@0 | 44 | "subtst_notifications_1.html", // 15 |
michael@0 | 45 | "subtst_notifications_6.html", // 16 |
michael@0 | 46 | "subtst_notifications_8.html", // 17 |
michael@0 | 47 | "subtst_notifications_8.html", // 18 |
michael@0 | 48 | "subtst_notifications_9.html", // 19 |
michael@0 | 49 | "subtst_notifications_10.html", // 20 |
michael@0 | 50 | "http://test1.example.org:80" + testpath + "subtst_notifications_1.html", // 21 |
michael@0 | 51 | "http://test1.example.org:80" + testpath + "subtst_notifications_7.html", // 22 |
michael@0 | 52 | "http://test1.example.org:80" + testpath + "subtst_notifications_6.html", // 23 |
michael@0 | 53 | ]; |
michael@0 | 54 | |
michael@0 | 55 | |
michael@0 | 56 | var ignoreLoad = false; |
michael@0 | 57 | function handleLoad(aEvent) { |
michael@0 | 58 | // ignore every other load event ... We get one for loading the subtest (which |
michael@0 | 59 | // we want to ignore), and another when the subtest's form submits itself |
michael@0 | 60 | // (which we want to handle, to start the next test). |
michael@0 | 61 | ignoreLoad = !ignoreLoad; |
michael@0 | 62 | if (ignoreLoad) { |
michael@0 | 63 | ok(true, "Ignoring load of subtest #" + testNum); |
michael@0 | 64 | return; |
michael@0 | 65 | } |
michael@0 | 66 | ok(true, "Processing submission of subtest #" + testNum); |
michael@0 | 67 | |
michael@0 | 68 | checkTest(); |
michael@0 | 69 | |
michael@0 | 70 | testNum++; |
michael@0 | 71 | |
michael@0 | 72 | if (testNum <= subtests.length) { |
michael@0 | 73 | ok(true, "Starting test #" + testNum); |
michael@0 | 74 | iframe.src = subtests[testNum-1]; |
michael@0 | 75 | } else { |
michael@0 | 76 | ok(true, "notification tests finished."); |
michael@0 | 77 | SimpleTest.finish(); |
michael@0 | 78 | } |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | |
michael@0 | 82 | // Remember, Never for This Site, Not Now |
michael@0 | 83 | function checkTest() { |
michael@0 | 84 | var popup, notificationText, expectedText; |
michael@0 | 85 | |
michael@0 | 86 | // The document generated from formsubmit.sjs contains the user/pass it |
michael@0 | 87 | // received inside <span id="blah">value</span> |
michael@0 | 88 | var gotUser = SpecialPowers.wrap(iframe).contentDocument.getElementById("user").textContent; |
michael@0 | 89 | var gotPass = SpecialPowers.wrap(iframe).contentDocument.getElementById("pass").textContent; |
michael@0 | 90 | |
michael@0 | 91 | |
michael@0 | 92 | switch(testNum) { |
michael@0 | 93 | |
michael@0 | 94 | /* Basic Yes/No/Never tests... */ |
michael@0 | 95 | |
michael@0 | 96 | case 1: |
michael@0 | 97 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 98 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 99 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 100 | ok(popup, "got notification popup"); |
michael@0 | 101 | popup.remove(); |
michael@0 | 102 | break; |
michael@0 | 103 | |
michael@0 | 104 | case 2: |
michael@0 | 105 | // Same subtest, this time click Never |
michael@0 | 106 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 107 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 108 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 109 | ok(popup, "got notification popup"); |
michael@0 | 110 | is(true, pwmgr.getLoginSavingEnabled("http://mochi.test:8888"), |
michael@0 | 111 | "Checking for login saving enabled"); |
michael@0 | 112 | clickPopupButton(popup, kNeverButton); |
michael@0 | 113 | break; |
michael@0 | 114 | |
michael@0 | 115 | case 3: |
michael@0 | 116 | // Same subtest, make sure Never took effect |
michael@0 | 117 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 118 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 119 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 120 | ok(!popup, "checking for no notification popup"); |
michael@0 | 121 | is(false, pwmgr.getLoginSavingEnabled("http://mochi.test:8888"), |
michael@0 | 122 | "Checking for login saving disabled"); |
michael@0 | 123 | // reenable login saving. |
michael@0 | 124 | pwmgr.setLoginSavingEnabled("http://mochi.test:8888", true); |
michael@0 | 125 | break; |
michael@0 | 126 | |
michael@0 | 127 | case 4: |
michael@0 | 128 | // Same subtest, this time click Remember |
michael@0 | 129 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 130 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 131 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 132 | ok(popup, "got notification popup"); |
michael@0 | 133 | |
michael@0 | 134 | // Sanity check, no logins should exist yet. |
michael@0 | 135 | var logins = pwmgr.getAllLogins(); |
michael@0 | 136 | is(logins.length, 0, "Should not have any logins yet"); |
michael@0 | 137 | |
michael@0 | 138 | clickPopupButton(popup, kRememberButton); |
michael@0 | 139 | break; |
michael@0 | 140 | |
michael@0 | 141 | case 5: |
michael@0 | 142 | // Same subtest, make sure we didn't prompt for an existing login. |
michael@0 | 143 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 144 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 145 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 146 | ok(!popup, "checking for no notification popup"); |
michael@0 | 147 | |
michael@0 | 148 | // Check to make sure we updated the timestamps and use count on the |
michael@0 | 149 | // existing loging that was submitted for this form. |
michael@0 | 150 | var logins = pwmgr.getAllLogins(); |
michael@0 | 151 | is(logins.length, 1, "Should only have 1 login"); |
michael@0 | 152 | ok(SpecialPowers.call_Instanceof(logins[0], Ci.nsILoginMetaInfo), "metainfo QI"); |
michael@0 | 153 | is(logins[0].timesUsed, 2, "check .timesUsed for existing login submission"); |
michael@0 | 154 | ok(logins[0].timeLastUsed > logins[0].timeCreated, "timeLastUsed bumped"); |
michael@0 | 155 | ok(logins[0].timeCreated == logins[0].timePasswordChanged, "timeChanged not updated"); |
michael@0 | 156 | |
michael@0 | 157 | // remove that login |
michael@0 | 158 | pwmgr.removeLogin(login1); |
michael@0 | 159 | break; |
michael@0 | 160 | |
michael@0 | 161 | /* signons.rememberSignons pref tests... */ |
michael@0 | 162 | |
michael@0 | 163 | case 6: |
michael@0 | 164 | // Same subtest, make sure we're getting the popup again. |
michael@0 | 165 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 166 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 167 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 168 | ok(popup, "got notification popup"); |
michael@0 | 169 | popup.remove(); |
michael@0 | 170 | // Change prefs to no longer remember signons |
michael@0 | 171 | prefs.setBoolPref("rememberSignons", false); |
michael@0 | 172 | break; |
michael@0 | 173 | |
michael@0 | 174 | case 7: |
michael@0 | 175 | // Same subtest, make sure we're not prompting. |
michael@0 | 176 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 177 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 178 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 179 | ok(!popup, "checking for no notification popup"); |
michael@0 | 180 | // Change prefs to remember signons again |
michael@0 | 181 | prefs.setBoolPref("rememberSignons", true); |
michael@0 | 182 | break; |
michael@0 | 183 | |
michael@0 | 184 | case 8: |
michael@0 | 185 | // Same subtest, make sure we're getting the popup again. |
michael@0 | 186 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 187 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 188 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 189 | ok(popup, "got notification popup"); |
michael@0 | 190 | popup.remove(); |
michael@0 | 191 | break; |
michael@0 | 192 | |
michael@0 | 193 | /* autocomplete=off tests... */ |
michael@0 | 194 | |
michael@0 | 195 | case 9: |
michael@0 | 196 | // Check for notification popup when autocomplete=off present |
michael@0 | 197 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 198 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 199 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 200 | ok(popup, "checking for notification popup"); |
michael@0 | 201 | popup.remove(); |
michael@0 | 202 | break; |
michael@0 | 203 | |
michael@0 | 204 | case 10: |
michael@0 | 205 | // Check for notification popup when autocomplete=off present |
michael@0 | 206 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 207 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 208 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 209 | ok(popup, "checking for notification popup"); |
michael@0 | 210 | popup.remove(); |
michael@0 | 211 | break; |
michael@0 | 212 | |
michael@0 | 213 | case 11: |
michael@0 | 214 | // Check for notification popup when autocomplete=off present |
michael@0 | 215 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 216 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 217 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 218 | ok(popup, "checking for notification popup"); |
michael@0 | 219 | popup.remove(); |
michael@0 | 220 | break; |
michael@0 | 221 | |
michael@0 | 222 | /* no password field test... */ |
michael@0 | 223 | |
michael@0 | 224 | case 12: |
michael@0 | 225 | // Check for no notification popup when no password field present |
michael@0 | 226 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 227 | is(gotPass, "null", "Checking submitted password"); |
michael@0 | 228 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 229 | ok(!popup, "checking for no notification popup"); |
michael@0 | 230 | |
michael@0 | 231 | // Add login for the next test. |
michael@0 | 232 | pwmgr.addLogin(login2); |
michael@0 | 233 | break; |
michael@0 | 234 | |
michael@0 | 235 | case 13: |
michael@0 | 236 | // Check for no notification popup when existing pw-only login matches form. |
michael@0 | 237 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 238 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 239 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 240 | ok(!popup, "checking for no notification popup"); |
michael@0 | 241 | pwmgr.removeLogin(login2); |
michael@0 | 242 | |
michael@0 | 243 | // Add login for the next test |
michael@0 | 244 | pwmgr.addLogin(login1); |
michael@0 | 245 | break; |
michael@0 | 246 | |
michael@0 | 247 | case 14: |
michael@0 | 248 | // Check for no notification popup when pw-only form matches existing login. |
michael@0 | 249 | is(gotUser, "null", "Checking submitted username"); |
michael@0 | 250 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 251 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 252 | ok(!popup, "checking for no notification popup"); |
michael@0 | 253 | pwmgr.removeLogin(login1); |
michael@0 | 254 | |
michael@0 | 255 | // Add login for the next test |
michael@0 | 256 | pwmgr.addLogin(login2B); |
michael@0 | 257 | break; |
michael@0 | 258 | |
michael@0 | 259 | case 15: |
michael@0 | 260 | // Check for notification popup when existing pw-only login doesn't match form. |
michael@0 | 261 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 262 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 263 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 264 | ok(popup, "got notification popup"); |
michael@0 | 265 | pwmgr.removeLogin(login2B); |
michael@0 | 266 | popup.remove(); |
michael@0 | 267 | |
michael@0 | 268 | // Add login for the next test |
michael@0 | 269 | pwmgr.addLogin(login1B); |
michael@0 | 270 | break; |
michael@0 | 271 | |
michael@0 | 272 | case 16: |
michael@0 | 273 | // Check for notification popup when pw-only form doesn't match existing login. |
michael@0 | 274 | is(gotUser, "null", "Checking submitted username"); |
michael@0 | 275 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 276 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 277 | ok(popup, "got notification popup"); |
michael@0 | 278 | pwmgr.removeLogin(login1B); |
michael@0 | 279 | popup.remove(); |
michael@0 | 280 | |
michael@0 | 281 | // Add login for the next tests |
michael@0 | 282 | pwmgr.addLogin(login1); |
michael@0 | 283 | break; |
michael@0 | 284 | |
michael@0 | 285 | case 17: |
michael@0 | 286 | // Check for change-password popup, u+p login on u+p form. (not changed) |
michael@0 | 287 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 288 | is(gotPass, "pass2", "Checking submitted password"); |
michael@0 | 289 | popup = getPopup(popupNotifications, "password-change"); |
michael@0 | 290 | ok(popup, "got notification popup"); |
michael@0 | 291 | clickPopupButton(popup, kDontChangeButton); |
michael@0 | 292 | break; |
michael@0 | 293 | |
michael@0 | 294 | case 18: |
michael@0 | 295 | // Check for change-password popup, u+p login on u+p form. |
michael@0 | 296 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 297 | is(gotPass, "pass2", "Checking submitted password"); |
michael@0 | 298 | popup = getPopup(popupNotifications, "password-change"); |
michael@0 | 299 | ok(popup, "got notification popup"); |
michael@0 | 300 | clickPopupButton(popup, kChangeButton); |
michael@0 | 301 | |
michael@0 | 302 | // Check to make sure we updated the timestamps and use count for |
michael@0 | 303 | // the login being changed with this form. |
michael@0 | 304 | var logins = pwmgr.getAllLogins(); |
michael@0 | 305 | is(logins.length, 1, "Should only have 1 login"); |
michael@0 | 306 | ok(SpecialPowers.call_Instanceof(logins[0], Ci.nsILoginMetaInfo), "metainfo QI"); |
michael@0 | 307 | is(logins[0].timesUsed, 2, "check .timesUsed incremented on change"); |
michael@0 | 308 | ok(logins[0].timeCreated < logins[0].timeLastUsed, "timeLastUsed bumped"); |
michael@0 | 309 | ok(logins[0].timeLastUsed == logins[0].timePasswordChanged, "timeUsed == timeChanged"); |
michael@0 | 310 | |
michael@0 | 311 | // cleanup |
michael@0 | 312 | login1.password = "pass2"; |
michael@0 | 313 | pwmgr.removeLogin(login1); |
michael@0 | 314 | login1.password = "notifyp1"; |
michael@0 | 315 | |
michael@0 | 316 | // Add login for the next test |
michael@0 | 317 | pwmgr.addLogin(login2); |
michael@0 | 318 | break; |
michael@0 | 319 | |
michael@0 | 320 | // ...can't change a u+p login on a p-only form... |
michael@0 | 321 | |
michael@0 | 322 | case 19: |
michael@0 | 323 | // Check for change-password popup, p-only login on u+p form. |
michael@0 | 324 | // (needed a different subtest for this because the login created in |
michael@0 | 325 | // test_0init was interfering) |
michael@0 | 326 | is(gotUser, "", "Checking submitted username"); |
michael@0 | 327 | is(gotPass, "pass2", "Checking submitted password"); |
michael@0 | 328 | popup = getPopup(popupNotifications, "password-change"); |
michael@0 | 329 | ok(popup, "got notification popup"); |
michael@0 | 330 | clickPopupButton(popup, kChangeButton); |
michael@0 | 331 | break; |
michael@0 | 332 | |
michael@0 | 333 | case 20: |
michael@0 | 334 | // Check for change-password popup, p-only login on p-only form. |
michael@0 | 335 | is(gotUser, "null", "Checking submitted username"); |
michael@0 | 336 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 337 | popup = getPopup(popupNotifications, "password-change"); |
michael@0 | 338 | ok(popup, "got notification popup"); |
michael@0 | 339 | clickPopupButton(popup, kChangeButton); |
michael@0 | 340 | |
michael@0 | 341 | pwmgr.removeLogin(login2); |
michael@0 | 342 | break; |
michael@0 | 343 | |
michael@0 | 344 | case 21: |
michael@0 | 345 | // Check text on a user+pass notification popup |
michael@0 | 346 | is(gotUser, "notifyu1", "Checking submitted username"); |
michael@0 | 347 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 348 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 349 | ok(popup, "got notification popup"); |
michael@0 | 350 | // Check the text, which comes from the localized saveLoginText string. |
michael@0 | 351 | notificationText = popup.message; |
michael@0 | 352 | expectedText = /^Would you like to remember the password for \"notifyu1\" on example.org\?$/; |
michael@0 | 353 | ok(expectedText.test(notificationText), "Checking text: " + notificationText); |
michael@0 | 354 | popup.remove(); |
michael@0 | 355 | break; |
michael@0 | 356 | |
michael@0 | 357 | case 22: |
michael@0 | 358 | // Check text on a user+pass notification popup, username is really long |
michael@0 | 359 | is(gotUser, "nowisthetimeforallgoodmentocometotheaidoftheircountry", "Checking submitted username"); |
michael@0 | 360 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 361 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 362 | ok(popup, "got notification popup"); |
michael@0 | 363 | // Check the text, which comes from the localized saveLoginText string. |
michael@0 | 364 | notificationText = popup.message; |
michael@0 | 365 | expectedText = /^Would you like to remember the password for \"nowisthetimeforallgoodmentocom[^e]\" on example.org\?$/; |
michael@0 | 366 | ok(expectedText.test(notificationText), "Checking text: " + notificationText); |
michael@0 | 367 | popup.remove(); |
michael@0 | 368 | break; |
michael@0 | 369 | |
michael@0 | 370 | case 23: |
michael@0 | 371 | // Check text on a pass-only notification popup |
michael@0 | 372 | is(gotUser, "null", "Checking submitted username"); |
michael@0 | 373 | is(gotPass, "notifyp1", "Checking submitted password"); |
michael@0 | 374 | popup = getPopup(popupNotifications, "password-save"); |
michael@0 | 375 | ok(popup, "got notification popup"); |
michael@0 | 376 | // Check the text, which comes from the localized saveLoginTextNoUser string. |
michael@0 | 377 | notificationText = popup.message; |
michael@0 | 378 | expectedText = /^Would you like to remember the password on example.org\?$/; |
michael@0 | 379 | ok(expectedText.test(notificationText), "Checking text: " + notificationText); |
michael@0 | 380 | popup.remove(); |
michael@0 | 381 | break; |
michael@0 | 382 | |
michael@0 | 383 | default: |
michael@0 | 384 | ok(false, "Unexpected call to checkTest for test #" + testNum); |
michael@0 | 385 | |
michael@0 | 386 | } |
michael@0 | 387 | |
michael@0 | 388 | // TODO: |
michael@0 | 389 | // * existing login test, form has different password --> change password, no save prompt |
michael@0 | 390 | } |
michael@0 | 391 | |
michael@0 | 392 | const Ci = SpecialPowers.Ci; |
michael@0 | 393 | const Cc = SpecialPowers.Cc; |
michael@0 | 394 | ok(Ci != null, "Access Ci"); |
michael@0 | 395 | ok(Cc != null, "Access Cc"); |
michael@0 | 396 | |
michael@0 | 397 | var pwmgr = Cc["@mozilla.org/login-manager;1"]. |
michael@0 | 398 | getService(Ci.nsILoginManager); |
michael@0 | 399 | ok(pwmgr != null, "Access pwmgr"); |
michael@0 | 400 | |
michael@0 | 401 | pwmgr.removeAllLogins(); |
michael@0 | 402 | |
michael@0 | 403 | var prefs = Cc["@mozilla.org/preferences-service;1"]. |
michael@0 | 404 | getService(Ci.nsIPrefService); |
michael@0 | 405 | ok(prefs != null, "Access prefs"); |
michael@0 | 406 | prefs = prefs.getBranch("signon."); |
michael@0 | 407 | ok(prefs != null, "Access pref branch"); |
michael@0 | 408 | |
michael@0 | 409 | var nsLoginInfo = new SpecialPowers.wrap(SpecialPowers.Components).Constructor("@mozilla.org/login-manager/loginInfo;1", |
michael@0 | 410 | Ci.nsILoginInfo, "init"); |
michael@0 | 411 | var login1 = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null, |
michael@0 | 412 | "notifyu1", "notifyp1", "user", "pass"); |
michael@0 | 413 | var login2 = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null, |
michael@0 | 414 | "", "notifyp1", "", "pass"); |
michael@0 | 415 | var login1B = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null, |
michael@0 | 416 | "notifyu1B", "notifyp1B", "user", "pass"); |
michael@0 | 417 | var login2B = new nsLoginInfo("http://mochi.test:8888", "http://mochi.test:8888", null, |
michael@0 | 418 | "", "notifyp1B", "", "pass"); |
michael@0 | 419 | |
michael@0 | 420 | var iframe = document.getElementById("iframe"); |
michael@0 | 421 | iframe.onload = handleLoad; |
michael@0 | 422 | |
michael@0 | 423 | // popupNotifications (not *popup*) is a constant, per-tab container. So, we |
michael@0 | 424 | // only need to fetch it once. |
michael@0 | 425 | var popupNotifications = getPopupNotifications(window.top); |
michael@0 | 426 | ok(popupNotifications, "Got popupNotifications"); |
michael@0 | 427 | |
michael@0 | 428 | var testNum = 1; |
michael@0 | 429 | ok(true, "Starting test #" + testNum); |
michael@0 | 430 | iframe.src = subtests[testNum-1]; |
michael@0 | 431 | |
michael@0 | 432 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 433 | </script> |
michael@0 | 434 | </pre> |
michael@0 | 435 | </body> |
michael@0 | 436 | </html> |