summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/web-bundle/subresource-loading/element-removal.https.tentative.html
blob: 87ab8a9f15d02a986014a429cdfa7f1ee90fb2cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<title>
  On-going subresource loading should fail immediately when the web bundle
  element is removed
</title>
<link
  rel="help"
  href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md"
/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../resources/test-helpers.js"></script>
<body>
  <script>
    setup(() => {
      assert_true(HTMLScriptElement.supports("webbundle"));
    });

    promise_test(async () => {
      const element = createWebBundleElement(
        "/xhr/resources/delay.py?ms=100000",
        ["/xhr/resources/dummy"]
      );
      document.body.appendChild(element);
      const waitUntilFail = new Promise((resolve) => {
        fetch("/xhr/resources/dummy").then(() => {}, resolve);
      });
      document.body.removeChild(element);
      await waitUntilFail;
    }, "On-going subresource loading should fail immediately when the element is " + "removed.");
  </script>
</body>