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=819051 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 819051</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 onload="test_headers_append();"> |
michael@0 | 12 | <script class="testbody" type="text/javascript"> |
michael@0 | 13 | |
michael@0 | 14 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 15 | |
michael@0 | 16 | var url = "http://mochi.test:8888/tests/content/base/test/bug819051.sjs"; |
michael@0 | 17 | |
michael@0 | 18 | function test_headers_append() |
michael@0 | 19 | { |
michael@0 | 20 | var xhr = new XMLHttpRequest(); |
michael@0 | 21 | xhr.open("GET", url); |
michael@0 | 22 | xhr.setRequestHeader("X-appended-to-this", "True"); |
michael@0 | 23 | xhr.setRequestHeader("X-appended-to-this", "False"); |
michael@0 | 24 | |
michael@0 | 25 | xhr.onreadystatechange = function() { |
michael@0 | 26 | if (this.readyState == 4) { |
michael@0 | 27 | is(xhr.getResponseHeader("X-appended-result"), "True, False", "Headers should have been appended."); |
michael@0 | 28 | test_headers_clear(); |
michael@0 | 29 | } |
michael@0 | 30 | } |
michael@0 | 31 | |
michael@0 | 32 | xhr.send(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function test_headers_clear() |
michael@0 | 36 | { |
michael@0 | 37 | var xhr = new XMLHttpRequest(); |
michael@0 | 38 | xhr.open("GET", url); |
michael@0 | 39 | xhr.setRequestHeader("X-appended-to-this", "True"); |
michael@0 | 40 | xhr.setRequestHeader("Accept", "foo/bar"); |
michael@0 | 41 | |
michael@0 | 42 | xhr.open("GET", url); |
michael@0 | 43 | xhr.setRequestHeader("X-appended-to-this", "True"); |
michael@0 | 44 | xhr.setRequestHeader("Accept", "bar/foo"); |
michael@0 | 45 | |
michael@0 | 46 | xhr.onreadystatechange = function() { |
michael@0 | 47 | if (this.readyState == 4) { |
michael@0 | 48 | is(xhr.getResponseHeader("X-Accept-Result"), "bar/foo", "Set headers record should have been cleared by open."); |
michael@0 | 49 | SimpleTest.finish(); |
michael@0 | 50 | } |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | xhr.send(); |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | </script> |
michael@0 | 57 | </pre> |
michael@0 | 58 | </body> |
michael@0 | 59 | </html> |