propertyIsEnumerable behaves as if always in strict mode
Reported by
adriant...@gmail.com,
Sep 2 2016
|
|||
Issue description
UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2810.2 Safari/537.36
Steps to reproduce the problem:
1. Run this code in the dev console
a = {}
pie = a.propertyIsEnumerable
pie('asd')
What is the expected behavior?
The code runs fine; the call to pie returns false (unless there is an 'asd' declared on window)
What went wrong?
The call to pie throws a "Uncaught TypeError: Cannot convert undefined or null to object" as if it's called under strict mode
Did this work before? N/A
Chrome version: 54.0.2810.2 Channel: n/a
OS Version:
Flash Version: Shockwave Flash 22.0 r0
,
Sep 8 2016
,
Sep 8 2016
Not sure what you mean. You can find the spec here: https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable . The `this` value should be undefined in that case, which would throw the TypeError that we throw. Strict mode with respect to receivers of methods is a property of the callee, not the caller; everything defined in the ECMAScript standard has strict-mode-style semantics.
,
Sep 8 2016
I assumed `this` would be window as I didn't know that "everything defined in the ECMAScript standard has strict-mode-style semantics." The snippet also happens to work in Firefox (48) in the dev console and that strengthened my assumption. Thank you!
,
Sep 8 2016
Sounds like Firefox has a bug!
,
Sep 8 2016
There is in fact a Firefox bug here, which in particular is affecting evaluation in the Firefox console. See https://bugzilla.mozilla.org/show_bug.cgi?id=1301491
,
Aug 8 2017
This is correct behavior, per #3. |
|||
►
Sign in to add a comment |
|||
Comment 1 by tkent@chromium.org
, Sep 4 2016