WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
102276
Object.getOwnPropertyDescriptor() on a non-strict function exposes strict "caller" property
https://bugs.webkit.org/show_bug.cgi?id=102276
Summary
Object.getOwnPropertyDescriptor() on a non-strict function exposes strict "ca...
Adam Klein
Reported
2012-11-14 13:11:00 PST
The following code appropriately throws a TypeError as required by ECMAScript: function nonStrict() { return nonStrict.caller; } function strict() { "use strict"; return nonStrict() === strict; } strict() But the following code does not throw, and returns true: function nonStrict() { return Object.getOwnPropertyDescriptor(nonStrict, 'caller').value; } function strict() { "use strict"; return nonStrict() === strict; } strict() Though this is underspecified in the spec (it says that only [[Get]] should throw when asked for caller), it seems likely that [[GetOwnProperty]] should do the same, and that's what both Chrome and Firefox do.
Attachments
Add attachment
proposed patch, testcase, etc.
Adam Klein
Comment 1
2012-11-16 10:52:39 PST
See
https://bugs.ecmascript.org/show_bug.cgi?id=310
for further discussion of this issue.
Alexey Shvayka
Comment 2
2021-05-14 03:17:54 PDT
(In reply to Adam Klein from
comment #0
)
> Though this is underspecified in the spec (it says that only [[Get]] should > throw when asked for caller), it seems likely that [[GetOwnProperty]] should > do the same, and that's what both Chrome and Firefox do.
As of
r277026
, [[Get]] is aligned with [[GetOwnProperty]] not to return strict callers. In modern browsers both test cases (adjusted for Firefox having "caller" on Function.prototype) evaluate as `false`. I am adding test coverage for [[GetOwnProperty]] as part of
https://bugs.webkit.org/show_bug.cgi?id=225277
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug