Skip to content

Commit

Permalink
Make DOMJSClass use JSClass instead of Class (fixes #13031)
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuharuohzeki authored and nox committed Aug 26, 2016
1 parent 3b11c5e commit 0277cf9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
18 changes: 8 additions & 10 deletions components/script/dom/bindings/codegen/CodegenRust.py
Expand Up @@ -1995,7 +1995,7 @@ def define(self):
elif self.descriptor.weakReferenceable:
args["slots"] = "2"
return """\
static CLASS_OPS: js::jsapi::ClassOps = js::jsapi::ClassOps {
static CLASS_OPS: js::jsapi::JSClassOps = js::jsapi::JSClassOps {
addProperty: None,
delProperty: None,
getProperty: None,
Expand All @@ -2011,15 +2011,13 @@ def define(self):
};
static Class: DOMJSClass = DOMJSClass {
base: js::jsapi::Class {
base: js::jsapi::JSClass {
name: %(name)s as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | %(flags)s |
(((%(slots)s) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
/* JSCLASS_HAS_RESERVED_SLOTS(%(slots)s) */,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
reserved: [0 as *mut _; 3],
},
dom_class: %(domClass)s
};""" % args
Expand Down Expand Up @@ -2391,7 +2389,7 @@ def CreateBindingJSObject(descriptor, parent=None):
""" % (descriptor.name, parent)
else:
create += ("rooted!(in(cx) let obj = JS_NewObjectWithGivenProto(\n"
" cx, &Class.base as *const js::jsapi::Class as *const JSClass, proto.handle()));\n"
" cx, &Class.base as *const JSClass, proto.handle()));\n"
"assert!(!obj.is_null());\n"
"\n"
"JS_SetReservedSlot(obj.get(), DOM_OBJECT_SLOT,\n"
Expand Down Expand Up @@ -2530,7 +2528,7 @@ def definition_body(self):
rooted!(in(cx) let mut obj = ptr::null_mut());
create_global_object(
cx,
&*(&Class.base as *const js::jsapi::Class as *const _),
&Class.base,
raw as *const libc::c_void,
_trace,
obj.handle_mut());
Expand Down Expand Up @@ -2842,7 +2840,7 @@ def defineAliasesFor(m):
holderClass = "ptr::null()"
holderProto = "HandleObject::null()"
else:
holderClass = "&Class.base as *const js::jsapi::Class as *const JSClass"
holderClass = "&Class.base as *const JSClass"
holderProto = "prototype.handle()"
code.append(CGGeneric("""
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
Expand Down Expand Up @@ -5205,7 +5203,7 @@ class CGClassFinalizeHook(CGAbstractClassHook):
A hook for finalize, used to release our native object.
"""
def __init__(self, descriptor):
args = [Argument('*mut FreeOp', '_fop'), Argument('*mut JSObject', 'obj')]
args = [Argument('*mut JSFreeOp', '_fop'), Argument('*mut JSObject', 'obj')]
CGAbstractClassHook.__init__(self, descriptor, FINALIZE_HOOK_NAME,
'void', args)

Expand Down Expand Up @@ -5326,7 +5324,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'js::{JS_CALLEE, JSCLASS_GLOBAL_SLOT_COUNT}',
'js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL, JSCLASS_RESERVED_SLOTS_MASK}',
'js::error::throw_type_error',
'js::jsapi::{AutoIdVector, Call, CallArgs, FreeOp, GetPropertyKeys}',
'js::jsapi::{AutoIdVector, Call, CallArgs, GetPropertyKeys}',
'js::jsapi::{GetWellKnownSymbol, Handle, HandleId, HandleObject, HandleValue}',
'js::jsapi::{HandleValueArray, INTERNED_STRING_TO_JSID, IsCallable}',
'js::jsapi::{JS_AtomizeAndPinString, JS_CallFunctionValue, JS_CopyPropertiesFrom}',
Expand Down
2 changes: 1 addition & 1 deletion components/script/dom/bindings/utils.rs
Expand Up @@ -100,7 +100,7 @@ unsafe impl Sync for DOMClass {}
#[derive(Copy)]
pub struct DOMJSClass {
/// The actual JSClass.
pub base: js::jsapi::Class,
pub base: js::jsapi::JSClass,
/// Associated data for DOM object reflectors.
pub dom_class: DOMClass,
}
Expand Down
14 changes: 8 additions & 6 deletions components/script/dom/browsingcontext.rs
Expand Up @@ -18,11 +18,13 @@ use dom::window::Window;
use js::JSCLASS_IS_GLOBAL;
use js::glue::{CreateWrapperProxyHandler, ProxyTraps, NewWindowProxy};
use js::glue::{GetProxyPrivate, SetProxyExtra, GetProxyExtra};
use js::jsapi::{Handle, HandleId, HandleObject, HandleValue, JSAutoCompartment};
use js::jsapi::{JSContext, JSPROP_READONLY, JSErrNum, JSObject, PropertyDescriptor, JS_DefinePropertyById};
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass, JSTracer, FreeOp};
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById, MutableHandle};
use js::jsapi::{MutableHandleObject, MutableHandleValue, ObjectOpResult};
use js::jsapi::{Handle, HandleId, HandleObject, HandleValue};
use js::jsapi::{JSAutoCompartment, JSContext, JSErrNum, JSFreeOp, JSObject};
use js::jsapi::{JSPROP_READONLY, JSTracer, JS_DefinePropertyById};
use js::jsapi::{JS_ForwardGetPropertyTo, JS_ForwardSetPropertyTo, JS_GetClass};
use js::jsapi::{JS_GetOwnPropertyDescriptorById, JS_HasPropertyById};
use js::jsapi::{MutableHandle, MutableHandleObject, MutableHandleValue};
use js::jsapi::{ObjectOpResult, PropertyDescriptor};
use js::jsval::{UndefinedValue, PrivateValue};
use msg::constellation_msg::{PipelineId, SubpageId};
use std::cell::Cell;
Expand Down Expand Up @@ -409,7 +411,7 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {
};

#[allow(unsafe_code)]
unsafe extern fn finalize(_fop: *mut FreeOp, obj: *mut JSObject) {
unsafe extern fn finalize(_fop: *mut JSFreeOp, obj: *mut JSObject) {
let this = GetProxyExtra(obj, 0).to_private() as *mut BrowsingContext;
assert!(!this.is_null());
let _ = Box::from_raw(this);
Expand Down
2 changes: 1 addition & 1 deletion components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0277cf9

Please sign in to comment.