mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Use *mut T for the T* pointers in SpiderMonkey.
This commit is contained in:
parent
3e4b2c1c7b
commit
d5cb4377ef
18 changed files with 294 additions and 308 deletions
|
@ -67,14 +67,14 @@ fn is_dom_class(clasp: *JSClass) -> bool {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn is_dom_proxy(obj: *JSObject) -> bool {
|
||||
pub fn is_dom_proxy(obj: *mut JSObject) -> bool {
|
||||
unsafe {
|
||||
(js_IsObjectProxyClass(obj) || js_IsFunctionProxyClass(obj)) &&
|
||||
IsProxyHandlerFamily(obj)
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn dom_object_slot(obj: *JSObject) -> u32 {
|
||||
pub unsafe fn dom_object_slot(obj: *mut JSObject) -> u32 {
|
||||
let clasp = JS_GetClass(obj);
|
||||
if is_dom_class(clasp) {
|
||||
DOM_OBJECT_SLOT as u32
|
||||
|
@ -84,13 +84,13 @@ pub unsafe fn dom_object_slot(obj: *JSObject) -> u32 {
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn unwrap<T>(obj: *JSObject) -> *mut T {
|
||||
pub unsafe fn unwrap<T>(obj: *mut JSObject) -> *mut T {
|
||||
let slot = dom_object_slot(obj);
|
||||
let val = JS_GetReservedSlot(obj, slot);
|
||||
val.to_private() as *mut T
|
||||
}
|
||||
|
||||
pub unsafe fn get_dom_class(obj: *JSObject) -> Result<DOMClass, ()> {
|
||||
pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<DOMClass, ()> {
|
||||
let clasp = JS_GetClass(obj);
|
||||
if is_dom_class(clasp) {
|
||||
debug!("plain old dom object");
|
||||
|
@ -106,7 +106,7 @@ pub unsafe fn get_dom_class(obj: *JSObject) -> Result<DOMClass, ()> {
|
|||
return Err(());
|
||||
}
|
||||
|
||||
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *JSObject,
|
||||
pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
||||
proto_id: PrototypeList::id::ID,
|
||||
proto_depth: uint) -> Result<JS<T>, ()> {
|
||||
unsafe {
|
||||
|
@ -144,17 +144,17 @@ pub unsafe fn squirrel_away_unique<T>(x: Box<T>) -> *T {
|
|||
cast::transmute(x)
|
||||
}
|
||||
|
||||
pub fn jsstring_to_str(cx: *JSContext, s: *JSString) -> DOMString {
|
||||
pub fn jsstring_to_str(cx: *mut JSContext, s: *mut JSString) -> DOMString {
|
||||
unsafe {
|
||||
let length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, s, &length);
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, s, &mut length);
|
||||
slice::raw::buf_as_slice(chars, length as uint, |char_vec| {
|
||||
str::from_utf16(char_vec).unwrap()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
pub fn jsid_to_str(cx: *JSContext, id: jsid) -> DOMString {
|
||||
pub fn jsid_to_str(cx: *mut JSContext, id: jsid) -> DOMString {
|
||||
unsafe {
|
||||
assert!(RUST_JSID_IS_STRING(id) != 0);
|
||||
jsstring_to_str(cx, RUST_JSID_TO_STRING(id))
|
||||
|
@ -206,30 +206,30 @@ pub struct DOMJSClass {
|
|||
pub dom_class: DOMClass
|
||||
}
|
||||
|
||||
pub fn GetProtoOrIfaceArray(global: *JSObject) -> **JSObject {
|
||||
pub fn GetProtoOrIfaceArray(global: *mut JSObject) -> **mut JSObject {
|
||||
unsafe {
|
||||
assert!(((*JS_GetClass(global)).flags & JSCLASS_DOM_GLOBAL) != 0);
|
||||
JS_GetReservedSlot(global, DOM_PROTOTYPE_SLOT).to_private() as **JSObject
|
||||
JS_GetReservedSlot(global, DOM_PROTOTYPE_SLOT).to_private() as **mut JSObject
|
||||
}
|
||||
}
|
||||
|
||||
pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
||||
protoProto: *JSObject, protoClass: *JSClass,
|
||||
constructor: Option<JSNative>,
|
||||
pub fn CreateInterfaceObjects2(cx: *mut JSContext, global: *mut JSObject, receiver: *mut JSObject,
|
||||
protoProto: *mut JSObject, protoClass: *JSClass,
|
||||
constructor: JSNative,
|
||||
ctorNargs: u32,
|
||||
domClass: *DOMClass,
|
||||
methods: *JSFunctionSpec,
|
||||
properties: *JSPropertySpec,
|
||||
constants: *ConstantSpec,
|
||||
staticMethods: *JSFunctionSpec,
|
||||
name: &str) -> *JSObject {
|
||||
let mut proto = ptr::null();
|
||||
name: &str) -> *mut JSObject {
|
||||
let mut proto = ptr::mut_null();
|
||||
if protoClass.is_not_null() {
|
||||
proto = CreateInterfacePrototypeObject(cx, global, protoProto,
|
||||
protoClass, methods,
|
||||
properties, constants);
|
||||
if proto.is_null() {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
unsafe {
|
||||
|
@ -238,7 +238,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
|||
}
|
||||
}
|
||||
|
||||
let mut interface = ptr::null();
|
||||
let mut interface = ptr::mut_null();
|
||||
if constructor.is_some() {
|
||||
interface = name.to_c_str().with_ref(|s| {
|
||||
CreateInterfaceObject(cx, global, receiver,
|
||||
|
@ -246,7 +246,7 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
|||
staticMethods, constants, s)
|
||||
});
|
||||
if interface.is_null() {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,17 +257,17 @@ pub fn CreateInterfaceObjects2(cx: *JSContext, global: *JSObject, receiver: *JSO
|
|||
}
|
||||
}
|
||||
|
||||
fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
||||
constructorNative: Option<JSNative>,
|
||||
ctorNargs: u32, proto: *JSObject,
|
||||
fn CreateInterfaceObject(cx: *mut JSContext, global: *mut JSObject, receiver: *mut JSObject,
|
||||
constructorNative: JSNative,
|
||||
ctorNargs: u32, proto: *mut JSObject,
|
||||
staticMethods: *JSFunctionSpec,
|
||||
constants: *ConstantSpec,
|
||||
name: *libc::c_char) -> *JSObject {
|
||||
name: *libc::c_char) -> *mut JSObject {
|
||||
unsafe {
|
||||
let fun = JS_NewFunction(cx, constructorNative, ctorNargs,
|
||||
JSFUN_CONSTRUCTOR, global, name);
|
||||
if fun.is_null() {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
let constructor = JS_GetFunctionObject(fun);
|
||||
|
@ -275,34 +275,34 @@ fn CreateInterfaceObject(cx: *JSContext, global: *JSObject, receiver: *JSObject,
|
|||
|
||||
if staticMethods.is_not_null() &&
|
||||
!DefineMethods(cx, constructor, staticMethods) {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if constants.is_not_null() &&
|
||||
!DefineConstants(cx, constructor, constants) {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if proto.is_not_null() && JS_LinkConstructorAndPrototype(cx, constructor, proto) == 0 {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
let alreadyDefined = 0;
|
||||
if JS_AlreadyHasOwnProperty(cx, receiver, name, &alreadyDefined) == 0 {
|
||||
return ptr::null();
|
||||
let mut alreadyDefined = 0;
|
||||
if JS_AlreadyHasOwnProperty(cx, receiver, name, &mut alreadyDefined) == 0 {
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if alreadyDefined == 0 &&
|
||||
JS_DefineProperty(cx, receiver, name, ObjectValue(&*constructor),
|
||||
None, None, 0) == 0 {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
return constructor;
|
||||
}
|
||||
}
|
||||
|
||||
fn DefineConstants(cx: *JSContext, obj: *JSObject, constants: *ConstantSpec) -> bool {
|
||||
fn DefineConstants(cx: *mut JSContext, obj: *mut JSObject, constants: *ConstantSpec) -> bool {
|
||||
let mut i = 0;
|
||||
loop {
|
||||
unsafe {
|
||||
|
@ -330,52 +330,52 @@ fn DefineConstants(cx: *JSContext, obj: *JSObject, constants: *ConstantSpec) ->
|
|||
}
|
||||
}
|
||||
|
||||
fn DefineMethods(cx: *JSContext, obj: *JSObject, methods: *JSFunctionSpec) -> bool {
|
||||
fn DefineMethods(cx: *mut JSContext, obj: *mut JSObject, methods: *JSFunctionSpec) -> bool {
|
||||
unsafe {
|
||||
JS_DefineFunctions(cx, obj, methods) != 0
|
||||
}
|
||||
}
|
||||
|
||||
fn DefineProperties(cx: *JSContext, obj: *JSObject, properties: *JSPropertySpec) -> bool {
|
||||
fn DefineProperties(cx: *mut JSContext, obj: *mut JSObject, properties: *JSPropertySpec) -> bool {
|
||||
unsafe {
|
||||
JS_DefineProperties(cx, obj, properties) != 0
|
||||
}
|
||||
}
|
||||
|
||||
fn CreateInterfacePrototypeObject(cx: *JSContext, global: *JSObject,
|
||||
parentProto: *JSObject, protoClass: *JSClass,
|
||||
fn CreateInterfacePrototypeObject(cx: *mut JSContext, global: *mut JSObject,
|
||||
parentProto: *mut JSObject, protoClass: *JSClass,
|
||||
methods: *JSFunctionSpec,
|
||||
properties: *JSPropertySpec,
|
||||
constants: *ConstantSpec) -> *JSObject {
|
||||
constants: *ConstantSpec) -> *mut JSObject {
|
||||
unsafe {
|
||||
let ourProto = JS_NewObjectWithUniqueType(cx, protoClass, parentProto, global);
|
||||
if ourProto.is_null() {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if methods.is_not_null() && !DefineMethods(cx, ourProto, methods) {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if properties.is_not_null() && !DefineProperties(cx, ourProto, properties) {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
if constants.is_not_null() && !DefineConstants(cx, ourProto, constants) {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
|
||||
return ourProto;
|
||||
}
|
||||
}
|
||||
|
||||
pub extern fn ThrowingConstructor(_cx: *JSContext, _argc: c_uint, _vp: *mut JSVal) -> JSBool {
|
||||
pub extern fn ThrowingConstructor(_cx: *mut JSContext, _argc: c_uint, _vp: *mut JSVal) -> JSBool {
|
||||
//XXX should trigger exception here
|
||||
return 0;
|
||||
}
|
||||
|
||||
pub fn initialize_global(global: *JSObject) {
|
||||
let protoArray = box () ([0 as *JSObject, ..PrototypeList::id::IDCount as uint]);
|
||||
pub fn initialize_global(global: *mut JSObject) {
|
||||
let protoArray = box () ([0 as *mut JSObject, ..PrototypeList::id::IDCount as uint]);
|
||||
unsafe {
|
||||
let box_ = squirrel_away_unique(protoArray);
|
||||
JS_SetReservedSlot(global,
|
||||
|
@ -392,23 +392,23 @@ pub trait Reflectable {
|
|||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: Box<T>,
|
||||
window: &JSRef<window::Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, &JSRef<window::Window>, Box<T>) -> JS<T>)
|
||||
wrap_fn: extern "Rust" fn(*mut JSContext, &JSRef<window::Window>, Box<T>) -> JS<T>)
|
||||
-> Temporary<T> {
|
||||
Temporary::new(wrap_fn(window.deref().get_cx(), window, obj))
|
||||
}
|
||||
|
||||
#[deriving(Eq)]
|
||||
pub struct Reflector {
|
||||
pub object: *JSObject,
|
||||
pub object: *mut JSObject,
|
||||
}
|
||||
|
||||
impl Reflector {
|
||||
#[inline]
|
||||
pub fn get_jsobject(&self) -> *JSObject {
|
||||
pub fn get_jsobject(&self) -> *mut JSObject {
|
||||
self.object
|
||||
}
|
||||
|
||||
pub fn set_jsobject(&mut self, object: *JSObject) {
|
||||
pub fn set_jsobject(&mut self, object: *mut JSObject) {
|
||||
assert!(self.object.is_null());
|
||||
assert!(object.is_not_null());
|
||||
self.object = object;
|
||||
|
@ -417,19 +417,19 @@ impl Reflector {
|
|||
/// Return a pointer to the memory location at which the JS reflector object is stored.
|
||||
/// Used by Temporary values to root the reflector, as required by the JSAPI rooting
|
||||
/// APIs.
|
||||
pub fn rootable<'a>(&'a self) -> &'a *JSObject {
|
||||
&self.object
|
||||
pub fn rootable<'a>(&'a mut self) -> &'a mut *mut JSObject {
|
||||
&mut self.object
|
||||
}
|
||||
|
||||
pub fn new() -> Reflector {
|
||||
Reflector {
|
||||
object: ptr::null(),
|
||||
object: ptr::mut_null(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn GetPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid, found: *mut bool,
|
||||
vp: *JSVal) -> bool {
|
||||
pub fn GetPropertyOnPrototype(cx: *mut JSContext, proxy: *mut JSObject, id: jsid, found: *mut bool,
|
||||
vp: *mut JSVal) -> bool {
|
||||
unsafe {
|
||||
//let proto = GetObjectProto(proxy);
|
||||
let proto = JS_GetPrototype(proxy);
|
||||
|
@ -437,8 +437,8 @@ pub fn GetPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid, found:
|
|||
*found = false;
|
||||
return true;
|
||||
}
|
||||
let hasProp = 0;
|
||||
if JS_HasPropertyById(cx, proto, id, &hasProp) == 0 {
|
||||
let mut hasProp = 0;
|
||||
if JS_HasPropertyById(cx, proto, id, &mut hasProp) == 0 {
|
||||
return false;
|
||||
}
|
||||
*found = hasProp != 0;
|
||||
|
@ -451,7 +451,7 @@ pub fn GetPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid, found:
|
|||
}
|
||||
}
|
||||
|
||||
pub fn GetArrayIndexFromId(_cx: *JSContext, id: jsid) -> Option<u32> {
|
||||
pub fn GetArrayIndexFromId(_cx: *mut JSContext, id: jsid) -> Option<u32> {
|
||||
unsafe {
|
||||
if RUST_JSID_IS_INT(id) != 0 {
|
||||
return Some(RUST_JSID_TO_INT(id) as u32);
|
||||
|
@ -474,7 +474,7 @@ pub fn GetArrayIndexFromId(_cx: *JSContext, id: jsid) -> Option<u32> {
|
|||
}*/
|
||||
}
|
||||
|
||||
fn InternJSString(cx: *JSContext, chars: *libc::c_char) -> Option<jsid> {
|
||||
fn InternJSString(cx: *mut JSContext, chars: *libc::c_char) -> Option<jsid> {
|
||||
unsafe {
|
||||
let s = JS_InternString(cx, chars);
|
||||
if s.is_not_null() {
|
||||
|
@ -485,7 +485,7 @@ fn InternJSString(cx: *JSContext, chars: *libc::c_char) -> Option<jsid> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn InitIds(cx: *JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bool {
|
||||
pub fn InitIds(cx: *mut JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bool {
|
||||
for (i, spec) in specs.iter().enumerate() {
|
||||
if spec.name.is_null() == true {
|
||||
return true;
|
||||
|
@ -500,7 +500,7 @@ pub fn InitIds(cx: *JSContext, specs: &[JSPropertySpec], ids: &mut [jsid]) -> bo
|
|||
true
|
||||
}
|
||||
|
||||
pub fn FindEnumStringIndex(cx: *JSContext,
|
||||
pub fn FindEnumStringIndex(cx: *mut JSContext,
|
||||
v: JSVal,
|
||||
values: &[&'static str]) -> Result<Option<uint>, ()> {
|
||||
unsafe {
|
||||
|
@ -509,8 +509,8 @@ pub fn FindEnumStringIndex(cx: *JSContext,
|
|||
return Err(());
|
||||
}
|
||||
|
||||
let length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, jsstr, &length);
|
||||
let mut length = 0;
|
||||
let chars = JS_GetStringCharsAndLength(cx, jsstr, &mut length);
|
||||
if chars.is_null() {
|
||||
return Err(());
|
||||
}
|
||||
|
@ -524,23 +524,23 @@ pub fn FindEnumStringIndex(cx: *JSContext,
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_dictionary_property(cx: *JSContext,
|
||||
object: *JSObject,
|
||||
pub fn get_dictionary_property(cx: *mut JSContext,
|
||||
object: *mut JSObject,
|
||||
property: &str) -> Result<Option<JSVal>, ()> {
|
||||
use std::c_str::CString;
|
||||
fn has_property(cx: *JSContext, object: *JSObject, property: &CString,
|
||||
fn has_property(cx: *mut JSContext, object: *mut JSObject, property: &CString,
|
||||
found: &mut JSBool) -> bool {
|
||||
unsafe {
|
||||
property.with_ref(|s| {
|
||||
JS_HasProperty(cx, object, s, found as *mut _ as *_) != 0
|
||||
JS_HasProperty(cx, object, s, found) != 0
|
||||
})
|
||||
}
|
||||
}
|
||||
fn get_property(cx: *JSContext, object: *JSObject, property: &CString,
|
||||
fn get_property(cx: *mut JSContext, object: *mut JSObject, property: &CString,
|
||||
value: &mut JSVal) -> bool {
|
||||
unsafe {
|
||||
property.with_ref(|s| {
|
||||
JS_GetProperty(cx, object, s, value as *mut _ as *_) != 0
|
||||
JS_GetProperty(cx, object, s, value) != 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -567,23 +567,23 @@ pub fn get_dictionary_property(cx: *JSContext,
|
|||
Ok(Some(value))
|
||||
}
|
||||
|
||||
pub fn HasPropertyOnPrototype(cx: *JSContext, proxy: *JSObject, id: jsid) -> bool {
|
||||
pub fn HasPropertyOnPrototype(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) -> bool {
|
||||
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
|
||||
let mut found = false;
|
||||
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::null()) || found;
|
||||
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::mut_null()) || found;
|
||||
}
|
||||
|
||||
pub fn IsConvertibleToCallbackInterface(cx: *JSContext, obj: *JSObject) -> bool {
|
||||
pub fn IsConvertibleToCallbackInterface(cx: *mut JSContext, obj: *mut JSObject) -> bool {
|
||||
unsafe {
|
||||
JS_ObjectIsDate(cx, obj) == 0 && JS_ObjectIsRegExp(cx, obj) == 0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
|
||||
pub fn CreateDOMGlobal(cx: *mut JSContext, class: *JSClass) -> *mut JSObject {
|
||||
unsafe {
|
||||
let obj = JS_NewGlobalObject(cx, class, ptr::null());
|
||||
let obj = JS_NewGlobalObject(cx, class, ptr::mut_null());
|
||||
if obj.is_null() {
|
||||
return ptr::null();
|
||||
return ptr::mut_null();
|
||||
}
|
||||
with_compartment(cx, obj, || {
|
||||
JS_InitStandardClasses(cx, obj);
|
||||
|
@ -593,9 +593,9 @@ pub fn CreateDOMGlobal(cx: *JSContext, class: *JSClass) -> *JSObject {
|
|||
}
|
||||
}
|
||||
|
||||
pub extern fn wrap_for_same_compartment(cx: *JSContext, obj: *JSObject) -> *JSObject {
|
||||
pub extern fn wrap_for_same_compartment(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObject {
|
||||
unsafe {
|
||||
JS_ObjectToOuterObject(cx as *mut _, obj as *mut _) as *_
|
||||
JS_ObjectToOuterObject(cx, obj)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,10 +606,10 @@ pub extern fn pre_wrap(cx: *mut JSContext, _scope: *mut JSObject,
|
|||
}
|
||||
}
|
||||
|
||||
pub extern fn outerize_global(_cx: *JSContext, obj: JSHandleObject) -> *JSObject {
|
||||
pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut JSObject {
|
||||
unsafe {
|
||||
debug!("outerizing");
|
||||
let obj = *obj.unnamed;
|
||||
let obj = *obj.unnamed_field1;
|
||||
let win: Root<window::Window> =
|
||||
unwrap_jsmanaged(obj,
|
||||
IDLInterface::get_prototype_id(None::<window::Window>),
|
||||
|
@ -621,17 +621,17 @@ pub extern fn outerize_global(_cx: *JSContext, obj: JSHandleObject) -> *JSObject
|
|||
}
|
||||
|
||||
/// Returns the global object of the realm that the given JS object was created in.
|
||||
pub fn global_object_for_js_object(obj: *JSObject) -> JS<window::Window> {
|
||||
pub fn global_object_for_js_object(obj: *mut JSObject) -> JS<window::Window> {
|
||||
unsafe {
|
||||
let global = GetGlobalForObjectCrossCompartment(obj);
|
||||
let clasp = JS_GetClass(global);
|
||||
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
|
||||
FromJSValConvertible::from_jsval(ptr::null(), ObjectOrNullValue(global), ())
|
||||
FromJSValConvertible::from_jsval(ptr::mut_null(), ObjectOrNullValue(global), ())
|
||||
.ok().expect("found DOM global that doesn't unwrap to Window")
|
||||
}
|
||||
}
|
||||
|
||||
fn cx_for_dom_reflector(obj: *JSObject) -> *JSContext {
|
||||
fn cx_for_dom_reflector(obj: *mut JSObject) -> *mut JSContext {
|
||||
let win = global_object_for_js_object(obj).root();
|
||||
let js_info = win.deref().page().js_info();
|
||||
match *js_info {
|
||||
|
@ -640,7 +640,7 @@ fn cx_for_dom_reflector(obj: *JSObject) -> *JSContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *JSContext {
|
||||
pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext {
|
||||
cx_for_dom_reflector(obj.reflector().get_jsobject())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue