My favorites | Sign in
v8
Project Home Downloads Wiki Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 1543: Implement Proxy proposal
227 people starred this issue and may be notified of changes. Back to list
 
Project Member Reported by rossb...@chromium.org, Jul 7, 2011
Proxy implementation is still rudimentary.

Should work:

- get and set traps.
- Object.defineProperty and Object.defineProperties
- object equality
- typeof
- instanceof
- Object.getPrototype
- Object.getOwnPropertyNames and Object.keys
- ToString and ToValue

Not yet working:

- Object.getOwnPropertyDescriptor
- Object.prototype.hasOwnProperty
- Object.seal, Object.freeze, and Object.preventExtension
- Object.isSealed, Object.isFrozen, and Object.isExtensible
- in
- for-in
- with
- function proxies

Also, more test cases are needed.

Jul 8, 2011
Project Member #1 rossb...@chromium.org
 Issue 633  has been merged into this issue.
Jul 18, 2011
Project Member #2 rossb...@chromium.org
Now working:

- delete
- Object.getOwnPropertyDescriptor
- Object.seal, Object.freeze, and Object.preventExtension
- Object.isSealed, Object.isFrozen, and Object.isExtensible

Aug 31, 2011
#3 n...@andyet.net
Would love to see function proxies working. Not sure how applicable it would be to the integration into V8 core, but they have been implemented on top of V8 in https://github.com/samshull/node-proxy if that's helpful.
Aug 31, 2011
Project Member #4 rossb...@chromium.org
Sorry, I haven't updated this in a while. Also working:

- all Object.prototype methods
- in
- plus lots of bug fixes and corner cases

The function proxy implementation is currently under review and should land in a little while. See:

http://codereview.chromium.org/7623011/
http://codereview.chromium.org/7628021/

Sep 22, 2011
Project Member #5 rossb...@chromium.org
The first implementation is approaching completion. All of the following should now also be working:

- function proxies
- proxies as keys to WeakMaps
- proxies in the prototype chain
- elements (integer-indexed properties)
- descriptor conversion

The main features still missing are for-in loops and the with statement. Also, the API is not proxy aware yet.

Oct 7, 2011
#6 tim.dis...@gmail.com
Looks like there's a problem with the this-binding for function proxies. Running the attached file should print `42` not `undefined`. 
fproxy.js
1.8 KB   View   Download
Nov 10, 2011
Project Member #7 rossb...@chromium.org
Update: the implementation is feature-complete (and the above issue fixed).

The only known issues at the moment are:

