Bug 720580 - Make the call to PostCreatePrototype optional. r=mrbkap

This commit is contained in:
Bobby Holley 2012-03-05 15:22:44 -08:00
parent ea2172967e
commit 8fbe582aea
2 changed files with 11 additions and 6 deletions

View File

@ -89,7 +89,8 @@ XPCWrappedNativeProto::~XPCWrappedNativeProto()
JSBool
XPCWrappedNativeProto::Init(XPCCallContext& ccx,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo)
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
bool callPostCreatePrototype)
{
nsIXPCScriptable *callback = scriptableCreateInfo ?
scriptableCreateInfo->GetCallback() :
@ -130,7 +131,8 @@ XPCWrappedNativeProto::Init(XPCCallContext& ccx,
bool success = !!mJSProtoObject;
if (success) {
JS_SetPrivate(mJSProtoObject, this);
success = CallPostCreatePrototype(ccx);
if (callPostCreatePrototype)
success = CallPostCreatePrototype(ccx);
}
DEBUG_ReportShadowedMembers(mSet, nsnull, this);
@ -207,7 +209,8 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,
XPCWrappedNativeScope* scope,
nsIClassInfo* classInfo,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
QITableEntry* offsets)
QITableEntry* offsets,
bool callPostCreatePrototype)
{
NS_ASSERTION(scope, "bad param");
NS_ASSERTION(classInfo, "bad param");
@ -237,7 +240,7 @@ XPCWrappedNativeProto::GetNewOrUsed(XPCCallContext& ccx,
proto = new XPCWrappedNativeProto(scope, classInfo, ciFlags, set, offsets);
if (!proto || !proto->Init(ccx, scriptableCreateInfo)) {
if (!proto || !proto->Init(ccx, scriptableCreateInfo, callPostCreatePrototype)) {
delete proto.get();
return nsnull;
}

View File

@ -2204,7 +2204,8 @@ public:
XPCWrappedNativeScope* scope,
nsIClassInfo* classInfo,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
QITableEntry* offsets = UNKNOWN_OFFSETS);
QITableEntry* offsets = UNKNOWN_OFFSETS,
bool callPostCreatePrototype = true);
XPCWrappedNativeScope*
GetScope() const {return mScope;}
@ -2333,7 +2334,8 @@ protected:
QITableEntry* offsets);
JSBool Init(XPCCallContext& ccx,
const XPCNativeScriptableCreateInfo* scriptableCreateInfo);
const XPCNativeScriptableCreateInfo* scriptableCreateInfo,
bool callPostCreatePrototype);
private:
#if defined(DEBUG_xpc_hacker) || defined(DEBUG)