netwerk/test/mochitests/test_user_agent_updates_reset.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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">
    19 /** Test for Bug 942470 **/
    21 function getUA(host) {
    22   var url = location.pathname;
    23   url = host + url.slice(0, url.lastIndexOf('/')) + '/user_agent.sjs';
    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 }
    33 const UA_OVERRIDE = "DummyUserAgent";
    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");
    41 </script>
    42 </pre>
    43 </body>
    44 </html>

mercurial