зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1385843 - Handle nested eval-in-frame better in ThrowUninitializedThis. r=tcampbell
This commit is contained in:
Родитель
3bb67d4f17
Коммит
bca78a439b
|
@ -0,0 +1,22 @@
|
|||
var g = newGlobal();
|
||||
g.parent = this;
|
||||
g.count = 0;
|
||||
g.eval("(" + function() {
|
||||
var dbg = new Debugger(parent);
|
||||
dbg.onEnterFrame = function(frame) {
|
||||
if (count === 5)
|
||||
dbg.onEnterFrame = undefined;
|
||||
count++;
|
||||
var ex = frame.eval("this").throw.unsafeDereference();
|
||||
assertEq(ex.message.includes("uninitialized"), true);
|
||||
assertEq(ex.message.includes("Foo2"), true);
|
||||
}
|
||||
} + ")()");
|
||||
class Foo1 {};
|
||||
class Foo2 extends Foo1 {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
};
|
||||
new Foo2();
|
||||
assertEq(g.count, 6);
|
|
@ -5192,6 +5192,8 @@ js::ThrowUninitializedThis(JSContext* cx, AbstractFramePtr frame)
|
|||
Scope* startingScope;
|
||||
if (frame.isDebuggerEvalFrame()) {
|
||||
AbstractFramePtr evalInFramePrev = frame.asInterpreterFrame()->evalInFramePrev();
|
||||
while (evalInFramePrev.isDebuggerEvalFrame())
|
||||
evalInFramePrev = evalInFramePrev.asInterpreterFrame()->evalInFramePrev();
|
||||
startingScope = evalInFramePrev.script()->bodyScope();
|
||||
} else {
|
||||
MOZ_ASSERT(frame.isEvalFrame());
|
||||
|
|
Загрузка…
Ссылка в новой задаче