Skip to content

Commit 89c1940

Browse files
committed
Test for WCA on self instead of window for webworker compatibility, see #27
1 parent fa5b3bc commit 89c1940

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

dist/bcrypt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
return require("crypto")['randomBytes'](len);
7171
} catch (e) {}
7272
/* WCA */ try {
73-
var a; (window['crypto']||window['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
73+
var a; (self['crypto']||self['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
7474
return Array.prototype.slice.call(a);
7575
} catch (e) {}
7676
/* fallback */ if (!randomFallback)

dist/bcrypt.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/bcrypt.min.map

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

src/bcrypt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function random(len) {
2525
return require("crypto")['randomBytes'](len);
2626
} catch (e) {}
2727
/* WCA */ try {
28-
var a; (window['crypto']||window['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
28+
var a; (self['crypto']||self['msCrypto'])['getRandomValues'](a = new Uint32Array(len));
2929
return Array.prototype.slice.call(a);
3030
} catch (e) {}
3131
/* fallback */ if (!randomFallback)

0 commit comments

Comments
 (0)