Open Bug 863952 Opened 7 years ago Updated 8 months ago
Implement support for static attributes and operations in JS-implemented Web
Right now we try to do things with instance pointers, which is no good: ../TestJSImplGenBinding.cpp:22904:10: error: invalid use of member 'mImpl' in static member function return mImpl->GetStaticAttribute(global, aRv); This involves figuring out how to expose static stuff; existing callback codegen never has to worry about it.
Do we have any ETA for this feature?
I don't think this is on anybody's radar. Do you need it for something?
I tried to implement notifications in JS and they include a static method. But it's not super urgent.
The main pain points for this are: 1) How to represent GlobalObject in JS? 2) How to find the method to call, given no instance object? #2 is by far the bigger problem. :(
I think I'll try this: 1) Generate static functions on the native binding class that call static functions on the *JSImpl class 2) Make the *JSImpl static functions call JS functions on the JS object of the XPCOM factory for the contractid of the WebIDL interface 3) add a helper to XPCOMUtils.jsm to create an object that inherits from the JS component's prototype and has a createInstance method, to be used as a _xpcom_factory on the JS component GlobalObject can probably be reflected as a JS object?
Assignee: nobody → peterv
Status: NEW → ASSIGNED
:peterv, do you have a plan for this at all? It seems like it's languishing, likely because of no really strong interest. I think that I can generate that interest if that is what is holding you back. I could probably manage to stumble my way through an implementation of this if it came to that, but I think we'd all rather someone with background in the area did the work.
(In reply to Martin Thomson [:mt:] from comment #7) > :peterv, do you have a plan for this at all? It seems like it's > languishing, likely because of no really strong interest. It's not a matter of interest but of time. I'm currently working on non-binding things. I have patches for this, but they've probably bitrotted. Most of the work is converting existing JS implemented bindings, and there are more of those added to the tree regularly. There
There are workarounds available if you're really blocked by this, but I need to figure out if they work for interfaces with both static and non-static attributes. I'll post in bug 1172785.
I'm interested in hearing about those workarounds. I have a static method that I'd like to route to a C++ implementation somehow.
Oh, and if you feel like you don't have the time to clean up the bitrotted patches, please just throw them up here on the bug. I might not be fast, but I think that I could produce something that works with only a modest amount of help from you or others.
You need to log in before you can comment on or make changes to this bug.