|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=942470 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 942470</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=942470">Mozilla Bug 942470</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 </div> |
|
16 <pre id="test"> |
|
17 <script class="testbody" type="text/javascript"> |
|
18 |
|
19 /** Test for Bug 942470 **/ |
|
20 |
|
21 function getUA(host) { |
|
22 var url = location.pathname; |
|
23 url = host + url.slice(0, url.lastIndexOf('/')) + '/user_agent.sjs'; |
|
24 |
|
25 var xhr = new XMLHttpRequest(); |
|
26 xhr.open('GET', url, false); // sync request |
|
27 xhr.send(); |
|
28 is(xhr.status, 200, 'request failed'); |
|
29 is(typeof xhr.response, 'string', 'invalid response'); |
|
30 return xhr.response; |
|
31 } |
|
32 |
|
33 const UA_OVERRIDE = "DummyUserAgent"; |
|
34 |
|
35 info("User agent is " + navigator.userAgent); |
|
36 isnot(navigator.userAgent, UA_OVERRIDE, |
|
37 "navigator.userAgent is not reverted"); |
|
38 isnot(getUA(location.origin), UA_OVERRIDE, |
|
39 "User-Agent is not reverted"); |
|
40 |
|
41 </script> |
|
42 </pre> |
|
43 </body> |
|
44 </html> |