Skip to content

Commit 5e89305

Browse files
committed
roll back phantom js stuff since we are on safe-buffer
1 parent cc8b6ae commit 5e89305

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

browser.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,14 @@ function randomBytes (size, cb) {
1717
// phantomjs needs to throw
1818
if (size > 65536) throw new Error('requested too many random bytes')
1919
// in case browserify isn't using the Uint8Array version
20-
var rawBytes = new global.Uint8Array(size)
20+
var bytes = Buffer.allocUnsafe(size)
2121

2222
// This will not work in older browsers.
2323
// See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
2424
if (size > 0) { // getRandomValues fails on IE if size == 0
25-
crypto.getRandomValues(rawBytes)
25+
crypto.getRandomValues(bytes)
2626
}
2727

28-
// XXX: phantomjs doesn't like a buffer being passed here
29-
var bytes = Buffer.from(rawBytes.buffer)
30-
3128
if (typeof cb === 'function') {
3229
return process.nextTick(function () {
3330
cb(null, bytes)

0 commit comments

Comments
 (0)