Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Cannot declare a parameter named 'mask' as it shadows the name of a strict mode function #124

Closed
Otonomos opened this issue Nov 18, 2015 · 3 comments

Comments

@Otonomos
Copy link

I am using this package in combination with Meteor. The latest version will crash in Safari with the following error: Cannot declare a parameter named 'mask' as it shadows the name of a strict mode function. So far, I traced it back to this function on line 30299 in the ipfsapi.js:
ip.mask = function mask(addr, mask) {

otonomos_dashboard_and_project_find_results_-_applications_mamp_htdocs_otometeor-_atom_and_otonomos_dashboard

@daviddias
Copy link
Contributor

Hi @Otonomos, thank your catching that!

That actually comes from the module ip, which is a dependency of multiaddr.

One way to solve it, would be to submit a PR to change it on the ip module, however, I believe the best way is to make browserify aware that it should obfuscate any function that has that name.

This can be achieve by creating a browserify transform for this purpose, through https://www.npmjs.com/package/browserify#b-transform-tr-opts, or make it part of browserify itself and it might be very valuable for other modules too. Would you be availble to create that transform/make the patch?

@jbenet
Copy link
Contributor

jbenet commented Nov 19, 2015

We should probably warn the ip module people too
On Wed, Nov 18, 2015 at 07:16 David Dias notifications@github.com wrote:

Hi @Otonomos https://github.com/Otonomos, thank your catching that!

That actually comes from the module ip https://www.npmjs.com/package/ip,
which is a dependency of multiaddr
https://www.npmjs.com/package/multiaddr.

One way to solve it, would be to submit a PR to change it on the ip
module, however, I believe the best way is to make browserify aware that it
should obfuscate any function that has that name.

This can be achieve by creating a browserify transform for this purpose,
through https://www.npmjs.com/package/browserify#b-transform-tr-opts, or
make it part of browserify itself and it might be very valuable for other
modules too. Would you be availble to create that transform/make the patch?


Reply to this email directly or view it on GitHub
#124 (comment).

priecint added a commit to priecint/js-ipfs-api that referenced this issue Feb 1, 2016
@priecint
Copy link
Contributor

priecint commented Feb 1, 2016

Hi,
I encountered this issue too in Safari on iPad, but with different error message. It comes from https://github.com/ipfs/js-ipfs-api/blob/master/src/api/id.js

http://10.0.0.8:8080/libs/ipfsapi.min.js:14
SyntaxError: Cannot declare a parameter named 'id' as it shadows the name of a strict mode function.
Connection established with http://10.0.0.8:8080/
Mozilla/5.0 (iPad; CPU OS 9_0 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13A340 Safari/601.1

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

No branches or pull requests

3 participants