Bug 787070 - Expandos on the xray of DOM prototypes should have effect on xrays of DOM nodes, make CreateInterfaceObjects take a js::Class instead of a JSClass. r=bz.

--HG--
extra : rebase_source : 8b37d59b5f43215c5acef9f8219e631024ece207
This commit is contained in:
Peter Van der Beken 2014-08-05 12:46:42 +02:00
Родитель 75c937d206
Коммит cbd064cb38
4 изменённых файлов: 18 добавлений и 13 удалений

Просмотреть файл

@ -426,7 +426,7 @@ DefineConstructor(JSContext* cx, JS::Handle<JSObject*> global, const char* name,
static JSObject*
CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> constructorProto,
const JSClass* constructorClass,
const js::Class* constructorClass,
const JSNativeHolder* constructorNative,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Handle<JSObject*> proto,
@ -437,7 +437,8 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Rooted<JSObject*> constructor(cx);
if (constructorClass) {
MOZ_ASSERT(constructorProto);
constructor = JS_NewObject(cx, constructorClass, constructorProto, global);
constructor = JS_NewObject(cx, Jsvalify(constructorClass), constructorProto,
global);
} else {
MOZ_ASSERT(constructorNative);
MOZ_ASSERT(constructorProto == JS_GetFunctionPrototype(cx, global));
@ -566,12 +567,12 @@ DefineWebIDLBindingPropertiesOnXPCObject(JSContext* cx,
static JSObject*
CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> parentProto,
const JSClass* protoClass,
const js::Class* protoClass,
const NativeProperties* properties,
const NativeProperties* chromeOnlyProperties)
{
JS::Rooted<JSObject*> ourProto(cx,
JS_NewObjectWithUniqueType(cx, protoClass, parentProto, global));
JS_NewObjectWithUniqueType(cx, Jsvalify(protoClass), parentProto, global));
if (!ourProto ||
!DefineProperties(cx, ourProto, properties, chromeOnlyProperties)) {
return nullptr;
@ -625,9 +626,9 @@ DefineProperties(JSContext* cx, JS::Handle<JSObject*> obj,
void
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> protoProto,
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
const js::Class* protoClass, JS::Heap<JSObject*>* protoCache,
JS::Handle<JSObject*> constructorProto,
const JSClass* constructorClass, const JSNativeHolder* constructor,
const js::Class* constructorClass, const JSNativeHolder* constructor,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Heap<JSObject*>* constructorCache,
const NativeProperties* properties,

Просмотреть файл

@ -599,9 +599,9 @@ struct NamedConstructor
void
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> protoProto,
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
const js::Class* protoClass, JS::Heap<JSObject*>* protoCache,
JS::Handle<JSObject*> interfaceProto,
const JSClass* constructorClass, const JSNativeHolder* constructor,
const js::Class* constructorClass, const JSNativeHolder* constructor,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Heap<JSObject*>* constructorCache,
const NativeProperties* regularProperties,

Просмотреть файл

@ -638,7 +638,9 @@ class CGPrototypeJSClass(CGThing):
nullptr, /* hasInstance */
nullptr, /* construct */
nullptr, /* trace */
JSCLASS_NO_INTERNAL_MEMBERS
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
JS_NULL_OBJECT_OPS
},
eInterfacePrototype,
${hooks},
@ -702,7 +704,9 @@ class CGInterfaceObjectJSClass(CGThing):
${hasInstance}, /* hasInstance */
${ctorname}, /* construct */
nullptr, /* trace */
JSCLASS_NO_INTERNAL_MEMBERS
JS_NULL_CLASS_SPEC,
JS_NULL_CLASS_EXT,
JS_NULL_OBJECT_OPS
},
eInterface,
${hooks},

Просмотреть файл

@ -219,11 +219,11 @@ struct DOMJSClass
// Special JSClass for DOM interface and interface prototype objects.
struct DOMIfaceAndProtoJSClass
{
// It would be nice to just inherit from JSClass, but that precludes pure
// It would be nice to just inherit from js::Class, but that precludes pure
// compile-time initialization of the form
// |DOMJSInterfaceAndPrototypeClass = {...};|, since C++ only allows brace
// initialization for aggregate/POD types.
const JSClass mBase;
const js::Class mBase;
// Either eInterface or eInterfacePrototype
DOMObjectType mType;
@ -245,7 +245,7 @@ struct DOMIfaceAndProtoJSClass
return FromJSClass(Jsvalify(base));
}
const JSClass* ToJSClass() const { return &mBase; }
const JSClass* ToJSClass() const { return Jsvalify(&mBase); }
};
class ProtoAndIfaceCache;