<!DOCTYPE html>
<html>
<head>
<title>import.meta.url should have a fragment</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
</head>
<body>
<script>
globalThis.metaURLs = [];
const basename = `http://${document.location.host}/WebKit/html/semantics/scripting-1/the-script-element/module`;
promise_test(() => {
    return new Promise(function (resolve, reject) {
        let script = document.createElement('script');
        script.type = 'module';
        script.src = `${basename}/resources/import-meta-url-expose.js#test`;
        script.onload = function () {
            try {
                assert_equals(globalThis.metaURLs.length, 1);
                let url = globalThis.metaURLs.shift();
                assert_equals(url, `${basename}/resources/import-meta-url-expose.js#test`);
                resolve();
            } catch (e) {
                reject(e);
            }
        };
        script.onerror = reject;
        document.body.appendChild(script);
    });
}, 'import.meta.url should be have a fragment');
</script>
</body>
</html>
