Skip to content

Commit

Permalink
[import.meta.url] Implement import.meta.url behind flag (Blink-side)
Browse files Browse the repository at this point in the history
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
Reviewed-on: https://chromium-review.googlesource.com/726525
Commit-Queue: Hiroshige Hayashizaki <[email protected]>
Reviewed-by: Kouhei Ueno <[email protected]>
Cr-Commit-Position: refs/heads/master@{#510988}
  • Loading branch information
hiroshige-g authored and chromium-wpt-export-bot committed Oct 24, 2017
1 parent 0c76451 commit 0ad3d11
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export let importMetaOnDependentModule = import.meta;
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";
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>

0 comments on commit 0ad3d11

Please sign in to comment.