Skip to content
Browse files

Make DOMJSClass use JSClass instead of Class (fixes #13031)

  • Loading branch information
tetsuharuohzeki authored and nox committed Aug 26, 2016
1 parent 3b11c5e commit 0277cf91745d00cd9afe7f121e0421ccb8702aaf
@@ -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,
@@ -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 |
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
reserved: [0 as *mut _; 3],
dom_class: %(domClass)s
};""" % args
@@ -2391,7 +2389,7 @@ def CreateBindingJSObject(descriptor, parent=None):
""" % (, parent)
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"
"JS_SetReservedSlot(obj.get(), DOM_OBJECT_SLOT,\n"
@@ -2530,7 +2528,7 @@ def definition_body(self):
rooted!(in(cx) let mut obj = ptr::null_mut());
&*(&Class.base as *const js::jsapi::Class as *const _),
raw as *const libc::c_void,
@@ -2842,7 +2840,7 @@ def defineAliasesFor(m):
holderClass = "ptr::null()"
holderProto = "HandleObject::null()"
holderClass = "&Class.base as *const js::jsapi::Class as *const JSClass"
holderClass = "&Class.base as *const JSClass"
holderProto = "prototype.handle()"
rooted!(in(cx) let mut unforgeable_holder = ptr::null_mut());
@@ -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)

@@ -5326,7 +5324,7 @@ def generate_imports(config, cgthings, descriptors, callbacks=None, dictionaries
'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}',
@@ -100,7 +100,7 @@ unsafe impl Sync for DOMClass {}
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,
@@ -18,11 +18,13 @@ use dom::window::Window;
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;
@@ -409,7 +411,7 @@ static PROXY_HANDLER: ProxyTraps = ProxyTraps {

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;
let _ = Box::from_raw(this);

Some generated files are not rendered by default. Learn more.

Some generated files are not rendered by default. Learn more.

0 comments on commit 0277cf9

Please sign in to comment.
You can’t perform that action at this time.