Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / js / xpconnect / tests / browser / browser_worker_import_esm_source.js
blob08e0cadda50ec7c55f34354288a3f1e7c131703d
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 const BASE_URL =
6   "chrome://mochitests/content/browser/js/xpconnect/tests/browser/";
7 const WORKER_URL = BASE_URL + "worker_import_esm_source.mjs";
9 add_task(async function testInWorker() {
10   const string = await new Promise(resolve => {
11     const worker = new ChromeWorker(WORKER_URL, { type: "module" });
12     worker.addEventListener("message", event => {
13       resolve(event.data.string);
14     });
15   });
16   ok(
17     string.includes("A comment in function."),
18     "Source should be available in ESM loaded via ChromeUtils.importESModule in worker"
19   );
20 });