diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index f77b42648d9..4b5dffc1875 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -428,7 +428,7 @@ impl DerefMut for RootedVec { /// SM Callback that traces the rooted collections -pub unsafe extern fn trace_collections(tracer: *mut JSTracer, _data: *mut libc::c_void) { +pub unsafe fn trace_collections(tracer: *mut JSTracer) { ROOTED_COLLECTIONS.with(|ref collections| { let collections = collections.borrow(); collections.trace(tracer); diff --git a/components/script/script_task.rs b/components/script/script_task.rs index dbb73117857..7ef0b274167 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -99,12 +99,14 @@ use time::Tm; thread_local!(pub static STACK_ROOTS: Cell> = Cell::new(None)); thread_local!(static SCRIPT_TASK_ROOT: RefCell> = RefCell::new(None)); -unsafe extern fn trace_script_tasks(tr: *mut JSTracer, _data: *mut libc::c_void) { +unsafe extern fn trace_rust_roots(tr: *mut JSTracer, _data: *mut libc::c_void) { SCRIPT_TASK_ROOT.with(|root| { if let Some(script_task) = *root.borrow() { (*script_task).trace(tr); } }); + + trace_collections(tr); } /// A document load that is in the process of fetching the requested resource. Contains @@ -463,7 +465,7 @@ impl ScriptTask { unsafe { - JS_SetExtraGCRootsTracer((*js_runtime).ptr, Some(trace_collections), ptr::null_mut()); + JS_SetExtraGCRootsTracer((*js_runtime).ptr, Some(trace_rust_roots), ptr::null_mut()); } // Unconstrain the runtime's threshold on nominal heap size, to avoid // triggering GC too often if operating continuously near an arbitrary @@ -483,7 +485,6 @@ impl ScriptTask { js_context.set_logging_error_reporter(); unsafe { JS_SetGCZeal((*js_context).ptr, 0, JS_DEFAULT_ZEAL_FREQ); - JS_SetExtraGCRootsTracer((*js_runtime).ptr, Some(trace_script_tasks), ptr::null_mut()); } // Needed for debug assertions about whether GC is running.