blob: fa1c7dee9d2a947bd8ebbe7088d598e752a2db83 [file] [log] [blame]
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script type="module">
import { importMetaOnRootModule, importMetaOnDependentModule }
from "./import-meta-root.js";
var base = location.href.slice(0, location.href.lastIndexOf('/'));
test(() => {
assert_equals(import.meta.url, location.href);
}, "import.meta.url in a root inline script");
test(() => {
assert_equals(importMetaOnRootModule.url,
base + "/import-meta-root.js");
}, "import.meta.url in a root external script");
test(() => {
assert_equals(importMetaOnDependentModule.url,
base + "/import-meta-dependent.js");
}, "import.meta.url in a dependent external script");
import { importMetaOnRootModule as hashedImportMetaOnRootModule1,
importMetaOnDependentModule as hashedImportMetaOnDependentModule1 }
from "./import-meta-root.js#1";
import { importMetaOnRootModule as hashedImportMetaOnRootModule2,
importMetaOnDependentModule as hashedImportMetaOnDependentModule2 }
from "./import-meta-root.js#2";
test(() => {
assert_equals(hashedImportMetaOnRootModule1.url,
base + "/import-meta-root.js#1");
assert_equals(hashedImportMetaOnRootModule2.url,
base + "/import-meta-root.js#2");
// Must not be affected
assert_equals(hashedImportMetaOnDependentModule1.url,
base + "/import-meta-dependent.js");
assert_equals(hashedImportMetaOnDependentModule2.url,
base + "/import-meta-dependent.js");
}, "import.meta.url when importing the module with different fragments");
</script>