From a08a4abac116eda498f8ad2df13b3816ec36c9ad Mon Sep 17 00:00:00 2001 From: Oliver Lenehan Date: Fri, 8 May 2020 22:30:53 +1000 Subject: feat(workers): "crypto" global accessible in Worker scope (#5121) --- cli/tests/subdir/worker_crypto.js | 3 +++ cli/tests/workers_test.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 cli/tests/subdir/worker_crypto.js (limited to 'cli/tests') diff --git a/cli/tests/subdir/worker_crypto.js b/cli/tests/subdir/worker_crypto.js new file mode 100644 index 000000000..a86340005 --- /dev/null +++ b/cli/tests/subdir/worker_crypto.js @@ -0,0 +1,3 @@ +onmessage = function () { + postMessage(!!self.crypto); +}; diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts index c4b93db3c..df2cdf2aa 100644 --- a/cli/tests/workers_test.ts +++ b/cli/tests/workers_test.ts @@ -290,3 +290,20 @@ Deno.test({ await promise2; }, }); + +Deno.test({ + name: "worker with crypto in scope", + fn: async function (): Promise { + const promise = createResolvable(); + const w = new Worker("../tests/subdir/worker_crypto.js", { + type: "module", + }); + w.onmessage = (e): void => { + assertEquals(e.data, true); + promise.resolve(); + }; + w.postMessage(null); + await promise; + w.terminate(); + }, +}); -- cgit v1.2.3