chromium/third_party/blink/web_tests/http/tests/loading/wbn/subresource-loading/script-preload-relative-url-with-base.https.html

<!DOCTYPE html>
<title>Subresource loading using relative URLs in the 'resources' attribute with a base element</title>
<base href="../resources/">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<body>
  <script type="webbundle">
    {
      "source": "wbn/hello.wbn",
      "resources": ["/loading/wbn/resources/hello/script.js"]
    }
  </script>
  <script id="script" src="/loading/wbn/resources/hello/script.js"></script>

  <script>
    // When preload scanner encounters a <script type="webbundle"> element, it must not
    // preload a request for the webbundle itself and any subresources mentioned in the
    // 'resources' attribute.
    // This test loads a simple hello.wbn bundle and script.js served from the bundle,
    // and checks that both hello.wbn and script.js were not preloaded.
    const onLoadPromise = new Promise((resolve) => {
      window.addEventListener('load', resolve, false);
    });

    promise_test(async () => {
      await onLoadPromise;

      if (window.internals) {
        assert_false(internals.isPreloaded(script.src));
        assert_false(internals.isPreloaded('wbn/hello.wbn'));
        assert_equals(script_result, 'loaded from webbundle');
      }
    }, "A subresource script.js should be loaded from WebBundle using the relative URL and a base element.");
  </script>
</body>