Wed, 31 Dec 2014 06:09:35 +0100
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 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=313646 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 313646</title> |
michael@0 | 8 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 9 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=313646">Mozilla Bug 313646</a> |
michael@0 | 13 | <p id="display"></p> |
michael@0 | 14 | <div id="content" style="display: none"> |
michael@0 | 15 | |
michael@0 | 16 | </div> |
michael@0 | 17 | <pre id="test"> |
michael@0 | 18 | <script class="testbody" type="text/javascript"> |
michael@0 | 19 | |
michael@0 | 20 | /** Test for Bug 313646 **/ |
michael@0 | 21 | |
michael@0 | 22 | // content/base/test/bug313646.txt |
michael@0 | 23 | |
michael@0 | 24 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 25 | |
michael@0 | 26 | var count1 = 0; |
michael@0 | 27 | var count2 = 0; |
michael@0 | 28 | var count3 = 0; |
michael@0 | 29 | var count4 = 0; |
michael@0 | 30 | var innerXHRDone = 0; |
michael@0 | 31 | var req = new XMLHttpRequest(); |
michael@0 | 32 | req.onreadystatechange = function(evt) { |
michael@0 | 33 | ++window["count" + evt.target.readyState]; |
michael@0 | 34 | |
michael@0 | 35 | // Do something a bit evil, start a new sync XHR in |
michael@0 | 36 | // readyStateChange listener. |
michael@0 | 37 | var innerXHR = new XMLHttpRequest(); |
michael@0 | 38 | innerXHR.onreadystatechange = function(e) { |
michael@0 | 39 | if (e.target.readyState == 4) { |
michael@0 | 40 | ++innerXHRDone; |
michael@0 | 41 | } |
michael@0 | 42 | } |
michael@0 | 43 | innerXHR.open("GET","bug313646.txt", false); |
michael@0 | 44 | innerXHR.send(); |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | // make the synchronous request |
michael@0 | 48 | req.open("GET","bug313646.txt", false); |
michael@0 | 49 | req.send(); |
michael@0 | 50 | |
michael@0 | 51 | ok(count1, "XMLHttpRequest wasn't in state 1"); |
michael@0 | 52 | is(count2, 0, "XMLHttpRequest shouldn't have been in state 2"); |
michael@0 | 53 | is(count3, 0, "XMLHttpRequest shouldn't have been in state 3"); |
michael@0 | 54 | ok(count4, "XMLHttpRequest wasn't in state 4"); |
michael@0 | 55 | is(innerXHRDone, 2, "There should have been 2 inner XHRs."); |
michael@0 | 56 | |
michael@0 | 57 | SimpleTest.finish(); |
michael@0 | 58 | |
michael@0 | 59 | </script> |
michael@0 | 60 | </pre> |
michael@0 | 61 | </body> |
michael@0 | 62 | </html> |