toolkit/components/passwordmgr/test/mochitest/test_form_action_javascript.html
author Ryan VanderMeulen <ryanvm@gmail.com>
Fri, 25 Mar 2016 22:08:15 -0400
changeset 290550 f3d7946a5cb969f875790b8685092b841985d320
parent 246701 toolkit/components/passwordmgr/test/test_form_action_javascript.html@db74910400e6617fcd89f86e2c7e90598c65a2fe
parent 290418 toolkit/components/passwordmgr/test/test_form_action_javascript.html@b903047d9572a456eed53377f12b24b1354c1135
permissions -rw-r--r--
Merge m-c to inbound. a=merge

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Test forms with a JS submit action</title>
  <script type="text/javascript" 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>
runChecksAfterCommonInit(() => startTest());

runInParent(function setup() {
  const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
  Cu.import("resource://gre/modules/Services.jsm");

  let jslogin = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance(Ci.nsILoginInfo);
  jslogin.init("http://mochi.test:8888", "javascript:", null,
              "jsuser", "jspass123", "uname", "pword");
  Services.logins.addLogin(jslogin);
});

/** Test for Login Manager: JS action URL **/

function startTest() {
    checkForm(1, "jsuser", "jspass123");

    SimpleTest.finish();
}
</script>

<p id="display"></p>

<div id="content" style="display: none">


<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>

</div>

<pre id="test"></pre>
</body>
</html>