Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | // Debugger.prototype.onDebuggerStatement |
michael@0 | 2 | |
michael@0 | 3 | load(libdir + 'asserts.js'); |
michael@0 | 4 | |
michael@0 | 5 | var g = newGlobal(); |
michael@0 | 6 | var dbg = new Debugger(g); |
michael@0 | 7 | gc(); // don't assert marking debug hooks |
michael@0 | 8 | assertEq(dbg.onDebuggerStatement, undefined); |
michael@0 | 9 | |
michael@0 | 10 | function f() {} |
michael@0 | 11 | |
michael@0 | 12 | assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = null; }, TypeError); |
michael@0 | 13 | assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = "bad"; }, TypeError); |
michael@0 | 14 | assertThrowsInstanceOf(function () { dbg.onDebuggerStatement = {}; }, TypeError); |
michael@0 | 15 | dbg.onDebuggerStatement = f; |
michael@0 | 16 | assertEq(dbg.onDebuggerStatement, f); |
michael@0 | 17 | |
michael@0 | 18 | assertEq(Object.getOwnPropertyNames(dbg).length, 0); |
michael@0 | 19 | var desc = Object.getOwnPropertyDescriptor(Debugger.prototype, "onDebuggerStatement"); |
michael@0 | 20 | assertEq(desc.configurable, true); |
michael@0 | 21 | assertEq(desc.enumerable, false); |
michael@0 | 22 | |
michael@0 | 23 | assertThrowsInstanceOf(function () { desc.get(); }, TypeError); |
michael@0 | 24 | assertThrowsInstanceOf(function () { desc.get.call(undefined); }, TypeError); |
michael@0 | 25 | assertThrowsInstanceOf(function () { desc.get.call(Debugger.prototype); }, TypeError); |
michael@0 | 26 | assertEq(desc.get.call(dbg), f); |
michael@0 | 27 | |
michael@0 | 28 | assertThrowsInstanceOf(function () { desc.set(); }, TypeError); |
michael@0 | 29 | assertThrowsInstanceOf(function () { desc.set.call(dbg); }, TypeError); |
michael@0 | 30 | assertThrowsInstanceOf(function () { desc.set.call({}, f); }, TypeError); |
michael@0 | 31 | assertThrowsInstanceOf(function () { desc.set.call(Debugger.prototype, f); }, TypeError); |