Skip to content

Commit

Permalink
Protect against permission denied error when accessing mouse coordina…
Browse files Browse the repository at this point in the history
…tes.
  • Loading branch information
pkaminski committed Apr 13, 2016
1 parent 945ae29 commit 9c37422
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 9c37422

Please sign in to comment.