Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed use of "window" instead of "global". #1

Merged
merged 1 commit into from
Jan 14, 2017

Conversation

tswindell
Copy link

Signed-off-by: Tom Swindell [email protected]

@@ -19,7 +19,7 @@ module.exports = function webcryptoShim (global) {
_SubtleCrypto = global.SubtleCrypto || _subtle.constructor || Object,
_CryptoKey = global.CryptoKey || global.Key || Object;

var isEdge = window.navigator.userAgent.indexOf('Edge/') > -1
var isEdge = global.navigator.userAgent.indexOf('Edge/') > -1
Copy link
Owner

@dignifiedquire dignifiedquire Jan 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think global is defined in all browsers, maybe check for not being undefined in this order

  1. global
  2. window
  3. self

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

global is a local variable, it is the variable that is assigned to window or self.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should read the code I'm reviewing more closely :/

@dignifiedquire
Copy link
Owner

Thank you :octocat:

@dignifiedquire dignifiedquire merged commit effe03d into dignifiedquire:master Jan 14, 2017
@tswindell
Copy link
Author

Is this closed now then? ;)

@dignifiedquire
Copy link
Owner

latest libp2p-crypto includes this and runs tests in webworkers so should work all good now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants