-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ES2015 Proxies & Reflect API #268
Comments
I don't have my head around how Proxies are supposed to work yet but it sounds like a tough one. Right now all I can suggest is that it's time to look at the whole Object.getIds[] mechanism anyway. For instance, in cases when we're actually doing some sort of big loop, making a copy of the array is not great. Furthermore, lots of subclasses of ScriptableObject override this, and they end up generating arrays that need to be copied, and reallocated, and so on and so forth. Plus, there is code scattered all over Rhino that tries to optimize the case of generating these arrays. So I am thinking that for various reasons we need some different mechanism to get the ids from an object -- one that is based on more like an Iterator interface. We need to maintain support for the existing Scriptable interface so that existing code doesn't break, but we could add an "IterableScriptable" or something and have the runtime look for that. I know that this is fairly high-level but could you imagine some sort of set of changes to the way iteration works that would make your problem easier? |
Can you share your code? |
I can, but it'll be a few weeks before I get to it, due to other priorities |
That would be great. |
At least the Reflect API is being used by tests in the Test262 suite (that aren't about Reflect) Need to see if Reflect can be done independantly of Proxies and whether either can be implemented before #940 is resolved |
https://stackoverflow.com/questions/70448591/access-fritzbox-via-htmlunit/70465092#70465092 @p-bakker please share your code - i like to get the proxy stuff working |
I'll try to find some time to share my WIP, but if I recall correctly, one of the main reasons I didn't finish was because Rhino doesn't properly implement strict mode and fixing that requires at least one major breaking change, namely of the Callable interface: the parameter for the 'this' value is currently defined as Scriptable, but it should allow anything. As proxy/reflect deals with the 'this' value a lot (thus also a lot of the tests in test262), I parked my efforts and first focused on getting to a point where we can make this breaking change. That point being: implement all features so we can run against the latest version of the test262 suite AND get everything ready for a Rhino 2.0.0 release |
FYI: i have done a complete impl of Reflect during the last days. Currently i have to fix some issues but it looks good so far - mot of the test262 tests passing. |
@p-bakker any chance to get my hands your proxy code; i really do not like to start from scratch and i need it for HtmlUnit. |
I'll try to share, but most likely won't get to it before somewhere next week While chatting: any update on #1183? |
@rbri See https://github.com/p-bakker/rhino/tree/WIP_NativeProxy/Reflect_attempt It's really an attempt at a prototype, more than anything else |
@p-bakker thanks will have a look.... |
As the title says.
I've done work implementing Proxy as a ScriptableObject which basically delegates all calls to methods of the Scriptable interface to the provided Handler object or else to the ScriptableObject that was passed into the Proxy constructor.
This work was done against an older version of Rhino. With that version, I ran into two issues described here: https://groups.google.com/d/msg/mozilla-rhino/FII66nW7KMI/uBh8WBmdBgAJ
I can provide my Proxy code or could see if I can take it to the next level, but I'd need some pointers on the issues mentioned in the Google Groups discussion above
The text was updated successfully, but these errors were encountered: