content/base/test/test_bug804395.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.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=804395
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test for Bug 804395</title>
     9   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=804395">Mozilla Bug 804395</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    17 </div>
    18 <pre id="test">
    19 <script type="application/javascript">
    21 function test200() {
    22   var xhr = new XMLHttpRequest({mozAnon: true, mozSystem: true});
    23   xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.bar', true);
    24   xhr.onreadystatechange = function() {
    25     if (xhr.readyState == 4) {
    26       ok(xhr.status == 200, "Existing file must have Status 200!");
    27       runTests();
    28     }
    29   }
    30   xhr.send(null);
    31 }
    33 function test404() {
    34   var xhr = new XMLHttpRequest({mozAnon: true, mozSystem: true});
    35   xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.do_not_exist', true);
    36   xhr.onreadystatechange = function() {
    37     if (xhr.readyState == 4) {
    38       ok(xhr.status == 404, "Non existing file must have Status 404!");
    39       runTests();
    40     }
    41   }
    42   xhr.send(null);
    43 }
    45 function test0() {
    46   var xhr = new XMLHttpRequest({mozAnon: true, mozSystem: true});
    47   xhr.open('GET', 'jar:http://example.org/tests/content/base/test/file_bug804395.jar!/foo.bar', true);
    48   ok(xhr.status == 0, "Not Sent request must have status 0");
    49   runTests();
    50 }
    52 var tests = [ test200, test404, test0 ];
    53 function runTests() {
    54   if (!tests.length) {
    55     SimpleTest.finish();
    56     return;
    57   }
    59   var test = tests.shift();
    60   test();
    61 }
    63 /** Test for Bug 804395 **/
    64 SimpleTest.waitForExplicitFinish();
    66 addLoadEvent(function() {
    67    SpecialPowers.pushPermissions([{'type': 'systemXHR', 'allow': true, 'context': document}], runTests);
    68 });
    69 </script>
    70 </pre>
    71 </body>
    72 </html>

mercurial