mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1122335 - Fix static scope chain for Debugger.Frame.prototype.eval. (r=jimb)
This commit is contained in:
parent
a50f9e2df5
commit
7ce3b01635
@ -311,6 +311,8 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame
|
||||
if (evalType == DIRECT_EVAL)
|
||||
enclosing = callerScript->innermostStaticScope(pc);
|
||||
Rooted<StaticEvalObject *> staticScope(cx, StaticEvalObject::create(cx, enclosing));
|
||||
if (!staticScope)
|
||||
return false;
|
||||
|
||||
CompileOptions options(cx);
|
||||
options.setFileAndLine(filename, 1)
|
||||
|
12
js/src/jit-test/tests/debug/Frame-eval-28.js
Normal file
12
js/src/jit-test/tests/debug/Frame-eval-28.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Test that strict Debugger.Frame.eval has a correct static scope.
|
||||
options('strict_mode');
|
||||
var g = newGlobal();
|
||||
var dbg = new Debugger(g);
|
||||
var hits = 0;
|
||||
dbg.onEnterFrame = function(f) {
|
||||
hits++;
|
||||
if (hits > 2)
|
||||
return;
|
||||
f.eval("42");
|
||||
};
|
||||
g.eval("42");
|
@ -5941,10 +5941,15 @@ EvaluateInEnv(JSContext *cx, Handle<Env*> env, HandleValue thisv, AbstractFrameP
|
||||
* calls and properly compute a static level. In practice, any non-zero
|
||||
* static level will suffice.
|
||||
*
|
||||
* Pass in NullPtr for evalStaticScope, as ScopeIter should stop at any
|
||||
* non-ScopeObject boundaries, and we are putting a DebugScopeProxy on the
|
||||
* scope chain.
|
||||
* Pass in a StaticEvalObject *not* linked to env for evalStaticScope, as
|
||||
* ScopeIter should stop at any non-ScopeObject boundaries, and we are
|
||||
* putting a DebugScopeProxy on the scope chain.
|
||||
*/
|
||||
Rooted<StaticEvalObject *> staticScope(cx, StaticEvalObject::create(cx, js::NullPtr()));
|
||||
if (!staticScope)
|
||||
return false;
|
||||
if (frame && frame.script()->strict())
|
||||
staticScope->setStrict();
|
||||
CompileOptions options(cx);
|
||||
options.setCompileAndGo(true)
|
||||
.setForEval(true)
|
||||
@ -5956,8 +5961,8 @@ EvaluateInEnv(JSContext *cx, Handle<Env*> env, HandleValue thisv, AbstractFrameP
|
||||
RootedScript callerScript(cx, frame ? frame.script() : nullptr);
|
||||
SourceBufferHolder srcBuf(chars.start().get(), chars.length(), SourceBufferHolder::NoOwnership);
|
||||
RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(), env, callerScript,
|
||||
/* evalStaticScope = */ js::NullPtr(),
|
||||
options, srcBuf, /* source = */ nullptr,
|
||||
staticScope, options, srcBuf,
|
||||
/* source = */ nullptr,
|
||||
/* staticLevel = */ frame ? 1 : 0));
|
||||
if (!script)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user