1. Using `new' with a function proxy that does not have an explicit construct trap sometimes sets the wrong prototype.

2. A function proxy with a construct trap returning a non-object will no longer return the right result when frozen.

3. In some cases, the call trap of a function proxy will receive the global object even though the trap is a strict-mode function.

If you observe other issues, please report them here.
Nov 10, 2011
#8 paulpmi...@gmail.com
Awesome! When would app developers be able to use proxies in V8 without flag?
Nov 11, 2011
Project Member #9 rossb...@chromium.org
We have no immediate plans for that. The feature has to be field-tested first. Since it touches so many corners of the implementation, there is lots of opportunities for fatal bugs. So we want to be confident that everything works as expected before turning it on for everybody.

You can help by trying it out. :)

Dec 4, 2011
#10 pim...@live.nl
I think I may have encountered a bug regarding to the proxy implementation. Please see the attached script. For some reason, the following code does not work properly:

    var key = "foo";

    proxy["foo"] = "bar"; // triggers the `set` function on the proxy
    proxy[ key ] = "bar"; // does _not_ trigger the `set` function on the proxy (bug?)
proxytest.js
408 bytes   View   Download
Dec 6, 2011
#11 pim...@live.nl
Regarding comment #10, perhaps it might be useful to see a little more detail on what cases fail.

Given a proxy "proxy" with a "set" trap, only the "PASS" marked expressions of the following cases cause the "set" trap to be triggered. The "FAIL" marked expressions somehow do *not* make the "set" trap get triggered.

    var key = "foo";

    proxy.foo = "bar";         // PASS
    proxy["foo"] = "bar";      // PASS
    proxy["foo" + ""] = "bar"; // *FAIL*
    proxy[key] = "bar";        // *FAIL*
    proxy[123] = "bar";        // *FAIL*
    proxy["123"] = "bar";      // *FAIL*
    proxy["123foo"] = "bar";   // PASS

Does anyone know whether this behaviour is buggy or intended?
proxy_bug_tests.js
614 bytes   View   Download
Dec 6, 2011
#12 rossb...@google.com
That certainly is a bug. Thanks for reporting! I will look into it soon.

/Andreas
Dec 7, 2011
Project Member #13 rossb...@chromium.org
Hm, how did you run this, what architecture, and what version of V8 and/or Chrome? I'm afraid I cannot reproduce the failures in the D8 shell (with s/console.log/print/g), on none of our supported architectures.

Dec 7, 2011
#14 pim...@live.nl
I'm running V8 as part of Node.js version 0.6.5, which uses V8 version 3.6.6.11. I now see it's not the latest version, so perhaps it has been fixed already. In that case I'm sorry.

I'm not very technical but I can tell have an Intel T1400 processor.
Dec 7, 2011
Project Member #15 rossb...@chromium.org
Ah, OK. Yes, the proxy implementation is far from complete in that version of V8. You'd need to update to a more recent 3.7.x.
Jan 20, 2012
#16 pim...@live.nl
I'm sorry for posting again, but I would like to mention the following behaviour which I think is a bug. I can reproduce it with the latest revision.

When creating a proxy function, calling it works fine. However, passing it as the argument to e.g. `Array.prototype.map` fails. It throws "illegal access" in that case.

Please see the attached test case.
proxy_func_map.js
302 bytes   View   Download
Jan 20, 2012
Project Member #17 rossb...@chromium.org
Thanks for the bug report! Yes, this is a bug, the fix should land soon.

See: https://chromiumcodereview.appspot.com/9270004/

May 24, 2012
#18 tvcut...@gmail.com
There seems to be an issue with the getOwnPropertyNames and keys traps, when they return property names that are also present in Object.prototype. Somehow this raises a TypeError that duplicate property names were returned. See the attached testcase.
prototype_keys_bug.js
463 bytes   View   Download
May 29, 2012
Project Member #19 rossb...@chromium.org
Hi Tom, thanks for the bug report.

I fixed this (including the broken error message with the "undefined" trap name), and also the receiver bug you point out on github (https://github.com/tvcutsem/harmony-reflect/issues/4#issuecomment-5831098).

On the other hand, as you probably have guessed, the fact that V8 does not call the `has' trap separately for assignment to inherited properties is intentional, and should match the refactored spec.
Aug 3, 2012
#20 amdfc...@gmail.com
When will this land? I've been waiting for this feature to be available in v8 and Chrome
Aug 3, 2012
Project Member #21 yangguo@chromium.org
If you are referring to proxies in Javascript, it already landed, but hidden behind a flag. To turn it on, go to chrome://flags/ and "Enable Experimental JavaScript".
Nov 21, 2012
#22 metaw...@gmail.com
Google Apps Script's Html Service relies on Firefox's proxies implementation and falls back on a much less efficient hack on other browsers; it would be great for us if it could come out from behind the flag soon.
Nov 21, 2012
#23 bruan...@gmail.com
How much are they relying on it? Firefox implementation is incomplete and has many known (and likely unknown!) bugs.
Also, to my knowledge, current V8 implementation relates to the old Proxy design. I don't think work to support direct proxies has started (if I'm wrong, please point me to the right V8 bug)
Nov 22, 2012
#24 TheRealB...@gmail.com
Re: comment 23 -- "(and likely unknown!) bugs" is LOL unreal. Since when did V8 ship without unknown bugs? How do you prove a negative?

How are you going to find and fix proxy bugs that Google itself seems to want fixed, without turning on proxies? How are you going to help fix the ES6 draft spec, which we helped get in shape by prototyping proxies two years ago?

Fear of bugs does not prevent all sorts of innovation from being shipped in Chrome -- some of it on no standards track and very unlikely ever to be.

BTW SpiderMonkey supports direct proxies (yes, with bugs -- please file them as they become known) now. Time to get V8 interop-testing so we can fix the spec as well as the implementations, and lead the other browsers to implement as well.

/be
Nov 22, 2012
#25 amiag...@ghostery.com
Ghostery, a popular privacy extension for browsers, is waiting on Proxies in V8 to provide better script surrogation to its users.

Script surrogation is the act of replacing blocked tracker scripts with dummy copies in order to allow badly-coded websites to continue to function. However, listing out every method call for every tracker script isn't scalable.

__noSuchMethod__ is Firefox-only and deprecated. Proxies are the future, but have been "on the way" for a while now.
Jan 31, 2013
#26 Arte...@gmail.com
Any plans on when this is going to be implemented?
Jan 31, 2013
Project Member #27 arv@chromium.org
Proxies are still seeing a lot of churn in the ES6 draft so it seems better to wait until the API stabilizes a bit more.
Jan 31, 2013
Project Member #28 rossb...@chromium.org
By "this" you mean?

No concrete plans right now. There is some likelihood that the ES6 proxy design will undergo another substantial change, so it seems wiser to hold off.
Jan 31, 2013
#29 Arte...@gmail.com
I'm sorry, guys. By "this" I meant proxies, of course.

