aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings/utils.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2015-06-01 18:36:57 -0400
committerJosh Matthews <josh@joshmatthews.net>2015-06-01 18:36:57 -0400
commit453679fd1f3ffaa3bb4e292b3c73bebc9bd3e31d (patch)
tree88472de0ffca16f50a22b19d3d86163bc4e4ac99 /components/script/dom/bindings/utils.rs
parentc724444ccb85551b5a0a581d673875ec9bce3d1f (diff)
downloadservo-453679fd1f3ffaa3bb4e292b3c73bebc9bd3e31d.tar.gz
servo-453679fd1f3ffaa3bb4e292b3c73bebc9bd3e31d.zip
Trace the prototype array on the global object.
Diffstat (limited to 'components/script/dom/bindings/utils.rs')
-rw-r--r--components/script/dom/bindings/utils.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index f53451352cc..e7db5ce70ee 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -10,6 +10,7 @@ use dom::bindings::conversions::{native_from_reflector_jsmanaged, is_dom_class};
use dom::bindings::error::{Error, ErrorResult, Fallible, throw_type_error};
use dom::bindings::global::GlobalRef;
use dom::bindings::js::{Temporary, Root, Rootable};
+use dom::bindings::trace::trace_object;
use dom::browsercontext;
use dom::window;
use util::namespace;
@@ -26,7 +27,7 @@ use js::glue::{IsWrapper, RUST_JSID_IS_INT, RUST_JSID_TO_INT};
use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewFunction};
use js::jsapi::{JS_DefineProperties, JS_ForwardGetPropertyTo};
use js::jsapi::{JS_GetClass, JS_LinkConstructorAndPrototype, JS_GetStringCharsAndLength};
-use js::jsapi::JSHandleObject;
+use js::jsapi::{JSHandleObject, JSTracer};
use js::jsapi::JS_GetFunctionObject;
use js::jsapi::{JS_HasPropertyById, JS_GetPrototype};
use js::jsapi::{JS_GetProperty, JS_HasProperty, JS_SetProperty};
@@ -596,6 +597,16 @@ pub unsafe fn finalize_global(obj: *mut JSObject) {
Box::from_raw(get_proto_or_iface_array(obj) as *mut ProtoOrIfaceArray);
}
+/// Trace the resources held by reserved slots of a global object
+pub unsafe fn trace_global(tracer: *mut JSTracer, obj: *mut JSObject) {
+ let array = get_proto_or_iface_array(obj) as *mut ProtoOrIfaceArray;
+ for &proto in (*array).iter() {
+ if !proto.is_null() {
+ trace_object(tracer, "prototype", proto);
+ }
+ }
+}
+
/// Callback to outerize windows when wrapping.
pub unsafe extern fn wrap_for_same_compartment(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObject {
JS_ObjectToOuterObject(cx, obj)