mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 863084 - Fix JS shell evaluate function to use the right Zone for its return value. r=billm
This commit is contained in:
parent
64a3173899
commit
d92592f418
17
js/src/jit-test/tests/basic/bug863084.js
Normal file
17
js/src/jit-test/tests/basic/bug863084.js
Normal file
@ -0,0 +1,17 @@
|
||||
// |jit-test| error: too much recursion
|
||||
function f(code) {
|
||||
try {
|
||||
eval(code)
|
||||
} catch (e) {}
|
||||
eval(code)
|
||||
}
|
||||
f("\
|
||||
z=evalcx('');\
|
||||
gc();\
|
||||
z.toString=(function(){\
|
||||
v=evaluate(\"(Math.atan2(\\\"\\\",this))\",{\
|
||||
global:z,newContext:7,catchTermination:this\
|
||||
});\
|
||||
});\
|
||||
String(z)\
|
||||
")
|
@ -912,6 +912,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp)
|
||||
unsigned lineNumber = 1;
|
||||
RootedObject global(cx, NULL);
|
||||
bool catchTermination = false;
|
||||
RootedObject callerGlobal(cx, cx->global());
|
||||
|
||||
global = JS_GetGlobalForObject(cx, &args.callee());
|
||||
if (!global)
|
||||
@ -1043,6 +1044,7 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp)
|
||||
}
|
||||
if (!JS_ExecuteScript(cx, global, script, vp)) {
|
||||
if (catchTermination && !JS_IsExceptionPending(cx)) {
|
||||
JSAutoCompartment ac1(cx, callerGlobal);
|
||||
JSString *str = JS_NewStringCopyZ(cx, "terminated");
|
||||
if (!str)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user