Closed
Bug 601379
Opened 14 years ago
Closed 10 years ago
Harmony proxies: Object.defineProperty(proxy,name,desc) should pass non-standard attributes of desc to trap
Categories
(Core :: JavaScript Engine, defect, P2)
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: tomvc.be, Unassigned)
References
Details
As discussed at last TC39 meeting, the Proxies spec. was changed such that Object.defineProperty(proxy,name,desc) would still convert 'desc' into an internal property descriptor first, but also copy any non-standard attributes from 'desc' into the sanitized property descriptor passed to the trap. This allows proxy handlers to access non-standard attributes. Testcase: var result; var proxy = Proxy.create({ defineProperty: function(name, descObj) { result = (descObj.non_standard === 1); } }); var desc = { value: 42, writable: true, non_standard: 1 }; Object.defineProperty(proxy, 'foo', desc); result is false and should be true. See the modifications to the semantics of Object.defineProperty on the harmony:proxies semantics page: http://wiki.ecmascript.org/doku.php?id=harmony:proxies_semantics#modifications_to_other_object_built-ins
Reporter | ||
Updated•14 years ago
|
Priority: -- → P2
Updated•14 years ago
|
Assignee: general → gal
Comment 1•13 years ago
|
||
I wrote up a nice easy patch for this before I discovered that js::PropDesc != PropertyDescriptor, and suddenly I'm at a loss as to how this can work without changing public APIs, since I can't find any easy way to pass |v| from JSProxy::defineProperty down to the proxy handler that calls MakePropertyDescriptorObject. Any input, gal/brendan?
Comment 2•13 years ago
|
||
You can simply convert them. Though, if you want to fix the public API and reduce the number of PropertyDescriptor structs we have, that would be awesome.
Comment 3•13 years ago
|
||
When you say convert them, do you mean change the JSProxy API to take PropDesc instead?
Updated•13 years ago
|
Blocks: harmony:proxies
Updated•13 years ago
|
Blocks: harmony:proxy
Updated•13 years ago
|
No longer blocks: harmony:proxy
Comment 4•12 years ago
|
||
Not solved by direct proxies. Updated test case: var result; var proxy = new Proxy({}, { defineProperty: function(target, name, descObj) { console.log('trap') result = (descObj.non_standard === 1); } }); var desc = { value: 42, writable: true, non_standard: 1 }; Object.defineProperty(proxy, 'foo', desc); console.log('result', result); ===== Should log true, but logs false. Changing dependency order since direct proxies need this bug to be fixed to be considered conformant
Updated•10 years ago
|
Assignee: gal → nobody
Comment 5•10 years ago
|
||
Setting ni? to make sure efaust is aware of this.
Flags: needinfo?(efaustbmo)
Comment 6•10 years ago
|
||
Beware, it looks like the current consensus is to *not* let custom attributes pass https://mail.mozilla.org/pipermail/es-discuss/2014-May/037124.html Pending a TC39 meeting, I'd guess.
Comment 7•10 years ago
|
||
This has indeed been removed from the spec. See bug 1031243 for more specific details.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•