aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-05-15 20:58:51 +0200
committerMs2ger <ms2ger@gmail.com>2014-05-15 20:58:51 +0200
commit81821052040eab42e9b3ca72aeccbb17cd002197 (patch)
treed6587e4fcfa46169592f466f4560d6201a34de95
parent765cea73d94f5b2a17272a895e0d99cf239e5b81 (diff)
downloadservo-81821052040eab42e9b3ca72aeccbb17cd002197.tar.gz
servo-81821052040eab42e9b3ca72aeccbb17cd002197.zip
Use JS_ObjectToOuterObject in wrap callbacks.
-rw-r--r--src/components/script/dom/bindings/utils.rs31
m---------src/support/spidermonkey/rust-mozjs0
2 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)
}
}
diff --git a/src/support/spidermonkey/rust-mozjs b/src/support/spidermonkey/rust-mozjs
-Subproject 07f19496bd7703b502812a6b4228f08dec59ec0
+Subproject ff296137c652248138eb7f5a377d8daac52ed23