Bug 1447894 [wpt PR 10136] - Worker: Add tests for import.meta.url on DedicatedWorker, a=testonly
authorHiroki Nakagawa <nhiroki@chromium.org>
Mon, 09 Apr 2018 18:17:57 +0000
changeset 467195 a006df0d2383f73319a8fe538bb347218e7779ca
parent 467194 9d793d1842c80a75ec259433056a7e71f88141ee
child 467196 82ec32afc87e49787a48655ee0c8fc0d76f87293
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1447894, 10136, 680046, 974726, 546254
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1447894 [wpt PR 10136] - Worker: Add tests for import.meta.url on DedicatedWorker, a=testonly Automatic update from web-platform-testsWorker: Add tests for import.meta.url on DedicatedWorker Bug: 680046 Change-Id: Ieb341c5922ad247961ca477893037896dbd88ea6 Reviewed-on: https://chromium-review.googlesource.com/974726 Commit-Queue: Hiroki Nakagawa <nhiroki@chromium.org> Reviewed-by: Matt Falkenhagen <falken@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#546254} wpt-commits: 8ccaab2a5566e719948722108fa04404e3a43849 wpt-pr: 10136 wpt-commits: 8ccaab2a5566e719948722108fa04404e3a43849 wpt-pr: 10136
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/workers/modules/dedicated-worker-import-meta.html
testing/web-platform/tests/workers/modules/resources/dynamic-import-given-url-worker.js
testing/web-platform/tests/workers/modules/resources/import-meta-url-worker.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -298193,21 +298193,31 @@
      {}
     ]
    ],
    "workers/modules/resources/dynamic-import-and-then-static-import-worker.js": [
     [
      {}
     ]
    ],
+   "workers/modules/resources/dynamic-import-given-url-worker.js": [
+    [
+     {}
+    ]
+   ],
    "workers/modules/resources/dynamic-import-worker.js": [
     [
      {}
     ]
    ],
+   "workers/modules/resources/import-meta-url-worker.js": [
+    [
+     {}
+    ]
+   ],
    "workers/modules/resources/nested-dynamic-import-worker.js": [
     [
      {}
     ]
    ],
    "workers/modules/resources/nested-static-import-worker.js": [
     [
      {}
@@ -370518,16 +370528,22 @@
     ]
    ],
    "workers/interfaces/WorkerUtils/navigator/language.html": [
     [
      "/workers/interfaces/WorkerUtils/navigator/language.html",
      {}
     ]
    ],
+   "workers/modules/dedicated-worker-import-meta.html": [
+    [
+     "/workers/modules/dedicated-worker-import-meta.html",
+     {}
+    ]
+   ],
    "workers/modules/dedicated-worker-import.html": [
     [
      "/workers/modules/dedicated-worker-import.html",
      {}
     ]
    ],
    "workers/modules/dedicated-worker-options-type.html": [
     [
@@ -609155,32 +609171,44 @@
   "workers/interfaces/WorkerUtils/navigator/007.html": [
    "9b7b7485f1db37368824a593b2d6cbea46dad440",
    "testharness"
   ],
   "workers/interfaces/WorkerUtils/navigator/language.html": [
    "6bffa3be83d81e2faa93119e710e4fee93fb855e",
    "testharness"
   ],
+  "workers/modules/dedicated-worker-import-meta.html": [
+   "ba8b24064e23f018ffd3ac9e4184d6f856123bff",
+   "testharness"
+  ],
   "workers/modules/dedicated-worker-import.html": [
    "752698b4f8f7298ca2ecc74d41887117a636118a",
    "testharness"
   ],
   "workers/modules/dedicated-worker-options-type.html": [
    "9f6f1be759beb885e2baa746e36ace83685f649b",
    "testharness"
   ],
   "workers/modules/resources/dynamic-import-and-then-static-import-worker.js": [
    "f4df69196f64cd81e92705186325004ac94db659",
    "support"
   ],
+  "workers/modules/resources/dynamic-import-given-url-worker.js": [
+   "372686abd1b2d2d09228a44f6420c646319e0bd1",
+   "support"
+  ],
   "workers/modules/resources/dynamic-import-worker.js": [
    "444e313fe51923097e3672d88d0afd30aac5ecab",
    "support"
   ],
+  "workers/modules/resources/import-meta-url-worker.js": [
+   "83f231a886c36543721c2b0204c18b97d10968f8",
+   "support"
+  ],
   "workers/modules/resources/nested-dynamic-import-worker.js": [
    "4ee05f3be8a1b41a9e2fa3e24d40ec5103f67eac",
    "support"
   ],
   "workers/modules/resources/nested-static-import-worker.js": [
    "38ca86e8e32df51af7d848474f31a7b8ff9dc3aa",
    "support"
   ],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/workers/modules/dedicated-worker-import-meta.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>DedicatedWorker: import.meta</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+
+promise_test(() => {
+  const script_url = 'resources/import-meta-url-worker.js';
+  const worker = new Worker(script_url, { type: 'module' });
+  return new Promise(resolve => worker.onmessage = resolve)
+      .then(msg_event => assert_true(msg_event.data.endsWith(script_url)));
+}, 'Test import.meta.url on the top-level module script.');
+
+promise_test(() => {
+  const script_url = 'import-meta-url-worker.js';
+  const worker = new Worker('resources/dynamic-import-given-url-worker.js',
+                            { type: 'module' });
+  worker.postMessage('./' + script_url);
+  return new Promise(resolve => worker.onmessage = resolve)
+      .then(msg_event => assert_true(msg_event.data.endsWith(script_url)));
+}, 'Test import.meta.url on the imported module script.');
+
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/workers/modules/resources/dynamic-import-given-url-worker.js
@@ -0,0 +1,4 @@
+// Dynamically import the script URL sent by postMessage().
+self.addEventListener('message', e => {
+  import(e.data);
+});
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/workers/modules/resources/import-meta-url-worker.js
@@ -0,0 +1,1 @@
+postMessage(import.meta.url);