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

Support enforced strict mode #13

Closed
wants to merge 1 commit into from
Closed

Support enforced strict mode #13

wants to merge 1 commit into from

Conversation

arzeth
Copy link

@arzeth arzeth commented Nov 21, 2015

All (>50) modules that I use work fine with enforced strict mode.
The only exception is errno. This commit fixes that.

Steps to reproduce:

mkdir /tmp/a
cd /tmp/a
npm install errno
echo 'require("errno")' > w.js
node --use_strict w.js
/tmp/a/node_modules/errno/custom.js:18
    Error.captureStackTrace(this, arguments.callee)
                                           ^

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at Error.CustomError (/tmp/a/node_modules/errno/custom.js:18:44)
    at createError (/tmp/a/node_modules/errno/custom.js:42:43)
    at ce (/tmp/a/node_modules/errno/custom.js:48:12)
    at module.exports (/tmp/a/node_modules/errno/custom.js:52:25)
    at Object.<anonymous> (/tmp/a/node_modules/errno/errno.js:312:44)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)

All (>50) modules that I use work fine with enforced strict mode.
The only exception is `errno`. This commit fixes that.

Steps to reproduce:
mkdir /tmp/a
cd /tmp/a
npm install errno
echo 'require("errno")' > w.js
node --use_strict w.js

/tmp/a/node_modules/errno/custom.js:18
    Error.captureStackTrace(this, arguments.callee)
                                           ^

TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at Error.CustomError (/tmp/a/node_modules/errno/custom.js:18:44)
    at createError (/tmp/a/node_modules/errno/custom.js:42:43)
    at ce (/tmp/a/node_modules/errno/custom.js:48:12)
    at module.exports (/tmp/a/node_modules/errno/custom.js:52:25)
    at Object.<anonymous> (/tmp/a/node_modules/errno/errno.js:312:44)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Module.require (module.js:366:17)
@rvagg
Copy link
Owner

rvagg commented Nov 22, 2015

I'm going to have to think about this one, it's a non-trivial change to discard the information provided by callee

@Head
Copy link

Head commented Aug 25, 2016

works for me. thx.

@ghost
Copy link

ghost commented Dec 8, 2017

+1 please merge

@ralphtheninja
Copy link
Collaborator

ralphtheninja commented Dec 10, 2017

Closing this in favor of #18 (or a modification of it rather). It's better to remove arguments.callee completely instead.

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.

None yet

4 participants