diff --git a/glue.rs b/glue.rs index cef0fa829..4c7a0c23d 100644 --- a/glue.rs +++ b/glue.rs @@ -44,9 +44,10 @@ pub struct ProxyTraps { //regexp_toShared: *u8, defaultValue: *u8, iteratorNext: *u8, - finalize: *u8, + finalize: extern "C" fn(*JSFreeOp, *JSObject), getElementIfPresent: *u8, - getPrototypeOf: *u8 + getPrototypeOf: *u8, + trace: Option } #[link_args="-ljsglue"] diff --git a/jsglue.cpp b/jsglue.cpp index dbc45abf4..6b31aa13a 100644 --- a/jsglue.cpp +++ b/jsglue.cpp @@ -59,6 +59,7 @@ struct ProxyTraps { bool (*getElementIfPresent)(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, JS::Value *vp, bool *present); bool (*getPrototypeOf)(JSContext *cx, JSObject *proxy, JSObject **proto); + void (*trace)(JSTracer *trc, JSObject *proxy); }; int HandlerFamily = js::JSSLOT_PROXY_EXTRA + 0 /*JSPROXYSLOT_EXPANDO*/; @@ -256,6 +257,13 @@ class ForwardingProxyHandler : public js::BaseProxyHandler mTraps.getPrototypeOf(cx, proxy, proto) : BaseProxyHandler::getPrototypeOf(cx, proxy, proto); } + + virtual void trace(JSTracer *trc, JSObject *proxy) + { + return mTraps.trace ? + mTraps.trace(trc, proxy) : + BaseProxyHandler::trace(trc, proxy); + } }; extern "C" {