test_import_global_contextual_worker.js (560B)
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/. */ 4 5 add_task(async function testInWorker() { 6 const worker = new ChromeWorker("resource://test/contextual_worker.js"); 7 const { promise, resolve } = Promise.withResolvers(); 8 worker.onmessage = event => { 9 resolve(event.data); 10 }; 11 worker.postMessage(""); 12 13 const result = await promise; 14 15 Assert.ok(result.equal1); 16 Assert.ok(result.equal2); 17 });