diff options
author | Oliver Lenehan <sunsetkookaburra+github@outlook.com.au> | 2020-05-08 22:30:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-08 14:30:53 +0200 |
commit | a08a4abac116eda498f8ad2df13b3816ec36c9ad (patch) | |
tree | 261a52fe93fc184f8af9aaf037cd74f27a532f76 /cli/tests | |
parent | c0e8bae498b1892b994757b5f4972913c076a65e (diff) |
feat(workers): "crypto" global accessible in Worker scope (#5121)
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/subdir/worker_crypto.js | 3 | ||||
-rw-r--r-- | cli/tests/workers_test.ts | 17 |
2 files changed, 20 insertions, 0 deletions
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<void> { + 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(); + }, +}); |