blob: a9d97dfacc21eda15a97adb9f9eeb0cb89d806f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
// setVariable triggering a setter throws WouldRunDebuggee.
load(libdir + "asserts.js");
function test(code) {
var g = newGlobal({newCompartment: true});
g.eval("function d() { debugger; }");
var dbg = Debugger(g);
var hits = 0;
dbg.onDebuggerStatement = function (frame) {
var env = frame.older.environment.find("x");
assertThrowsInstanceOf(
() => env.setVariable("x", 0),
Debugger.DebuggeeWouldRun);
hits++;
};
g.eval(code);
assertEq(hits, 1);
}
test("Object.defineProperty(this, 'x', {set: function (v) {}}); d();");
test("Object.defineProperty(Object.prototype, 'x', {set: function (v) {}}); d();");
test("with ({set x(v) {}}) eval(d());");
|