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 add_task(async function testWorker() {
6 let worker = new ChromeWorker("resource://test/lazy_non_shared_in_worker.js");
7 let { promise, resolve } = Promise.withResolvers();
8 worker.onmessage = event => {
11 worker.postMessage("");
13 const result = await promise;
15 Assert.ok(result.equal1);
16 Assert.ok(result.equal2);
19 add_task(async function testSharedInWorker() {
20 let worker = new ChromeWorker("resource://test/lazy_shared_in_worker.js");
21 let { promise, resolve } = Promise.withResolvers();
22 worker.onmessage = event => {
25 worker.postMessage("");
27 const result = await promise;
29 Assert.equal(result.caught1, true);
30 Assert.equal(result.caught2, true);
31 Assert.equal(result.caught3, true);