Bug 694867 - Part f: Pass a JSScript to nsIScriptContext::ExecuteScript; r=volkmar

This commit is contained in:
Ms2ger 2011-10-29 22:15:43 +02:00
Родитель 68ad7e544d
Коммит 7834af665f
3 изменённых файлов: 7 добавлений и 8 удалений

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

@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \
{ 0x8bfc08bb, 0x0127, 0x46d5, \
{ 0x95, 0xfc, 0xca, 0x25, 0xa0, 0x62, 0xc9, 0x9a } }
{ 0xddc9b75f, 0xa230, 0x4966, \
{ 0xa6, 0xe0, 0x67, 0x5a, 0xba, 0xc9, 0x08, 0x8c } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -172,7 +172,7 @@ public:
* @return NS_OK if the script was valid and got executed
*
*/
virtual nsresult ExecuteScript(void* aScriptObject,
virtual nsresult ExecuteScript(JSScript* aScriptObject,
JSObject* aScopeObject,
nsAString* aRetValue,
bool* aIsUndefined) = 0;

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

@ -1596,7 +1596,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
}
nsresult
nsJSContext::ExecuteScript(void *aScriptObject,
nsJSContext::ExecuteScript(JSScript* aScriptObject,
JSObject* aScopeObject,
nsAString* aRetValue,
bool* aIsUndefined)
@ -1628,10 +1628,9 @@ nsJSContext::ExecuteScript(void *aScriptObject,
return NS_ERROR_FAILURE;
}
JSScript *script = static_cast<JSScript *>(aScriptObject);
nsCOMPtr<nsIPrincipal> principal;
rv = sSecurityManager->GetObjectPrincipal(mContext,
JS_GetGlobalFromScript(script),
JS_GetGlobalFromScript(aScriptObject),
getter_AddRefs(principal));
NS_ENSURE_SUCCESS(rv, rv);
@ -1646,7 +1645,7 @@ nsJSContext::ExecuteScript(void *aScriptObject,
// not be a GC root currently, provided we run the GC only from the
// operation callback or from ScriptEvaluated.
jsval val;
bool ok = JS_ExecuteScript(mContext, aScopeObject, script, &val);
bool ok = JS_ExecuteScript(mContext, aScopeObject, aScriptObject, &val);
if (ok) {
// If all went well, convert val to a string (XXXbe unless undefined?).
rv = JSValueToAString(mContext, val, aRetValue, aIsUndefined);

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

@ -97,7 +97,7 @@ public:
PRUint32 aLineNo,
PRUint32 aVersion,
nsScriptObjectHolder &aScriptObject);
virtual nsresult ExecuteScript(void* aScriptObject,
virtual nsresult ExecuteScript(JSScript* aScriptObject,
JSObject* aScopeObject,
nsAString* aRetValue,
bool* aIsUndefined);