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