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
parent 34b729110d
commit bb83827034
4 changed files with 15 additions and 8 deletions

View File

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

View File

@ -1091,7 +1091,7 @@ XPCWrappedNative::Init(XPCCallContext& ccx,
// 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) {
// Resolving a global object's class can cause us to create a global's

View File

@ -814,7 +814,8 @@ XPC_WN_OuterObject(JSContext *cx, JSObject *obj)
return obj;
}
js::Class XPC_WN_NoHelper_JSClass = {
XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
{ // base
"XPCWrappedNative_NoHelper", // name;
WRAPPER_SLOTS |
JSCLASS_PRIVATE_IS_NSISUPPORTS, // flags
@ -885,6 +886,8 @@ js::Class XPC_WN_NoHelper_JSClass = {
XPC_WN_JSOp_ThisObject,
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)
{
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
// helper. Short circuit this call to the default
// implementation.

View File

@ -1351,7 +1351,8 @@ private:
// These are the various JSClasses and callbacks whose use that required
// 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_NoCall_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
// 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;
PRUint32 interfacesBitmap;
@ -2077,7 +2081,7 @@ public:
private:
XPCNativeScriptableFlags mFlags;
XPCNativeScriptableSharedJSClass mJSClass;
XPCWrappedNativeJSClass mJSClass;
JSBool mCanBeSlim;
};