Skip to content

Commit 80f4026

Browse files
committed
add support for import.meta.url to jsc CLI
https://bugs.webkit.org/show_bug.cgi?id=296132 rdar://156071047 Reviewed by NOBODY (OOPS!). This patch adds import.meta.url to the JSC CLI and API module import.meta objects. This matches the web's behavior and is desired for WebKit/JetStream#73.
1 parent febf808 commit 80f4026

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

JSTests/stress/import-meta-url.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if (!import.meta.url.match("import-meta-url.mjs"))
2+
throw new Error("import.meta.url doesn't seem right: " + import.meta.url);

Source/JavaScriptCore/jsc.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,9 @@ JSObject* GlobalObject::moduleLoaderCreateImportMetaProperties(JSGlobalObject* g
15271527
metaProperties->putDirect(vm, Identifier::fromString(vm, "filename"_s), key);
15281528
RETURN_IF_EXCEPTION(scope, nullptr);
15291529

1530+
metaProperties->putDirect(vm, JSC::Identifier::fromString(vm, "url"_s), key);
1531+
RETURN_IF_EXCEPTION(scope, nullptr);
1532+
15301533
return metaProperties;
15311534
}
15321535

0 commit comments

Comments
 (0)