tor-browser

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

modulepreload-in-early-hints.h2.window.js (914B)


      1 // META: script=/common/utils.js
      2 // META: script=resources/early-hints-helpers.sub.js
      3 
      4 // params are sent to a Python handler[1] that returns a 103 Early Hints
      5 // response based the values of "resource-url" and "as", and then that response
      6 // is validated by a window test[2] according to the value of "should-preload"
      7 //
      8 // see: https://web-platform-tests.org/writing-tests/h2tests.html
      9 //
     10 // [1]: resources/modulepreload-in-early-hints.h2.py
     11 // [2]: resources/modulepreload-in-early-hints.h2.html
     12 test(() => {
     13    const params = new URLSearchParams();
     14    params.set("description", "Modulepreload works in early hints");
     15    params.set("resource-url",
     16        SAME_ORIGIN_RESOURCES_URL + "/empty.js?" + token());
     17    params.set("should-preload", true);
     18    const test_url = "resources/modulepreload-in-early-hints.h2.py?" + params.toString();
     19    window.location.replace(new URL(test_url, window.location));
     20 });