tor-browser

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

request-init-priority.any.js (965B)


      1 var priorities = ["high",
      2                  "low",
      3                  "auto"
      4                 ];
      5 
      6 for (idx in priorities) {
      7  test(() => {
      8    new Request("", {priority: priorities[idx]});
      9  }, "new Request() with a '"  + priorities[idx] + "' priority does not throw an error");
     10 }
     11 
     12 test(() => {
     13  assert_throws_js(TypeError, () => {
     14    new Request("", {priority: 'invalid'});
     15  }, "a new Request() must throw a TypeError if RequestInit's priority is an invalid value");
     16 }, "new Request() throws a TypeError if any of RequestInit's members' values are invalid");
     17 
     18 for (idx in priorities) {
     19  promise_test(function(t) {
     20    return fetch('hello.txt', { priority: priorities[idx] });
     21  }, "fetch() with a '"  + priorities[idx] + "' priority completes successfully");
     22 }
     23 
     24 promise_test(function(t) {
     25  return promise_rejects_js(t, TypeError, fetch('hello.txt', { priority: 'invalid' }));
     26 }, "fetch() with an invalid priority returns a rejected promise with a TypeError");