Skip to content

Commit a4b3e03

Browse files
committed
Added ENVIRONMENT_IS_WEB test prior to checking window.crypto etc. so we are sure that window is defined
1 parent 3bdbd00 commit a4b3e03

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/library_uuid.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ mergeInto(LibraryManager.library, {
3535
var rb = require('crypto').randomBytes;
3636
uuid = rb(16);
3737
} catch(e) {}
38-
} else if (typeof(window.crypto) !== 'undefined' &&
38+
} else if (ENVIRONMENT_IS_WEB &&
39+
typeof(window.crypto) !== 'undefined' &&
3940
typeof(window.crypto.getRandomValues) !== 'undefined') {
4041
// If crypto.getRandomValues is available try to use it.
4142
uuid = new Uint8Array(16);

0 commit comments

Comments
 (0)