[Pkg-javascript-commits] [node-randomfill] 19/47: fix(IE): getRandomBytes fails when size=0 on IE.
Bastien Roucariès
rouca at moszumanska.debian.org
Fri Dec 15 09:52:52 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-randomfill.
commit fe21728a9673194373e4a1ba1ea07385c8f8f1e5
Author: pernas <jaume at pernas.cat>
Date: Fri Feb 26 14:10:29 2016 -0500
fix(IE): getRandomBytes fails when size=0 on IE.
---
browser.js | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/browser.js b/browser.js
index 254d480..a181c37 100644
--- a/browser.js
+++ b/browser.js
@@ -20,8 +20,9 @@ function randomBytes (size, cb) {
// This will not work in older browsers.
// See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues
- crypto.getRandomValues(rawBytes)
-
+ if(size > 0) { // getRandomValues fails on IE if size == 0
+ crypto.getRandomValues(rawBytes)
+ }
// phantomjs doesn't like a buffer being passed here
var bytes = new Buffer(rawBytes.buffer)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-randomfill.git
More information about the Pkg-javascript-commits
mailing list