Thanks for the info!
Sep 29, 2013
#30 salovej...@gmail.com
hg7fb9fu6qn9
Oct 19, 2013
#31 bruan...@gmail.com
"Proxies are still seeing a lot of churn in the ES6 draft so it seems better to wait until the API stabilizes a bit more."
"There is some likelihood that the ES6 proxy design will undergo another substantial change, so it seems wiser to hold off."
=> At the May 2013 TC39 meeting, it's been agreed that direct proxies (new Proxy(target, handler)) would be the final design.
https://github.com/rwaldron/tc39-notes/blob/master/es6/2013-05/may-21.md#44-proxies

From what I know, the design is now very stable. Maybe time to reconsider? :-)
Oct 25, 2013
#32 dome...@domenicdenicola.com
The Node.js team has a use for direct proxies: allowing us to create fake globals that intercept defineProperties on them for use in the vm module. Currently we use ObjectTemplate which has GlobalPropertyGetterCallback, GlobalPropertySetterCallback, GlobalPropertyQueryCallback, GlobalPropertyDeleterCallback, GlobalPropertyEnumeratorCallback, but this does not encompass all operations. In particular, it does not have defineProperty, so if people declare global functions inside the vm, we have no way to intercept that.

If direct proxies were available, we could turn them on in V8, then use them to implement this desired proxying behavior. As is, we shouldn't turn on --harmony-proxies, because then Node.js consumers would start using the old API.

More details about the particular use case at https://github.com/joyent/node/pull/6417.
Oct 28, 2013
#33 slBre...@gmail.com
Since harmony is almost finished, can we get any idea of when updating proxies to match the direct proxy design will start being looked at?
Oct 29, 2013
#34 rossb...@google.com
ES6 comes with a _lot_ of new features, many of which we still have to work on. To be honest, proxies are not at the top of our priority list.
Jan 9, 2014
#35 deryl...@gmail.com
I'm not asking for a fully functional direct proxy implementation in chrome (V8), all I would like to know is that when ES6 comes out I'm gonna be able to use the same code in firefox and chrome (with direct proxies).
Is there any chance for that?
Jan 9, 2014
#36 tvcut...@gmail.com
You can achieve writing the same Proxy code for firefox, chrome and node today by using my shim:
<https://github.com/tvcutsem/harmony-reflect>
It's not perfect, but people are using it so it could be useful in the short term.
Jan 9, 2014
Project Member #37 rossb...@chromium.org
It is very unlikely that we are going to be finished with implementing all of ES6 the day the standard is officially sanctioned, if that's what you are asking.
Jan 9, 2014
#38 deryl...@gmail.com
Thats obvious, my quetion was only about direct proxies since their implementation is nearly complete in gecko.
Jan 9, 2014
Project Member #39 rossb...@chromium.org
I thought I already answered that: it's not high on our priority list, so it gets done when we get to it. The ES6 spec release date has no more influence on proxies than on any other ES6 feature.
Apr 2, 2014
#40 nat...@github.com
A stable proxies implementation could also help us on the Atom team. We'd love to start experimenting with membranes to implement sophisticated security policies.
May 5, 2014
Project Member #41 adamk@chromium.org
(No comment was entered for this change.)
Blockedon: v8:3310
Jul 17, 2014
#42 mike.mar...@gmail.com
I'd just like to add a friendly +1 here. Been experimenting with proxies a lot in FF, and I'm very eagerly awaiting this in V8.
Sep 25, 2014
#43 nison.m...@gmail.com
@Ross wouldn't it better to finish implementing ES6 before the standard is officially sanctionned, so you can give some implementor feedback before shipping flawed specs ?

Anyway, we're really looking forward to be able to use ES6 feature :)
Oct 15, 2014
#44 ajacksif...@gmail.com
Looks like the old Proxy (pre-direct) implementation was removed, so harmony-reflect no longer works. Is there any intention to restore the old Proxy, or will it be gone until the ES6 direct-proxy implementation is ready?
Oct 15, 2014
Project Member #45 arv@chromium.org
It wasn't removed. It was removed from --harmony due to some security(?) issues. Try using --harmony-proxies instead.
Oct 15, 2014
#46 ajacksif...@gmail.com
I think my issue belongs in the chromium issue tracker instead of here - it's no longer exposed to the browser, although it is available in v8. Sorry for the confusion.
Oct 15, 2014
#47 tomvc...@gmail.com
Where can I read more about the (security?) issues that caused the old Proxy object to be removed? Thanks.
Oct 16, 2014
Project Member #48 rossb...@chromium.org
#46: no reason to report this on chromium, here was the right place.
Nov 18, 2014
Project Member #49 rossb...@chromium.org
(No comment was entered for this change.)
Blockedon: v8:2141 v8:2145 v8:3510
Sign in to add a comment

Powered by Google Project Hosting