chromium/third_party/blink/web_tests/external/wpt/import-maps/multiple-import-maps/with-errors.html

<!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>