1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/passwordmgr/test/test_basic_form_pwevent.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=355063 1.8 +--> 1.9 +<head> 1.10 + <meta charset="utf-8"/> 1.11 + <title>Test for Bug 355063</title> 1.12 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 + <script type="text/javascript" src="pwmgr_common.js"></script> 1.15 + <script type="application/javascript"> 1.16 + /** Test for Bug 355063 **/ 1.17 + 1.18 + function startTest() { 1.19 + info("startTest"); 1.20 + addForm(); 1.21 + } 1.22 + 1.23 + function addForm() { 1.24 + info("addForm"); 1.25 + var c = document.getElementById("content"); 1.26 + c.innerHTML = "<form id=form1>form1: <input id=u1><input type=password id=p1></form><br>"; 1.27 + } 1.28 + 1.29 + function checkForm() { 1.30 + info("checkForm"); 1.31 + var userField = document.getElementById("u1"); 1.32 + var passField = document.getElementById("p1"); 1.33 + is(userField.value, "testuser", "checking filled username"); 1.34 + is(passField.value, "testpass", "checking filled password"); 1.35 + 1.36 + SpecialPowers.removeChromeEventListener("DOMFormHasPassword", checkForm); 1.37 + SimpleTest.finish(); 1.38 + } 1.39 + 1.40 + commonInit(); 1.41 + 1.42 + // Password Manager's own listener should always have been added first, so 1.43 + // the test's listener should be called after the pwmgr's listener fills in 1.44 + // a login. 1.45 + // 1.46 + SpecialPowers.addChromeEventListener("DOMFormHasPassword", checkForm); 1.47 + window.addEventListener("load", startTest); 1.48 + SimpleTest.waitForExplicitFinish(); 1.49 +</script> 1.50 +</head> 1.51 +<body> 1.52 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=355063">Mozilla Bug 355063</a> 1.53 +<p id="display"></p> 1.54 +<div id="content"> 1.55 +forms go here! 1.56 +</div> 1.57 +<pre id="test"> 1.58 +</pre> 1.59 +</body> 1.60 +</html>