summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/import-maps/multiple-import-maps/with-errors.html
blob: a93ecaaeff5b329916bfd003959d4cb067d5ee41 (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>
<html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
setup({allow_uncaught_exception : true});

const log = [];
</script>
<script type="importmap" onerror="log.push('onerror 1')">
Parse Error
</script>
<script type="importmap" onerror="log.push('onerror 2')">
{
  "imports": {
    "../resources/log.js?pipe=sub&name=A": "../resources/log.js?pipe=sub&name=C"
  }
}
</script>
<script>
// Currently the spec doesn't allow multiple import maps, by setting acquiring
// import maps to false on preparing the first import map.
// Even the first import map has errors and thus Document's import map is not
// updated, the second import map is still rejected at preparationg.
promise_test(() => {
  return import("../resources/log.js?pipe=sub&name=A")
    .then(() => assert_array_equals(
                    log,
                    ["onerror 2", "log:A"]))
  },
  "Second import map should be rejected after an import map with errors");
</script>