mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 694781 - Make nsIScriptContext::ExecuteScript's second parameter a JSObject; r=volkmar
This commit is contained in:
parent
c4446bc22d
commit
44bd9f9103
@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
|
||||
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ 0x09871507, 0xe833, 0x4a13, \
|
||||
{ 0x95, 0x36, 0x92, 0x2b, 0xb5, 0xe4, 0xca, 0x14 } }
|
||||
{ 0x5f2acd05, 0xbbe4, 0x4f00, \
|
||||
{ 0x91, 0xf8, 0xca, 0xc6, 0xdb, 0xf3, 0x1b, 0xb4 } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
@ -173,7 +173,7 @@ public:
|
||||
*
|
||||
*/
|
||||
virtual nsresult ExecuteScript(void* aScriptObject,
|
||||
void* aScopeObject,
|
||||
JSObject* aScopeObject,
|
||||
nsAString* aRetValue,
|
||||
bool* aIsUndefined) = 0;
|
||||
|
||||
|
@ -1602,7 +1602,7 @@ nsJSContext::CompileScript(const PRUnichar* aText,
|
||||
|
||||
nsresult
|
||||
nsJSContext::ExecuteScript(void *aScriptObject,
|
||||
void *aScopeObject,
|
||||
JSObject* aScopeObject,
|
||||
nsAString* aRetValue,
|
||||
bool* aIsUndefined)
|
||||
{
|
||||
@ -1620,28 +1620,21 @@ nsJSContext::ExecuteScript(void *aScriptObject,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (!aScopeObject)
|
||||
aScopeObject = ::JS_GetGlobalObject(mContext);
|
||||
if (!aScopeObject) {
|
||||
aScopeObject = JS_GetGlobalObject(mContext);
|
||||
}
|
||||
|
||||
// Push our JSContext on our thread's context stack, in case native code
|
||||
// called from JS calls back into JS via XPConnect.
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIJSContextStack> stack =
|
||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
|
||||
if (NS_FAILED(rv) || NS_FAILED(stack->Push(mContext))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// The result of evaluation, used only if there were no errors. This need
|
||||
// not be a GC root currently, provided we run the GC only from the
|
||||
// operation callback or from ScriptEvaluated.
|
||||
jsval val;
|
||||
JSBool ok;
|
||||
|
||||
JSScript *script = static_cast<JSScript *>(aScriptObject);
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
|
||||
rv = sSecurityManager->GetObjectPrincipal(mContext,
|
||||
JS_GetGlobalFromScript(script),
|
||||
getter_AddRefs(principal));
|
||||
@ -1653,8 +1646,12 @@ nsJSContext::ExecuteScript(void *aScriptObject,
|
||||
nsJSContext::TerminationFuncHolder holder(this);
|
||||
JSAutoRequest ar(mContext);
|
||||
++mExecuteDepth;
|
||||
ok = ::JS_ExecuteScript(mContext, (JSObject *)aScopeObject, script, &val);
|
||||
|
||||
// The result of evaluation, used only if there were no errors. This need
|
||||
// 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);
|
||||
if (ok) {
|
||||
// If all went well, convert val to a string (XXXbe unless undefined?).
|
||||
rv = JSValueToAString(mContext, val, aRetValue, aIsUndefined);
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
PRUint32 aVersion,
|
||||
nsScriptObjectHolder &aScriptObject);
|
||||
virtual nsresult ExecuteScript(void* aScriptObject,
|
||||
void *aScopeObject,
|
||||
JSObject* aScopeObject,
|
||||
nsAString* aRetValue,
|
||||
bool* aIsUndefined);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user