Closed
Bug 1038427
Opened 11 years ago
Closed 11 years ago
Object.getOwnPropertyNames does not correctly call Proxy's getOwnPropertyNames
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: nathan, Unassigned, NeedInfo)
References
Details
Note the below test in the shell.
js> var thing = new Proxy({}, { getOwnPropertyNames: function(target) { return ["An Entry"]; }});
js> Object.getOwnPropertyNames(thing)
[]
For some reason Object.getOwnPropertyNames does not correctly call the Proxy's version of getOwnPropertyNames. This did used to work, Fx30 does correctly handle this.
Updated•11 years ago
|
Flags: needinfo?(efaustbmo)
![]() |
||
Comment 1•11 years ago
|
||
Nathan, thank you for the bug report.
Per current spec, there is no "getOwnPropertNames" trap on proxies. If you look at the definition of Object.getOwnPropertyNames at http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.getownpropertynames it calls http://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys which calls [[OwnPropertyKeys]].
This is defined for proxies at http://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-ownpropertykeys and calls the "ownKeys" trap on the proxy handler.
See bug 1007334 where the change to the current spec behavior was made.
Reporter | ||
Comment 2•11 years ago
|
||
(In reply to Boris Zbarsky [:bz] from comment #1)
> Nathan, thank you for the bug report.
>
> Per current spec, there is no "getOwnPropertNames" trap on proxies. If you
> look at the definition of Object.getOwnPropertyNames at
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.
> getownpropertynames it calls
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-getownpropertykeys
> which calls [[OwnPropertyKeys]].
>
> This is defined for proxies at
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-
> internal-methods-and-internal-slots-ownpropertykeys and calls the "ownKeys"
> trap on the proxy handler.
>
> See bug 1007334 where the change to the current spec behavior was made.
Ahhh, I see. I had gone off of https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
which hasn't been updated with the new change. Is there a way to flag it or something?
![]() |
||
Comment 3•11 years ago
|
||
I did mark bug 1007334 as dev-doc-needed, but yeah, we should update the devmo documentation...
Flags: needinfo?(efaustbmo)
You need to log in
before you can comment on or make changes to this bug.
Description
•