Closed
Bug 1047543
Opened 11 years ago
Closed 10 years ago
Self-hosted built-in functions should behave like non-strict functions with respect to .arguments and .caller
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 929642
People
(Reporter: 446240525, Assigned: Waldo)
Details
Attachments
(2 files)
921 bytes,
patch
|
Waldo
:
review-
|
Details | Diff | Splinter Review |
9.77 KB,
patch
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2106.0 Safari/537.36
Steps to reproduce:
js> String.fromCharCode.caller
null
js> String.fromCodePoint.caller
typein:37:0 TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
js> [].slice.arguments
null
js> [].map.arguments
typein:39:0 TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
Actual results:
Related: bug 995200 - Enable strict mode for self-hosted code in opt builds, too
V8 has the same issue.
Comment 2•11 years ago
|
||
Thanks for reporting this! It is indeed rather strange...
Till, shouldn't standard library functions behave the same whether they're self hosted or not?
Flags: needinfo?(till)
Assignee | ||
Comment 3•11 years ago
|
||
Comment on attachment 8466348 [details] [diff] [review]
bug1047543.patch
I think you're right about this patch making behavior consistent. But as I recall, the ES6 behavior is supposed to be that of the self-hosted builtins, so this patch goes the wrong way.
Attachment #8466348 -
Flags: review-
Flags: needinfo?(till)
Assignee | ||
Comment 4•11 years ago
|
||
So this is a fix, sort of. But recent ES6 drafts apparently make the poison pills configurable, so this isn't actually quite up-to-date.
And then, in talking on IRC with people today, I found out that there was even *more recent* consensus on making Function.prototype.{arguments,caller} into poison pills, then having non-strict, non-bound, etc. functions have instance accessors to provide legacy-compat behavior.
Then in further discussion, I mentioned bug 969478 would have put all legacy behavior (and strict/bound semantics, when called on such functions) into Function.prototype-homed accessors, while still having resolved poison-pills on strict/bound functions. jorendorff proposes a larger experiment: move *all* behavior everywhere into Function.prototype-homed accessors, don't have poison pills anywhere at all. It's worth an experiment, at least. So I'm going to do that first. Changing the behavior of natives overall, for consistency as this bug wants, can be deferred until that experiment completes.
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → jwalden+bmo
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Assignee | ||
Comment 5•10 years ago
|
||
I think we can probably lump this into the existing bug at this point.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
Summary: Self-hosted built-in functions should behave like non-strict functions → Self-hosted built-in functions should behave like non-strict functions with respect to .arguments and .caller
You need to log in
before you can comment on or make changes to this bug.
Description
•