Bug 698389 - Give nsIScriptContext::CompileFunction a JSObject outparam; r=peterv

This commit is contained in:
Ms2ger 2011-11-26 11:08:42 +01:00
Родитель f05454b999
Коммит 3075bb4eba
5 изменённых файлов: 13 добавлений и 12 удалений

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

@ -239,13 +239,13 @@ nsXBLProtoImplMethod::CompileMember(nsIScriptContext* aContext, const nsCString&
nsresult rv = aContext->CompileFunction(aClassObject,
cname,
paramCount,
(const char**)args,
const_cast<const char**>(args),
body,
functionUri.get(),
uncompiledMethod->mBodyText.GetLineNumber(),
JSVERSION_LATEST,
true,
(void **) &methodObject);
&methodObject);
// Destroy our uncompiled method and delete our arg list.
delete uncompiledMethod;

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

@ -260,7 +260,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
mGetterText->GetLineNumber(),
JSVERSION_LATEST,
true,
(void **) &getterObject);
&getterObject);
// Make sure we free mGetterText here before setting mJSGetterObject, since
// that'll overwrite mGetterText
@ -310,7 +310,7 @@ nsXBLProtoImplProperty::CompileMember(nsIScriptContext* aContext, const nsCStrin
mSetterText->GetLineNumber(),
JSVERSION_LATEST,
true,
(void **) &setterObject);
&setterObject);
// Make sure we free mSetterText here before setting mJSGetterObject, since
// that'll overwrite mSetterText

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

@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \
{ 0x4289df58, 0x4f12, 0x4e16, \
{ 0x8c, 0x9a, 0x38, 0xd6, 0x30, 0xc4, 0x4d, 0xe6 } }
{ 0x67493f96, 0x304c, 0x4bd6, \
{ 0xac, 0xe7, 0xca, 0xeb, 0x85, 0xd1, 0x0b, 0x9d } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -266,7 +266,7 @@ public:
PRUint32 aLineNo,
PRUint32 aVersion,
bool aShared,
void **aFunctionObject) = 0;
JSObject** aFunctionObject) = 0;
/**
* Set the default scripting language version for this context, which must

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

@ -1793,11 +1793,14 @@ nsJSContext::CompileFunction(JSObject* aTarget,
PRUint32 aLineNo,
PRUint32 aVersion,
bool aShared,
void** aFunctionObject)
JSObject** aFunctionObject)
{
NS_TIME_FUNCTION_FMT(1.0, "%s (line %d) (function: %s, url: %s, line: %d)", MOZ_FUNCTION_NAME,
__LINE__, aName.BeginReading(), aURL, aLineNo);
NS_ABORT_IF_FALSE(aFunctionObject,
"Shouldn't call CompileFunction with null return value.");
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
// Don't compile if aVersion is unknown. Since the caller is responsible for
@ -1839,9 +1842,7 @@ nsJSContext::CompileFunction(JSObject* aTarget,
if (!fun)
return NS_ERROR_FAILURE;
JSObject *handler = ::JS_GetFunctionObject(fun);
if (aFunctionObject)
*aFunctionObject = (void*) handler;
*aFunctionObject = JS_GetFunctionObject(fun);
return NS_OK;
}

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

@ -124,7 +124,7 @@ public:
PRUint32 aLineNo,
PRUint32 aVersion,
bool aShared,
void** aFunctionObject);
JSObject** aFunctionObject);
virtual void SetDefaultLanguageVersion(PRUint32 aVersion);
virtual nsIScriptGlobalObject *GetGlobalObject();