mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
[JAEGER] Merge from tracemonkey.
This commit is contained in:
commit
7b2310c5cf
@ -111,7 +111,7 @@ JetpackChild::Init(base::ProcessHandle aParentProcessHandle,
|
|||||||
JSAutoRequest request(mCx);
|
JSAutoRequest request(mCx);
|
||||||
JS_SetContextPrivate(mCx, this);
|
JS_SetContextPrivate(mCx, this);
|
||||||
JSObject* implGlobal =
|
JSObject* implGlobal =
|
||||||
JS_NewGlobalObject(mCx, const_cast<JSClass*>(&sGlobalClass));
|
JS_NewCompartmentAndGlobalObject(mCx, const_cast<JSClass*>(&sGlobalClass), NULL);
|
||||||
if (!implGlobal ||
|
if (!implGlobal ||
|
||||||
!JS_InitStandardClasses(mCx, implGlobal) ||
|
!JS_InitStandardClasses(mCx, implGlobal) ||
|
||||||
!JS_DefineFunctions(mCx, implGlobal,
|
!JS_DefineFunctions(mCx, implGlobal,
|
||||||
@ -396,10 +396,14 @@ JetpackChild::CreateSandbox(JSContext* cx, uintN argc, jsval* vp)
|
|||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSObject* obj = JS_NewGlobalObject(cx, const_cast<JSClass*>(&sGlobalClass));
|
JSObject* obj = JS_NewCompartmentAndGlobalObject(cx, const_cast<JSClass*>(&sGlobalClass), NULL);
|
||||||
if (!obj)
|
if (!obj)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
|
JSAutoCrossCompartmentCall ac;
|
||||||
|
if (!ac.enter(cx, obj))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
|
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
|
||||||
return JS_InitStandardClasses(cx, obj);
|
return JS_InitStandardClasses(cx, obj);
|
||||||
}
|
}
|
||||||
@ -427,6 +431,10 @@ JetpackChild::EvalInSandbox(JSContext* cx, uintN argc, jsval* vp)
|
|||||||
if (!str)
|
if (!str)
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
|
|
||||||
|
JSAutoCrossCompartmentCall ac;
|
||||||
|
if (!ac.enter(cx, obj))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
js::AutoValueRooter ignored(cx);
|
js::AutoValueRooter ignored(cx);
|
||||||
return JS_EvaluateUCScript(cx, obj, JS_GetStringChars(str), JS_GetStringLength(str), "", 1,
|
return JS_EvaluateUCScript(cx, obj, JS_GetStringChars(str), JS_GetStringLength(str), "", 1,
|
||||||
ignored.jsval_addr());
|
ignored.jsval_addr());
|
||||||
|
@ -285,6 +285,7 @@ protected:
|
|||||||
if (!global)
|
if (!global)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
JSAutoEnterCompartment enter(cx, global);
|
||||||
/* Populate the global object with the standard globals,
|
/* Populate the global object with the standard globals,
|
||||||
like Object and Array. */
|
like Object and Array. */
|
||||||
if (!JS_InitStandardClasses(cx, global))
|
if (!JS_InitStandardClasses(cx, global))
|
||||||
|
@ -1219,6 +1219,10 @@ mozJSComponentLoader::GlobalForLocation(nsILocalFile *aComponentFile,
|
|||||||
rv = holder->GetJSObject(&global);
|
rv = holder->GetJSObject(&global);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
JSAutoCrossCompartmentCall ac;
|
||||||
|
if (!ac.enter(cx, global))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (!JS_DefineFunctions(cx, global, gGlobalFun)) {
|
if (!JS_DefineFunctions(cx, global, gGlobalFun)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -810,9 +810,12 @@ int main()
|
|||||||
|
|
||||||
{
|
{
|
||||||
JSAutoRequest ar(jscontext);
|
JSAutoRequest ar(jscontext);
|
||||||
glob = JS_NewGlobalObject(jscontext, &global_class);
|
glob = JS_NewCompartmentAndGlobalObject(jscontext, &global_class, NULL);
|
||||||
if (!glob)
|
if (!glob)
|
||||||
DIE("FAILED to create global object");
|
DIE("FAILED to create global object");
|
||||||
|
|
||||||
|
JSAutoEnterCompartment autoCompartment(jscontext, glob);
|
||||||
|
|
||||||
if (!JS_InitStandardClasses(jscontext, glob))
|
if (!JS_InitStandardClasses(jscontext, glob))
|
||||||
DIE("FAILED to init standard classes");
|
DIE("FAILED to init standard classes");
|
||||||
if (!JS_DefineFunctions(jscontext, glob, glob_functions))
|
if (!JS_DefineFunctions(jscontext, glob, glob_functions))
|
||||||
|
Loading…
Reference in New Issue
Block a user