tor-browser

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

response-error.any.js (1056B)


      1 // META: global=window,worker
      2 // META: title=Response error
      3 
      4 var invalidStatus = [0, 100, 199, 600, 1000];
      5 invalidStatus.forEach(function(status) {
      6  test(function() {
      7    assert_throws_js(RangeError, function() { new Response("", { "status" : status }); },
      8      "Expect RangeError exception when status is " + status);
      9  },"Throws RangeError when responseInit's status is " + status);
     10 });
     11 
     12 var invalidStatusText = ["\n", "Ā"];
     13 invalidStatusText.forEach(function(statusText) {
     14  test(function() {
     15    assert_throws_js(TypeError, function() { new Response("", { "statusText" : statusText }); },
     16      "Expect TypeError exception " + statusText);
     17  },"Throws TypeError when responseInit's statusText is " + statusText);
     18 });
     19 
     20 var nullBodyStatus = [204, 205, 304];
     21 nullBodyStatus.forEach(function(status) {
     22  test(function() {
     23    assert_throws_js(TypeError,
     24      function() { new Response("body", {"status" : status }); },
     25      "Expect TypeError exception ");
     26  },"Throws TypeError when building a response with body and a body status of " + status);
     27 });