tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

send-network-error-sync-events.sub.htm (1545B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4    <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dt[4] following::dd[4]/p" />
      5    <link rel="help" href="https://xhr.spec.whatwg.org/#network-error" data-tested-assertations=".." />
      6    <link rel="help" href="https://xhr.spec.whatwg.org/#request-error" data-tested-assertations="following::ol[1]/li[4] following::ol[1]/li[5]" />
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <title>XMLHttpRequest: The send() method: Throw a "throw an "NetworkError" exception when Network error happens (synchronous flag is set)</title>
     10 </head>
     11 
     12 <body>
     13    <div id="log"></div>
     14 
     15    <script type="text/javascript">
     16        test(function()
     17        {
     18            var xhr = new XMLHttpRequest();
     19 
     20            xhr.open("POST", "http://{{host}}:1", false); // Bad port.
     21 
     22            assert_throws_dom("NetworkError", function()
     23            {
     24                xhr.send("Test Message");
     25            });
     26            assert_equals(xhr.readyState, 4)
     27 
     28        }, "http URL");
     29 
     30        test(function()
     31        {
     32            var xhr = new XMLHttpRequest();
     33 
     34            xhr.open("GET", "data:text/html;charset=utf-8;base64,PT0NUWVBFIGh0bWw%2BDQo8", false);
     35 
     36            assert_throws_dom("NetworkError", function()
     37            {
     38                xhr.send("Test Message");
     39            });
     40            assert_equals(xhr.readyState, 4)
     41 
     42        }, "data URL");
     43    </script>
     44 </body>
     45 </html>