From 1c9ce04320a6c42b9877a750d755ab20a37f3ed4 Mon Sep 17 00:00:00 2001 From: Rizky Luthfianto Date: Sat, 21 Nov 2015 01:46:10 +0700 Subject: [PATCH] refactor(script): move SetDOMProxyInformation() call to lib.rs --- components/script/lib.rs | 3 +++ components/script/script_task.rs | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/components/script/lib.rs b/components/script/lib.rs index 3ef9edff9ff6..cd2a0720ce22 100644 --- a/components/script/lib.rs +++ b/components/script/lib.rs @@ -99,6 +99,8 @@ mod unpremultiplytable; mod webdriver_handlers; use dom::bindings::codegen::RegisterBindings; +use js::jsapi::SetDOMProxyInformation; +use std::ptr; #[cfg(target_os = "linux")] #[allow(unsafe_code)] @@ -145,6 +147,7 @@ fn perform_platform_specific_initialization() {} pub fn init() { unsafe { assert_eq!(js::jsapi::JS_Init(), true); + SetDOMProxyInformation(ptr::null(), 0, Some(script_task::shadow_check_callback)); } // Create the global vtables used by the (generated) DOM diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 5a12d9e004fd..6205866f2dc0 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -49,7 +49,7 @@ use hyper::mime::{Mime, SubLevel, TopLevel}; use ipc_channel::ipc::{self, IpcSender}; use ipc_channel::router::ROUTER; use js::glue::CollectServoSizes; -use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject, RootedValue, SetDOMProxyInformation}; +use js::jsapi::{DOMProxyShadowsResult, HandleId, HandleObject, RootedValue}; use js::jsapi::{DisableIncrementalGC, JS_AddExtraGCRootsTracer, JS_SetWrapObjectCallbacks}; use js::jsapi::{GCDescription, GCProgress, JSGCInvocationKind, SetGCSliceCallback}; use js::jsapi::{JSAutoRequest, JSGCStatus, JS_GetRuntime, JS_SetGCCallback, SetDOMCallbacks}; @@ -582,7 +582,7 @@ unsafe extern "C" fn debug_gc_callback(_rt: *mut JSRuntime, status: JSGCStatus, } } -unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext, +pub unsafe extern "C" fn shadow_check_callback(_cx: *mut JSContext, _object: HandleObject, _id: HandleId) -> DOMProxyShadowsResult { // XXX implement me DOMProxyShadowsResult::ShadowCheckFailed @@ -693,7 +693,6 @@ impl ScriptTask { unsafe { unsafe extern "C" fn empty_wrapper_callback(_: *mut JSContext, _: *mut JSObject) -> bool { true } - SetDOMProxyInformation(ptr::null(), 0, Some(shadow_check_callback)); SetDOMCallbacks(runtime.rt(), &DOM_CALLBACKS); SetPreserveWrapperCallback(runtime.rt(), Some(empty_wrapper_callback)); // Pre barriers aren't working correctly at the moment