Object.getOwnPropertyDescriptor(proxy) calls too many traps

RESOLVED DUPLICATE of bug 582959

Status

()

P2
normal
RESOLVED DUPLICATE of bug 582959
8 years ago
8 years ago

People

(Reporter: tomvc.be, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
Normally, the code Object.getOwnPropertyDescriptor(proxy) should only invoke one method on the proxy handler (the 'getOwnPropertyDescriptor' trap), but instead it invokes all of the following on the proxy handler:

getOwnPropertyDescriptor(name)
has(name)
getOwnPropertyDescriptor(name)
get(proxy, name)
(Reporter)

Updated

8 years ago
Priority: -- → P2
(Reporter)

Comment 1

8 years ago
'proxy' in the above code denotes a trapping proxy as described in http://wiki.ecmascript.org/doku.php?id=harmony:proxies
(Reporter)

Updated

8 years ago
See Also: → bug 582959
(Reporter)

Comment 2

8 years ago
var called = [];
var p = Proxy.create({
  getPropertyDescriptor: function(name) { called.push('getPropertyDescriptor'); return {}; },
  getOwnPropertyDescriptor: function(name) { called.push('getOwnPropertyDescriptor'); return {}; },
  has: function(name) { called.push('has'); return true; },
  get: function(r, name) { called.push('get'); return name;  }
});

Object.getOwnPropertyDescriptor(p);
print(called);

prints: getOwnPropertyDescriptor,has,getOwnPropertyDescriptor,get
expected: getOwnPropertyDescriptor
(Reporter)

Updated

8 years ago
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 582959
You need to log in before you can comment on or make changes to this bug.