tor-browser

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

response-static-error.any.js (974B)


      1 // META: global=window,worker
      2 // META: title=Response: error static method
      3 
      4 test(function() {
      5  var responseError = Response.error();
      6  assert_equals(responseError.type, "error", "Network error response's type is error");
      7  assert_equals(responseError.status, 0, "Network error response's status is 0");
      8  assert_equals(responseError.statusText, "", "Network error response's statusText is empty");
      9  assert_equals(responseError.body, null, "Network error response's body is null");
     10 
     11  assert_true(responseError.headers.entries().next().done, "Headers should be empty");
     12 }, "Check response returned by static method error()");
     13 
     14 test(function() {
     15  const headers = Response.error().headers;
     16 
     17  // Avoid false positives if expected API is not available
     18  assert_true(!!headers);
     19  assert_equals(typeof headers.append, 'function');
     20 
     21  assert_throws_js(TypeError, function () { headers.append('name', 'value'); });
     22 }, "the 'guard' of the Headers instance should be immutable");