зеркало из https://github.com/mozilla/gecko-dev.git
Bug 791157: Make sure the shell's 'evaluate' function properly restores the JSContext options. r=jorendorff
This commit is contained in:
Родитель
395fc4a655
Коммит
759463be71
|
@ -0,0 +1,11 @@
|
|||
// Bug 791157: the shell 'evaluate' function should properly restore the
|
||||
// context's options.
|
||||
|
||||
try {
|
||||
evaluate('%', {noScriptRval: true});
|
||||
} catch(e) {}
|
||||
new Function("");
|
||||
|
||||
try {
|
||||
evaluate('new Function("");', {noScriptRval: true});
|
||||
} catch (e) {}
|
|
@ -902,16 +902,17 @@ Evaluate(JSContext *cx, unsigned argc, jsval *vp)
|
|||
options |= JSOPTION_COMPILE_N_GO;
|
||||
if (noScriptRval)
|
||||
options |= JSOPTION_NO_SCRIPT_RVAL;
|
||||
JS_SetOptions(cx, options);
|
||||
|
||||
JS_SetOptions(cx, options);
|
||||
JSScript *script = JS_CompileUCScript(cx, global, codeChars, codeLength, fileName, lineNumber);
|
||||
JS_SetOptions(cx, saved);
|
||||
if (!script)
|
||||
return false;
|
||||
|
||||
if (sourceMapURL && !script->scriptSource()->hasSourceMap()) {
|
||||
if (!script->scriptSource()->setSourceMap(cx, sourceMapURL, script->filename))
|
||||
return false;
|
||||
}
|
||||
JS_SetOptions(cx, saved);
|
||||
if (!JS_ExecuteScript(cx, global, script, vp))
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче