Closed Bug 1007334 Opened 9 years ago Closed 9 years ago
ES6 Proxies: There's no such thing as [[Get
Own Property Names]]
The ES6 spec demands that Object.getOwnPropertyNames calls [[OwnPropertyKeys]] and then does some work on it. Currently, we have a getOwnPropertyNames trap, which will erroneously call a method on the handler with that name.
Assignee: nobody → efaustbmo
Status: NEW → ASSIGNED
Attachment #8421202 - Flags: review?(jorendorff)
Comment on attachment 8421202 [details] [diff] [review] Clean up the GetOwnPropertyNames/Keys situation for scripted proxies Review of attachment 8421202 [details] [diff] [review]: ----------------------------------------------------------------- Great! Besides these tests, at least browser/extensions/shumway/content/shumway.js also needs to be changed. (Ask till if he wants to keep the old method around too, for compatibility with older Firefoxen.) Definitely add a test checking that the getOwnPropertyDescriptor trap is called for each property during Object.keys(). ::: js/src/jsproxy.cpp @@ +1076,5 @@ > MutableHandleValue vp) MOZ_OVERRIDE; > virtual bool set(JSContext *cx, HandleObject proxy, HandleObject receiver, HandleId id, > bool strict, MutableHandleValue vp) MOZ_OVERRIDE; > + // Kick keys out to getOwnPropertyName and then filter. [[GetOwnProperty]] could potentially > + // change the enumerability of the target's properties. getOwnPropertyName is missing its s in the first sentence. In the second sentence, mentioning changing enumerability is making it more abstruse than it really is. The question is which traps are called when you do Object.keys(proxy): standard behavior that scripts can trivially observe. I'd write: // The DirectProxyHandler implementation of keys() is observably different from // what the spec requires (see tests/ecma_6/Proxy/blahblah.js), so use the base // class implementation (call getOwnPropertyNames and then filter). @@ +1663,5 @@ > return true; > } > > +// This is secretly [[OwnPropertyKeys]]. SM uses the old wiki name, internally. > +// ES6 (5 April 2014) Proxy.[[OwnPropertyKeys]](O) Follow-up bug. Let's rename everywhere.
Attachment #8421202 - Flags: review?(jorendorff) → review+
Can this land?
> Can this land? https://hg.mozilla.org/integration/mozilla-inbound/rev/cdb97e86cc74 > Follow-up bug. Let's rename everywhere. I didn't file it, but it's filed as bug 1026918
https://hg.mozilla.org/mozilla-central/rev/cdb97e86cc74 https://hg.mozilla.org/mozilla-central/rev/799a2838ed86 https://hg.mozilla.org/mozilla-central/rev/74fd773a5319
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.