test_import_global_worker.js (684B)
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 testSharedInWorker() { 6 // Loading into shared global isn't allowed in worker. 7 8 let worker = new ChromeWorker("resource://test/import_shared_in_worker.js"); 9 let { promise, resolve } = Promise.withResolvers(); 10 worker.onmessage = event => { 11 resolve(event.data); 12 }; 13 worker.postMessage(""); 14 15 const result = await promise; 16 17 Assert.equal(result.caught1, true); 18 Assert.equal(result.caught2, true); 19 Assert.equal(result.caught3, true); 20 });