Skip to content

Commit 600bc55

Browse files
authored
Merge pull request #540 from Thristhart/self_over_window
use `self` instead of `window` in JS
2 parents ad14217 + 6ef46fd commit 600bc55

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/rngs/os.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,9 +1023,9 @@ mod imp {
10231023
let result = js! {
10241024
try {
10251025
if (
1026-
typeof window === "object" &&
1027-
typeof window.crypto === "object" &&
1028-
typeof window.crypto.getRandomValues === "function"
1026+
typeof self === "object" &&
1027+
typeof self.crypto === "object" &&
1028+
typeof self.crypto.getRandomValues === "function"
10291029
) {
10301030
return { success: true, ty: 1 };
10311031
}
@@ -1063,7 +1063,7 @@ mod imp {
10631063
OsRngMethod::Browser => js! {
10641064
try {
10651065
let array = new Uint8Array(@{ len });
1066-
window.crypto.getRandomValues(array);
1066+
self.crypto.getRandomValues(array);
10671067
HEAPU8.set(array, @{ ptr });
10681068

10691069
return { success: true };

0 commit comments

Comments
 (0)