diff options
author | 2022-09-14 19:15:05 -0700 | |
---|---|---|
committer | 2022-09-14 19:15:05 -0700 | |
commit | a31eb6a80c18a8110097e1df69ef1308b0446f53 (patch) | |
tree | 59b9bf88e9512da7d7f11f17f1a421d469ce0f77 /bench/snippets/crypto.mjs | |
parent | b0dd7bee5b22e49f2f2b8af92e4e1c7736f5d9a5 (diff) | |
download | bun-a31eb6a80c18a8110097e1df69ef1308b0446f53.tar.gz bun-a31eb6a80c18a8110097e1df69ef1308b0446f53.tar.zst bun-a31eb6a80c18a8110097e1df69ef1308b0446f53.zip |
Add missing `getRandomValues` to crypto polyfill
Diffstat (limited to 'bench/snippets/crypto.mjs')
-rw-r--r-- | bench/snippets/crypto.mjs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/bench/snippets/crypto.mjs b/bench/snippets/crypto.mjs index 132e6595d..6c0a74eaa 100644 --- a/bench/snippets/crypto.mjs +++ b/bench/snippets/crypto.mjs @@ -1,10 +1,10 @@ // so it can run in environments without node module resolution import { bench, run } from "../node_modules/mitata/src/cli.mjs"; -var crypto = globalThis.crypto; -// web crypto is not a global in node -if (!crypto) { - crypto = await import("crypto"); +var crypto = require("crypto"); + +if (!crypto.getRandomValues) { + crypto.getRandomValues = globalThis.crypto.getRandomValues; } var foo = new Uint8Array(65536); |