-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[import.meta.url] Implement import.meta.url behind flag (Blink-side)
This CL implements https://html.spec.whatwg.org/#hostgetimportmetaproperties as HostGetImportMetaProperties() in V8Initializer.cpp and Modulator, and thus enables import.meta.url behind the flag added in https://chromium-review.googlesource.com/c/chromium/src/+/727179. This CL also adds a layout test, and sets up virtual test for that. Bug: 773713 Change-Id: I1d28123f803095535ed9a0208587e1dd873376cb
- Loading branch information
1 parent
50d08dd
commit 80b3df6
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-dependent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export let importMetaOnDependentModule = import.meta; |
2 changes: 2 additions & 0 deletions
2
html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-root.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export let importMetaOnRootModule = import.meta; | ||
export { importMetaOnDependentModule } from "./import-meta-dependent.js"; |
23 changes: 23 additions & 0 deletions
23
html/semantics/scripting-1/the-script-element/module/import-meta/import-meta-url.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!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"); | ||
</script> |