mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 895774 - Fix ScriptFrameIter::computeThis with multiple compartments and contexts; r=jandem
This commit is contained in:
parent
a86cc4ab9a
commit
4d1fc444fa
14
js/src/jit-test/tests/basic/testBug895774.js
Normal file
14
js/src/jit-test/tests/basic/testBug895774.js
Normal file
@ -0,0 +1,14 @@
|
||||
var g1 = newGlobal();
|
||||
var g2 = newGlobal();
|
||||
g1.eval("function f1() { debugger; evaluate('debugger', {newContext:true}) }");
|
||||
g2.eval("function f2() { f1(); assertEq(Number(this), 42) }");
|
||||
g2.f1 = g1.f1;
|
||||
|
||||
var dbg = new Debugger(g1,g2);
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
var target = frame.older;
|
||||
dbg.onDebuggerStatement = function(frame) {
|
||||
assertEq(Number(target.this.unsafeDereference()), 42);
|
||||
}
|
||||
}
|
||||
g2.f2.call(42);
|
@ -1061,7 +1061,7 @@ FormatFrame(JSContext *cx, const NonBuiltinScriptFrameIter &iter, char *buf, int
|
||||
|
||||
RootedValue thisVal(cx);
|
||||
AutoPropertyDescArray thisProps(cx);
|
||||
if (iter.computeThis()) {
|
||||
if (iter.computeThis(cx)) {
|
||||
thisVal = iter.thisv();
|
||||
if (showThisProps && !thisVal.isPrimitive())
|
||||
thisProps.fetch(&thisVal.toObject());
|
||||
|
@ -3820,7 +3820,7 @@ DebuggerFrame_getThis(JSContext *cx, unsigned argc, Value *vp)
|
||||
RootedValue thisv(cx);
|
||||
{
|
||||
AutoCompartment ac(cx, iter.scopeChain());
|
||||
if (!iter.computeThis())
|
||||
if (!iter.computeThis(cx))
|
||||
return false;
|
||||
thisv = iter.thisv();
|
||||
}
|
||||
@ -4220,7 +4220,7 @@ DebuggerGenericEval(JSContext *cx, const char *fullMethodName, const Value &code
|
||||
Rooted<Env *> env(cx);
|
||||
if (iter) {
|
||||
/* ExecuteInEnv requires 'fp' to have a computed 'this" value. */
|
||||
if (!iter->computeThis())
|
||||
if (!iter->computeThis(cx))
|
||||
return false;
|
||||
thisv = iter->thisv();
|
||||
env = GetDebugScopeForFrame(cx, iter->abstractFramePtr());
|
||||
|
@ -1099,12 +1099,12 @@ ScriptFrameIter::argsObj() const
|
||||
}
|
||||
|
||||
bool
|
||||
ScriptFrameIter::computeThis() const
|
||||
ScriptFrameIter::computeThis(JSContext *cx) const
|
||||
{
|
||||
JS_ASSERT(!done());
|
||||
if (!isIon()) {
|
||||
JS_ASSERT(data_.cx_);
|
||||
return ComputeThis(data_.cx_, abstractFramePtr());
|
||||
assertSameCompartment(cx, scopeChain());
|
||||
return ComputeThis(cx, abstractFramePtr());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1519,7 +1519,7 @@ class ScriptFrameIter
|
||||
ArgumentsObject &argsObj() const;
|
||||
|
||||
// Ensure that thisv is correct, see ComputeThis.
|
||||
bool computeThis() const;
|
||||
bool computeThis(JSContext *cx) const;
|
||||
Value thisv() const;
|
||||
|
||||
Value returnValue() const;
|
||||
|
Loading…
Reference in New Issue
Block a user