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

Use object-assign module as replacement for es6-shim #76

Merged
merged 1 commit into from
Nov 7, 2014

Conversation

stewart
Copy link
Contributor

@stewart stewart commented Nov 7, 2014

This corrects an issue running firmata inside of a Chrome App, where es6-shim conflicted with Chrome's CSP.

Specifically, this line was the culprit.

This could be worked around with sandboxing, but that disables all chrome.* APIs, making browser-serialport non-functional.

To fix the issue, and since only one ES6 feature was used (Object#assign), I've added Sindre Sorhus's object-assign ponyfill.

If in the future more ES6 methods are used, another solution might be found (or a patch submitted to es6-shims).

Please let me know if there's anything wrong with this patch, and I'll try to get any issues fixed.

This corrects an issue running firmata inside of a Chrome App, where es6-shim
conflicted with Chrome's CSP.

Specifically, this line was the culprit:
https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L72

If in the future more ES6 methods are used, another solution might be found (or
a patch submitted to es6-shims).
@rwaldron
Copy link
Collaborator

rwaldron commented Nov 7, 2014

es6-shim conflicted with Chrome's CSP.

Did you report this to es6-shim?

rwaldron added a commit that referenced this pull request Nov 7, 2014
Use object-assign module as replacement for es6-shim
@rwaldron rwaldron merged commit bdfb77a into firmata:master Nov 7, 2014
@stewart
Copy link
Contributor Author

stewart commented Nov 7, 2014

Drafting up the issue right now actually - it seems they added that line more for convenience than anything else.

edit: - paulmillr/es6-shim#301

@ljharb
Copy link

ljharb commented Nov 8, 2014

Not convenience - it's the only guaranteed way to get the global object. Please do suggest any alternatives on the es6-shim issue :-)

@@ -25,7 +25,7 @@
},
"dependencies": {
"browser-serialport": "*",
"es6-shim": "^0.20.2",
"object-assign": "^1.0.0",
Copy link

Choose a reason for hiding this comment

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

I recommend not using "^" as it's developer-hostile to anyone using node older than 0.10.24. I stick with ~ on all my modules.

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.

3 participants