diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-05-15 20:58:51 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-05-15 20:58:51 +0200 |
commit | 81821052040eab42e9b3ca72aeccbb17cd002197 (patch) | |
tree | d6587e4fcfa46169592f466f4560d6201a34de95 /src/components/script/dom | |
parent | 765cea73d94f5b2a17272a895e0d99cf239e5b81 (diff) | |
download | servo-81821052040eab42e9b3ca72aeccbb17cd002197.tar.gz servo-81821052040eab42e9b3ca72aeccbb17cd002197.zip |
Use JS_ObjectToOuterObject in wrap callbacks.
Diffstat (limited to 'src/components/script/dom')
-rw-r--r-- | src/components/script/dom/bindings/utils.rs | 31 |
1 files changed, 4 insertions, 27 deletions
diff --git a/src/components/script/dom/bindings/utils.rs b/src/components/script/dom/bindings/utils.rs index 507f024c5d6..7c742efcbb2 100644 --- a/src/components/script/dom/bindings/utils.rs +++ b/src/components/script/dom/bindings/utils.rs @@ -37,6 +37,7 @@ use js::jsapi::{JSContext, JSObject, JSBool, jsid, JSClass, JSNative}; use js::jsapi::{JSFunctionSpec, JSPropertySpec}; use js::jsapi::{JS_NewGlobalObject, JS_InitStandardClasses}; use js::jsapi::{JSString}; +use js::jsfriendapi::JS_ObjectToOuterObject; use js::jsfriendapi::bindgen::JS_NewObjectWithUniqueType; use js::jsval::JSVal; use js::jsval::{PrivateValue, ObjectValue, NullValue, ObjectOrNullValue}; @@ -594,38 +595,14 @@ pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject { pub extern fn wrap_for_same_compartment(cx: *JSContext, obj: *JSObject) -> *JSObject { unsafe { - let clasp = JS_GetClass(obj); - let clasp = clasp as *js::Class; - match (*clasp).ext.outerObject { - Some(outerize) => { - debug!("found an outerize hook"); - let obj = JSHandleObject { unnamed: &obj }; - outerize(cx, obj) - } - None => { - debug!("no outerize hook found"); - obj - } - } + JS_ObjectToOuterObject(cx as *mut _, obj as *mut _) as *_ } } pub extern fn pre_wrap(cx: *mut JSContext, _scope: *mut JSObject, - obj: *mut JSObject, flags: c_uint) -> *mut JSObject { + obj: *mut JSObject, _flags: c_uint) -> *mut JSObject { unsafe { - let clasp = JS_GetClass(obj as *_); - let clasp = clasp as *js::Class; - match (*clasp).ext.outerObject { - Some(outerize) => { - debug!("found an outerize hook"); - let obj = JSHandleObject { unnamed: &(obj as *_) }; - outerize(cx as *_, obj) as *mut _ - } - None => { - debug!("no outerize hook found"); - obj - } - } + JS_ObjectToOuterObject(cx, obj) } } |