Bug 714590 - Use the helper jsclass format everywhere. r=mrbkap

This commit is contained in:
Bobby Holley 2012-02-16 12:22:16 -08:00
Родитель 34b729110d
Коммит bb83827034
4 изменённых файлов: 15 добавлений и 8 удалений

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

@ -539,8 +539,8 @@ castNativeFromWrapper(JSContext *cx,
NS_ASSERTION(IS_WRAPPER_CLASS(js::GetObjectClass(cur)), "Not a wrapper?"); NS_ASSERTION(IS_WRAPPER_CLASS(js::GetObjectClass(cur)), "Not a wrapper?");
XPCNativeScriptableSharedJSClass *clasp = XPCWrappedNativeJSClass *clasp =
(XPCNativeScriptableSharedJSClass*)js::GetObjectClass(cur); (XPCWrappedNativeJSClass*)js::GetObjectClass(cur);
if (!(clasp->interfacesBitmap & (1 << interfaceBit))) if (!(clasp->interfacesBitmap & (1 << interfaceBit)))
return nsnull; return nsnull;

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

@ -1091,7 +1091,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
// create our flatJSObject // create our flatJSObject
JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass); JSClass* jsclazz = si ? si->GetJSClass() : Jsvalify(&XPC_WN_NoHelper_JSClass.base);
if (isGlobal) { if (isGlobal) {
// Resolving a global object's class can cause us to create a global's // Resolving a global object's class can cause us to create a global's

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

@ -814,7 +814,8 @@ XPC_WN_OuterObject(JSContext *cx, JSObject *obj)
return obj; return obj;
} }
js::Class XPC_WN_NoHelper_JSClass = { XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
{ // base
"XPCWrappedNative_NoHelper", // name; "XPCWrappedNative_NoHelper", // name;
WRAPPER_SLOTS | WRAPPER_SLOTS |
JSCLASS_PRIVATE_IS_NSISUPPORTS, // flags JSCLASS_PRIVATE_IS_NSISUPPORTS, // flags
@ -885,6 +886,8 @@ js::Class XPC_WN_NoHelper_JSClass = {
XPC_WN_JSOp_ThisObject, XPC_WN_JSOp_ThisObject,
XPC_WN_JSOp_Clear XPC_WN_JSOp_Clear
} }
},
0 // interfacesBitmap
}; };
@ -1204,7 +1207,7 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op,
jsval *statep, jsid *idp) jsval *statep, jsid *idp)
{ {
js::Class *clazz = js::GetObjectClass(obj); js::Class *clazz = js::GetObjectClass(obj);
if (!IS_WRAPPER_CLASS(clazz) || clazz == &XPC_WN_NoHelper_JSClass) { if (!IS_WRAPPER_CLASS(clazz) || clazz == &XPC_WN_NoHelper_JSClass.base) {
// obj must be a prototype object or a wrapper w/o a // obj must be a prototype object or a wrapper w/o a
// helper. Short circuit this call to the default // helper. Short circuit this call to the default
// implementation. // implementation.

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

@ -1351,7 +1351,8 @@ private:
// These are the various JSClasses and callbacks whose use that required // These are the various JSClasses and callbacks whose use that required
// visibility from more than one .cpp file. // visibility from more than one .cpp file.
extern js::Class XPC_WN_NoHelper_JSClass; struct XPCWrappedNativeJSClass;
extern XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass;
extern js::Class XPC_WN_NoMods_WithCall_Proto_JSClass; extern js::Class XPC_WN_NoMods_WithCall_Proto_JSClass;
extern js::Class XPC_WN_NoMods_NoCall_Proto_JSClass; extern js::Class XPC_WN_NoMods_NoCall_Proto_JSClass;
extern js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass; extern js::Class XPC_WN_ModsAllowed_WithCall_Proto_JSClass;
@ -2035,7 +2036,10 @@ public:
// was a big problem when wrappers are reparented to different scopes (and // was a big problem when wrappers are reparented to different scopes (and
// thus different protos (the DOM does this). // thus different protos (the DOM does this).
struct XPCNativeScriptableSharedJSClass // We maintain the invariant that every JSClass for which ext.isWrappedNative
// is true is a contained in an instance of this struct, and can thus be cast
// to it.
struct XPCWrappedNativeJSClass
{ {
js::Class base; js::Class base;
PRUint32 interfacesBitmap; PRUint32 interfacesBitmap;
@ -2077,7 +2081,7 @@ public:
private: private:
XPCNativeScriptableFlags mFlags; XPCNativeScriptableFlags mFlags;
XPCNativeScriptableSharedJSClass mJSClass; XPCWrappedNativeJSClass mJSClass;
JSBool mCanBeSlim; JSBool mCanBeSlim;
}; };