On Thu, Dec 13, 2012 at 2:58 PM, David Bruant <bruan...@gmail.com> wrote:
> Le 13/12/2012 20:47, Jason Orendorff a écrit : > > David: https://gist.github.com/4279162 > > I think this is what Kevin has in mind. Note in particular that the target > of the Proxy is just a dummy object, and the handler ignores it entirely. > The proxy uses it for invariant checks, but the intent is that those would > always pass. > > but they do not; try: > > var [p, setTarget] = retargetableProxy({}); // I love destructuring > sooo much! > Object.defineProperty(p, 'a', {configurable: false, value:31}); > In my proposal, this would fail ("refuse to commit to any invariant" as I put it above). The handler specifically refuses anything non-configurable or non-writable-data. > setTarget({}); > Object.getOwnPropertyDescriptor(p, 'a'); // invariant check throws here > > Any variant that can be written will have the same issue. Even trickeries > with the defineProperty trap. > The proxy is enforcing invariants against the dummy [[target]]. The same > is to be expected from WindowProxy instances even if their underlying > window changes. It doesn't matter if the invariant is enforced on the dummy > target on an actual window instance. It is enforced and that's the > "problem" (with WindowProxy implemented as they are now not being emulable > with proxies) >
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss