Skip to content

Commit

Permalink
Merge pull request travist#67 from pkaminski/entropy-fix
Browse files Browse the repository at this point in the history
Protect against permission denied error when accessing mouse coordinates
  • Loading branch information
travist committed Apr 19, 2016
2 parents c41f21e + 9c37422 commit 97e5572
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/jsbn/rng.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,13 @@ if(rng_pool == null) {
window.detachEvent("onmousemove", onMouseMoveListener);
return;
}
this.count += 1;
var mouseCoordinates = ev.x + ev.y;
rng_pool[rng_pptr++] = mouseCoordinates & 255;
try {
var mouseCoordinates = ev.x + ev.y;
rng_pool[rng_pptr++] = mouseCoordinates & 255;
this.count += 1;
} catch (e) {
// Sometimes Firefox will deny permission to access event properties for some reason. Ignore.
}
};
if (window.addEventListener)
window.addEventListener("mousemove", onMouseMoveListener, false);
Expand Down

0 comments on commit 97e5572

Please sign in to comment.