test for window

This commit is contained in:
AJ ONeal 2017-03-20 17:55:00 -06:00
parent a2c4e718fd
commit f2e6ea5890
1 changed files with 2 additions and 2 deletions

View File

@ -148,7 +148,7 @@
// TODO put in different file for browser vs node
try {
return Array.prototype.slice.call(
window.crypto.getRandomValues(new Uint8Array(16))
OAUTH3._browser.window.crypto.getRandomValues(new Uint8Array(16))
).map(function (ch) { return (ch).toString(16); }).join('');
} catch(e) {
return OAUTH3.utils._insecureRandomState();
@ -723,7 +723,7 @@
// Let the Code Waste begin!!
//
, _browser: {
window: window
window: 'undefined' !== typeof window ? window : null
// TODO we don't need to include this if we're using jQuery or angular
, discover: function(providerUri, opts) {
opts = opts || {};