tor-browser

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

static-element-with-base.https.tentative.sub.html (2479B)


      1 <!DOCTYPE html>
      2 <title>
      3  WebBundle subresource loading for static elements with a base element
      4 </title>
      5 <link
      6  rel="help"
      7  href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md"
      8 />
      9 <base href="../resources/wbn/static-element/" />
     10 <script src="/resources/testharness.js"></script>
     11 <script src="/resources/testharnessreport.js"></script>
     12 <body>
     13  <script type="webbundle">
     14    {
     15      "source": "../static-element.wbn",
     16      "resources": [
     17        "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/script.js",
     18        "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style.css",
     19        "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style-imported-from-file.css",
     20        "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/resources/style-imported-from-tag.css"
     21      ],
     22      "scopes": [
     23        "https://{{domains[]}}:{{ports[https][0]}}/web-bundle/resources/wbn/static-element/scopes/"
     24      ]
     25    }
     26  </script>
     27  <style type="text/css">
     28    @import "resources/style-imported-from-tag.css";
     29    @import "scopes/style-imported-from-tag.css";
     30  </style>
     31  <link href="resources/style.css" rel="stylesheet" />
     32  <link href="scopes/style.css" rel="stylesheet" />
     33  <script src="resources/script.js"></script>
     34  <script src="scopes/script.js"></script>
     35  <script src="out-of-scope/script.js"></script>
     36 
     37  <script>
     38    setup(() => {
     39      assert_true(HTMLScriptElement.supports("webbundle"));
     40    });
     41 
     42    promise_test(async () => {
     43      assert_equals(resources_script_result, "loaded from webbundle");
     44      assert_equals(scopes_script_result, "loaded from webbundle");
     45      assert_equals(out_of_scope_script_result, "loaded from network");
     46 
     47      ["resources_", "scopes_"].forEach((type) => {
     48        [
     49          "style_target",
     50          "style_imported_from_file_target",
     51          "style_imported_from_tag_target",
     52        ].forEach((target) => {
     53          const element = document.createElement("div");
     54          element.id = type + target;
     55          document.body.appendChild(element);
     56          assert_equals(
     57            window.getComputedStyle(element).color,
     58            "rgb(0, 0, 255)",
     59            element.id + " color must be blue"
     60          );
     61        });
     62      });
     63    }, "Subresources from static elements should be loaded from web bundle.");
     64  </script>
     65 </body>