LCOV - code coverage report
Current view: top level - test/wpt/xhr - xmlhttprequest-network-error.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 71 71 100.0 %
Date: 2024-12-07 00:20:21 Functions: 2 2 100.0 %
Branches: 4 4 100.0 %

           Branch data     Line data    Source code
       1            [ + ]:          2 : import assert from 'node:assert/strict';
       2                 :          2 : import { XMLHttpRequest } from '../../../lib/whatwg-xhr.js';
       3                 :          2 : 
       4            [ + ]:          2 : export default (activeURL) => {
       5                 :          1 : 
       6                 :          1 :         let xhr = new XMLHttpRequest();
       7                 :          1 : 
       8            [ + ]:          1 :         xhr.onreadystatechange = () => {
       9                 :          2 : 
      10                 :          2 :                 assert.strictEqual(xhr.status, 0, 'status');
      11                 :          2 :                 assert.strictEqual(xhr.statusText, '', 'statusText');
      12                 :          2 :                 assert.strictEqual(xhr.getAllResponseHeaders(), '', 'getAllResponseHeaders');
      13                 :          2 :                 assert.strictEqual(xhr.getResponseHeader('content-type'), null, 'getResponseHeader');
      14                 :          2 :                 assert.strictEqual(xhr.responseText, '', 'responseText');
      15                 :          2 :                 assert.strictEqual(xhr.responseXML, null, 'responseXML');
      16                 :          2 : 
      17                 :          2 :                 if(xhr.readyState === 4)
      18            [ + ]:          2 :                         xhr.onreadystatechange = null;
      19                 :          1 :         };
      20                 :          1 : 
      21                 :          1 :         xhr.open('GET', `${activeURL}/infinite-redirects.py?`);
      22                 :          1 :         xhr.send();
      23                 :          1 : }
      24                 :          2 : 
      25                 :          2 : /*
      26                 :          2 :  * xmlhttprequest-network-error.htm
      27                 :          2 :  *
      28                 :          2 : 
      29                 :          2 : <!DOCTYPE html>
      30                 :          2 : <html>
      31                 :          2 :   <head>
      32                 :          2 :     <title>XMLHttpRequest: members during network errors</title>
      33                 :          2 :     <script src="/resources/testharness.js"></script>
      34                 :          2 :     <script src="/resources/testharnessreport.js"></script>
      35                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#infrastructure-for-the-send()-method" data-tested-assertations="following::dl[1]/dt[2] following::dl[1]/dd[2]/ol/li[1] following::dl[1]/dd[2]/ol/li[2]" />
      36                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-status-attribute" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]" />
      37                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-statustext-attribute" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]" />
      38                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-getresponseheader()-method" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]" />
      39                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method" data-tested-assertations="following::ol[1]/li[1] following::ol[1]/li[2]" />
      40                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsetext-attribute" data-tested-assertations="following::ol[1]/li[2] following::ol[1]/li[3]" />
      41                 :          2 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-responsexml-attribute" data-tested-assertations="following::ol[1]/li[2] following::ol[1]/li[3]" />
      42                 :          2 : 
      43                 :          2 :   </head>
      44                 :          2 :   <body>
      45                 :          2 :     <div id="log"></div>
      46                 :          2 :     <script>
      47                 :          2 :       var test = async_test()
      48                 :          2 :       test.step(function() {
      49                 :          2 :         var client = new XMLHttpRequest()
      50                 :          2 :         client.onreadystatechange = function() {
      51                 :          2 :           test.step(function() {
      52                 :          2 :             assert_equals(client.status, 0, "status")
      53                 :          2 :             assert_equals(client.statusText, "", "statusText")
      54                 :          2 :             assert_equals(client.getAllResponseHeaders(), "", "getAllResponseHeaders")
      55                 :          2 :             assert_equals(client.getResponseHeader("content-type"), null, "getResponseHeader")
      56                 :          2 :             assert_equals(client.responseText, "", "responseText")
      57                 :          2 :             assert_equals(client.responseXML, null, "responseXML")
      58                 :          2 :             if(client.readyState == 4)
      59                 :          2 :               test.done()
      60                 :          2 :           })
      61                 :          2 :         }
      62                 :          2 :         client.open("GET", "resources/infinite-redirects.py")
      63                 :          2 :         client.send(null)
      64                 :          2 :       })
      65                 :          2 :   </script>
      66                 :          2 :  </body>
      67                 :          2 : </html>
      68                 :          2 : 
      69                 :          2 :  *
      70                 :          2 :  * xmlhttprequest-network-error.htm
      71                 :          2 :  */

Generated by: LCOV version 1.14