LCOV - code coverage report
Current view: top level - test/wpt/xhr - open-method-bogus.js (source / functions) Hit Total Coverage
Test: lcov.info Lines: 67 67 100.0 %
Date: 2025-01-24 02:02:48 Functions: 4 4 100.0 %
Branches: 5 5 100.0 %

           Branch data     Line data    Source code
       1            [ + ]:          1 : import assert from 'node:assert/strict';
       2                 :          1 : import { XMLHttpRequest } from '../../../lib/whatwg-xhr.js';
       3                 :          1 : 
       4            [ + ]:          1 : export default (activeURL) => {
       5                 :          1 : 
       6                 :          1 :         let client = new XMLHttpRequest();
       7                 :          1 : 
       8                 :          1 :         method('>');
       9                 :          1 :         method('');
      10                 :          1 :         method(' GET');
      11                 :          1 :         method('G T');
      12                 :          1 :         method('@GET');
      13                 :          1 :         method('G:ET');
      14                 :          1 :         method('GET?');
      15                 :          1 :         method('GET\n');
      16                 :          1 : 
      17            [ + ]:          1 :         function method(method){
      18                 :          8 :                 assert.throws(
      19            [ + ]:          8 :                         () => {
      20                 :          8 :                                 client.open(method, '...');
      21                 :          8 :                         },
      22            [ + ]:          8 :                         (err) => {
      23                 :          8 :                                 assert(err instanceof DOMException, 'DOMException expected');
      24                 :          8 :                                 assert(err.name === 'SyntaxError', 'SyntaxError expected');
      25                 :          8 : 
      26                 :          8 :                                 return true;
      27                 :          8 :                         }
      28                 :          8 :                 );
      29                 :          8 :         }
      30                 :          1 : }
      31                 :          1 : 
      32                 :          1 : /*
      33                 :          1 :  * open-method-bogus.htm
      34                 :          1 :  *
      35                 :          1 : 
      36                 :          1 : <!DOCTYPE html>
      37                 :          1 : <html>
      38                 :          1 :   <head>
      39                 :          1 :     <title>XMLHttpRequest: open() - bogus methods</title>
      40                 :          1 :     <script src="/resources/testharness.js"></script>
      41                 :          1 :     <script src="/resources/testharnessreport.js"></script>
      42                 :          1 :     <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[4]" />
      43                 :          1 :   </head>
      44                 :          1 :   <body>
      45                 :          1 :     <div id="log"></div>
      46                 :          1 :     <script>
      47                 :          1 :       function method(method) {
      48                 :          1 :         test(function() {
      49                 :          1 :           var client = new XMLHttpRequest()
      50                 :          1 :           assert_throws_dom("SyntaxError", function() { client.open(method, "...") })
      51                 :          1 :         }, document.title + " (" + method + ")")
      52                 :          1 :       }
      53                 :          1 :       method("")
      54                 :          1 :       method(">")
      55                 :          1 :       method(" GET")
      56                 :          1 :       method("G T")
      57                 :          1 :       method("@GET")
      58                 :          1 :       method("G:ET")
      59                 :          1 :       method("GET?")
      60                 :          1 :       method("GET\n")
      61                 :          1 :     </script>
      62                 :          1 :   </body>
      63                 :          1 : </html>
      64                 :          1 : 
      65                 :          1 :  *
      66                 :          1 :  * open-method-bogus.htm
      67                 :          1 :  */

Generated by: LCOV version 1.14