2013-12-04 09:15:43 +00:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
const URL = ROOT + "browser_454908_sample.html";
|
|
|
|
const PASS = "pwd-" + Math.random();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Bug 454908 - Don't save/restore values of password fields.
|
|
|
|
*/
|
2014-06-24 14:51:22 +00:00
|
|
|
add_task(function* test_dont_save_passwords() {
|
2013-12-04 09:15:43 +00:00
|
|
|
// Make sure we do save form data.
|
|
|
|
Services.prefs.clearUserPref("browser.sessionstore.privacy_level");
|
|
|
|
|
|
|
|
// Add a tab with a password field.
|
|
|
|
let tab = gBrowser.addTab(URL);
|
|
|
|
let browser = tab.linkedBrowser;
|
|
|
|
yield promiseBrowserLoaded(browser);
|
|
|
|
|
|
|
|
// Fill in some values.
|
|
|
|
let usernameValue = "User " + Math.random();
|
|
|
|
yield setInputValue(browser, {id: "username", value: usernameValue});
|
|
|
|
yield setInputValue(browser, {id: "passwd", value: PASS});
|
|
|
|
|
|
|
|
// Close and restore the tab.
|
2015-04-28 14:30:47 +00:00
|
|
|
yield promiseRemoveTab(tab);
|
2013-12-04 09:15:43 +00:00
|
|
|
tab = ss.undoCloseTab(window, 0);
|
|
|
|
browser = tab.linkedBrowser;
|
|
|
|
yield promiseTabRestored(tab);
|
|
|
|
|
|
|
|
// Check that password fields aren't saved/restored.
|
|
|
|
let username = yield getInputValue(browser, {id: "username"});
|
|
|
|
is(username, usernameValue, "username was saved/restored");
|
|
|
|
let passwd = yield getInputValue(browser, {id: "passwd"});
|
|
|
|
is(passwd, "", "password wasn't saved/restored");
|
|
|
|
|
|
|
|
// Write to disk and read our file.
|
2014-06-24 14:51:22 +00:00
|
|
|
yield forceSaveState();
|
|
|
|
yield promiseForEachSessionRestoreFile((state, key) =>
|
|
|
|
// Ensure that we have not saved our password.
|
2015-04-29 15:32:05 +00:00
|
|
|
ok(!state.includes(PASS), "password has not been written to file " + key)
|
2014-06-24 14:51:22 +00:00
|
|
|
);
|
2013-12-04 09:15:43 +00:00
|
|
|
|
|
|
|
// Cleanup.
|
|
|
|
gBrowser.removeTab(tab);
|
|
|
|
});
|