|
| JSI_GUIProxy () |
|
| ~JSI_GUIProxy () |
|
bool | PropGetter (JS::HandleObject proxy, const std::string &propName, JS::MutableHandleValue vp) const |
|
virtual bool | get (JSContext *cx, JS::HandleObject proxy, JS::HandleValue receiver, JS::HandleId id, JS::MutableHandleValue vp) const override final |
|
virtual bool | set (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::HandleValue vp, JS::HandleValue receiver, JS::ObjectOpResult &result) const final |
|
virtual bool | delete_ (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::ObjectOpResult &result) const override final |
|
virtual bool | getOwnPropertyDescriptor (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::MutableHandle< mozilla::Maybe< JS::PropertyDescriptor > > desc) const override |
|
virtual bool | defineProperty (JSContext *cx, JS::HandleObject proxy, JS::HandleId id, JS::Handle< JS::PropertyDescriptor > desc, JS::ObjectOpResult &result) const override |
|
virtual bool | ownPropertyKeys (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override |
|
virtual bool | enumerate (JSContext *cx, JS::HandleObject proxy, JS::MutableHandleIdVector props) const override |
|
virtual bool | getPrototypeIfOrdinary (JSContext *cx, JS::HandleObject proxy, bool *isOrdinary, JS::MutableHandleObject protop) const override |
|
virtual bool | setImmutablePrototype (JSContext *cx, JS::HandleObject proxy, bool *succeeded) const override |
|
virtual bool | preventExtensions (JSContext *cx, JS::HandleObject proxy, JS::ObjectOpResult &result) const override |
|
virtual bool | isExtensible (JSContext *cx, JS::HandleObject proxy, bool *extensible) const override |
|
void | CreateFunctions (const ScriptRequest &rq, GUIProxyProps *cache) |
|
void | CreateFunctions (const ScriptRequest &rq, GUIProxyProps *cache) |
|
void | CreateFunctions (const ScriptRequest &rq, GUIProxyProps *cache) |
|
void | CreateFunctions (const ScriptRequest &rq, GUIProxyProps *cache) |
|
void | CreateFunctions (const ScriptRequest &rq, GUIProxyProps *cache) |
|
template<typename GUIObjectType>
class JSI_GUIProxy< GUIObjectType >
Handles the js interface with C++ GUI objects.
Proxy handlers must live for at least as long as the JS runtime where a proxy object with that handler was created. The reason is that proxy handlers are called during GC, such as on runtime destruction. In practical terms, this means "just keep them static and store no data".
GUI Objects only exist in C++ and have no JS-only properties. As such, there is no "target" JS object that this proxy could point to, and thus we should inherit from BaseProxyHandler and not js::Wrapper.
Proxies can be used with prototypes and almost treated like regular JS objects. However, the default implementation embarks a lot of code that we don't really need here, since the only fanciness is that we cache JSFunction* properties. As such, these GUI proxies don't have one and instead override get/set directly.
To add a new JSI_GUIProxy, you'll need to:
- overload CreateJSObject in your class header.
- change the CGUI::AddObjectTypes method.
- explicitly instantiate the template & CreateJSObject via DECLARE_GUIPROXY.