toolkit/components/passwordmgr/test/test_bug_360493_1.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Test for Login Manager</title>
michael@0 5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 6 <script type="text/javascript" src="pwmgr_common.js"></script>
michael@0 7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
michael@0 8 </head>
michael@0 9 <body>
michael@0 10 Login Manager test: 360493
michael@0 11 <p id="display"></p>
michael@0 12 <div id="content" style="display: none">
michael@0 13
michael@0 14 <!-- normal form with normal relative action. -->
michael@0 15 <form id="form1" action="formtest.js">
michael@0 16 <input type="text" name="uname">
michael@0 17 <input type="password" name="pword">
michael@0 18
michael@0 19 <button type="submit">Submit</button>
michael@0 20 <button type="reset"> Reset </button>
michael@0 21 </form>
michael@0 22
michael@0 23 <!-- fully specify the action URL -->
michael@0 24 <form id="form2" action="http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/formtest.js">
michael@0 25 <input type="text" name="uname">
michael@0 26 <input type="password" name="pword">
michael@0 27
michael@0 28 <button type="submit">Submit</button>
michael@0 29 <button type="reset"> Reset </button>
michael@0 30 </form>
michael@0 31
michael@0 32 <!-- fully specify the action URL, and change the path -->
michael@0 33 <form id="form3" action="http://mochi.test:8888/zomg/wtf/bbq/passwordmgr/test/formtest.js">
michael@0 34 <input type="text" name="uname">
michael@0 35 <input type="password" name="pword">
michael@0 36
michael@0 37 <button type="submit">Submit</button>
michael@0 38 <button type="reset"> Reset </button>
michael@0 39 </form>
michael@0 40
michael@0 41 <!-- fully specify the action URL, and change the path and filename -->
michael@0 42 <form id="form4" action="http://mochi.test:8888/zomg/wtf/bbq/passwordmgr/test/not_a_test.js">
michael@0 43 <input type="text" name="uname">
michael@0 44 <input type="password" name="pword">
michael@0 45
michael@0 46 <button type="submit">Submit</button>
michael@0 47 <button type="reset"> Reset </button>
michael@0 48 </form>
michael@0 49
michael@0 50 <!-- specify the action URL relative to the current document-->
michael@0 51 <form id="form5" action="./formtest.js">
michael@0 52 <input type="text" name="uname">
michael@0 53 <input type="password" name="pword">
michael@0 54
michael@0 55 <button type="submit">Submit</button>
michael@0 56 <button type="reset"> Reset </button>
michael@0 57 </form>
michael@0 58
michael@0 59 <!-- specify the action URL relative to the current server -->
michael@0 60 <form id="form6" action="/tests/toolkit/components/passwordmgr/test/formtest.js">
michael@0 61 <input type="text" name="uname">
michael@0 62 <input type="password" name="pword">
michael@0 63
michael@0 64 <button type="submit">Submit</button>
michael@0 65 <button type="reset"> Reset </button>
michael@0 66 </form>
michael@0 67
michael@0 68 <!-- Change the method from get to post -->
michael@0 69 <form id="form7" action="formtest.js" method="POST">
michael@0 70 <input type="text" name="uname">
michael@0 71 <input type="password" name="pword">
michael@0 72
michael@0 73 <button type="submit">Submit</button>
michael@0 74 <button type="reset"> Reset </button>
michael@0 75 </form>
michael@0 76
michael@0 77 <!-- Blank action URL specified -->
michael@0 78 <form id="form8" action="">
michael@0 79 <input type="text" name="uname">
michael@0 80 <input type="password" name="pword">
michael@0 81
michael@0 82 <button type="submit">Submit</button>
michael@0 83 <button type="reset"> Reset </button>
michael@0 84 </form>
michael@0 85
michael@0 86 <!-- |action| attribute entirely missing -->
michael@0 87 <form id="form9" >
michael@0 88 <input type="text" name="uname">
michael@0 89 <input type="password" name="pword">
michael@0 90
michael@0 91 <button type="submit">Submit</button>
michael@0 92 <button type="reset"> Reset </button>
michael@0 93 </form>
michael@0 94
michael@0 95 <!-- action url as javascript -->
michael@0 96 <form id="form10" action="javascript:alert('this form is not submitted so this alert should not be invoked');">
michael@0 97 <input type="text" name="uname">
michael@0 98 <input type="password" name="pword">
michael@0 99
michael@0 100 <button type="submit">Submit</button>
michael@0 101 <button type="reset"> Reset </button>
michael@0 102 </form>
michael@0 103
michael@0 104 <!-- TODO: action=IP.ADDRESS instead of HOSTNAME? -->
michael@0 105 <!-- TODO: test with |base href="http://othersite//"| ? -->
michael@0 106 </div>
michael@0 107 <pre id="test">
michael@0 108 <script class="testbody" type="text/javascript">
michael@0 109
michael@0 110 /** Test for Login Manager: 360493 (Cross-Site Forms + Password
michael@0 111 Manager = Security Failure) **/
michael@0 112
michael@0 113 // This test is designed to make sure variations on the form's |action|
michael@0 114 // and |method| continue to work with the fix for 360493.
michael@0 115
michael@0 116 commonInit();
michael@0 117
michael@0 118 function startTest() {
michael@0 119 for (var i = 1; i <= 9; i++) {
michael@0 120 // Check form i
michael@0 121 is($_(i, "uname").value, "testuser", "Checking for filled username " + i);
michael@0 122 is($_(i, "pword").value, "testpass", "Checking for filled password " + i);
michael@0 123 }
michael@0 124
michael@0 125 // The login's formSubmitURL isn't "javascript:", so don't fill it in.
michael@0 126 isnot($_(10, "uname"), "testuser", "Checking username w/ JS action URL");
michael@0 127 isnot($_(10, "pword"), "testpass", "Checking password w/ JS action URL");
michael@0 128
michael@0 129 SimpleTest.finish();
michael@0 130 }
michael@0 131
michael@0 132 window.onload = startTest;
michael@0 133
michael@0 134 SimpleTest.waitForExplicitFinish();
michael@0 135
michael@0 136 </script>
michael@0 137 </pre>
michael@0 138 </body>
michael@0 139 </html>
michael@0 140

mercurial