test for window
This commit is contained in:
parent
a2c4e718fd
commit
f2e6ea5890
|
@ -148,7 +148,7 @@
|
||||||
// TODO put in different file for browser vs node
|
// TODO put in different file for browser vs node
|
||||||
try {
|
try {
|
||||||
return Array.prototype.slice.call(
|
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('');
|
).map(function (ch) { return (ch).toString(16); }).join('');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
return OAUTH3.utils._insecureRandomState();
|
return OAUTH3.utils._insecureRandomState();
|
||||||
|
@ -723,7 +723,7 @@
|
||||||
// Let the Code Waste begin!!
|
// Let the Code Waste begin!!
|
||||||
//
|
//
|
||||||
, _browser: {
|
, _browser: {
|
||||||
window: window
|
window: 'undefined' !== typeof window ? window : null
|
||||||
// TODO we don't need to include this if we're using jQuery or angular
|
// TODO we don't need to include this if we're using jQuery or angular
|
||||||
, discover: function(providerUri, opts) {
|
, discover: function(providerUri, opts) {
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
Loading…
Reference in New Issue