diff options
Diffstat (limited to 'js/xpconnect/tests/unit/test_import_global_contextual_worker.js')
-rw-r--r-- | js/xpconnect/tests/unit/test_import_global_contextual_worker.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/js/xpconnect/tests/unit/test_import_global_contextual_worker.js b/js/xpconnect/tests/unit/test_import_global_contextual_worker.js new file mode 100644 index 0000000000..f64317c552 --- /dev/null +++ b/js/xpconnect/tests/unit/test_import_global_contextual_worker.js @@ -0,0 +1,17 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +add_task(async function testInWorker() { + const worker = new ChromeWorker("resource://test/contextual_worker.js"); + const { promise, resolve } = Promise.withResolvers(); + worker.onmessage = event => { + resolve(event.data); + }; + worker.postMessage(""); + + const result = await promise; + + Assert.ok(result.equal1); + Assert.ok(result.equal2); +}); |