tor-browser

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

request-error.js (1616B)


      1 const badRequestArgTests = [
      2  {
      3    args: ["", { "window": "http://test.url" }],
      4    testName: "RequestInit's window is not null"
      5  },
      6  {
      7    args: ["http://:not a valid URL"],
      8    testName: "Input URL is not valid"
      9  },
     10  {
     11    args: ["http://user:pass@test.url"],
     12    testName: "Input URL has credentials"
     13  },
     14  {
     15    args: ["", { "mode": "navigate" }],
     16    testName: "RequestInit's mode is navigate"
     17  },
     18  {
     19    args: ["", { "referrer": "http://:not a valid URL" }],
     20    testName: "RequestInit's referrer is invalid"
     21  },
     22  {
     23    args: ["", { "method": "IN VALID" }],
     24    testName: "RequestInit's method is invalid"
     25  },
     26  {
     27    args: ["", { "method": "TRACE" }],
     28    testName: "RequestInit's method is forbidden"
     29  },
     30  {
     31    args: ["", { "mode": "no-cors", "method": "PUT" }],
     32    testName: "RequestInit's mode is no-cors and method is not simple"
     33  },
     34  {
     35    args: ["", { "mode": "cors", "cache": "only-if-cached" }],
     36    testName: "RequestInit's cache mode is only-if-cached and mode is not same-origin"
     37  },
     38  {
     39    args: ["test", { "cache": "only-if-cached", "mode": "cors" }],
     40    testName: "Request with cache mode: only-if-cached and fetch mode cors"
     41  },
     42  {
     43    args: ["test", { "cache": "only-if-cached", "mode": "no-cors" }],
     44    testName: "Request with cache mode: only-if-cached and fetch mode no-cors"
     45  }
     46 ];
     47 
     48 badRequestArgTests.push(
     49  ...["referrerPolicy", "mode", "credentials", "cache", "redirect"].map(optionProp => {
     50    const options = {};
     51    options[optionProp] = "BAD";
     52    return {
     53      args: ["", options],
     54      testName: `Bad ${optionProp} init parameter value`
     55    };
     56  })
     57 );