diff options
Diffstat (limited to 'toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html')
-rw-r--r-- | toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html b/toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html new file mode 100644 index 0000000000..717805f06a --- /dev/null +++ b/toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html @@ -0,0 +1,44 @@ +<!DOCTYPE HTML> +<html> +<head> + <meta charset="utf-8"> + <title>Test forms with a JS submit action</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script type="text/javascript" src="pwmgr_common.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body> +Login Manager test: form with JS submit action +<script> + +add_setup(async () => { + await setStoredLoginsAsync( + [location.origin, "javascript:", null, "jsuser", "jspass123", "uname", "pword"] + ); +}); + +/** Test for Login Manager: JS action URL **/ +add_task(async function startTest() { + const win = window.open("about:blank"); + SimpleTest.registerCleanupFunction(() => win.close()); + await loadFormIntoWindow(location.origin, ` + <form id='form1' action='javascript:alert("never shows")'> 1 + <input name="uname"> + <input name="pword" type="password"> + + <button type='submit'>Submit</button> + <button type='reset'> Reset </button> + </form>`, win); + + await checkLoginFormInFrameWithElementValues(win, 1, "jsuser", "jspass123"); +}); +</script> + +<p id="display"></p> + +<div id="content" style="display: none"> +</div> + +<pre id="test"></pre> +</body> +</html> |