diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html')
-rw-r--r-- | dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html b/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html new file mode 100644 index 0000000000..5c81dd548e --- /dev/null +++ b/dom/base/test/jsmodules/importmaps/test_import_meta_resolve_importMap.html @@ -0,0 +1,49 @@ +<!DOCTYPE html> +<head> + <meta charset=utf-8> + <title>Test import.meta.resolve with import maps</title> +</head> +<body onload='testLoaded()'> + +<script type="importmap"> +{ + "imports": { + "simple": "./module_simpleExport.mjs" + } +} +</script> + +<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> +<script> + var wasRun = false; + var hasThrown = false; + window.onerror = handleError; + + function handleError(msg, url, line, col, error) { + ok(error instanceof TypeError, "Thrown error should be TypeError."); + hasThrown = true; + } +</script> + +<script type="module"> + ok(import.meta.resolve("simple") == + "chrome://mochitests/content/chrome/dom/base/test/jsmodules/importmaps/module_simpleExport.mjs", + "calling import.meta.resolve with a specifier from import map."); + wasRun = true; +</script> + +<script type="module"> + // should throw a TypeError + import.meta.resolve("fail"); +</script> + +<script> + SimpleTest.waitForExplicitFinish(); + + function testLoaded() { + ok(wasRun, "Check inline module has run."); + ok(hasThrown, "Check inline module has thrown."); + SimpleTest.finish(); + } +</script> +</body> |