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 | // onPop surfaces. |
michael@0 | 2 | load(libdir + "asserts.js"); |
michael@0 | 3 | |
michael@0 | 4 | var g = newGlobal(); |
michael@0 | 5 | var dbg = new Debugger(g); |
michael@0 | 6 | |
michael@0 | 7 | // Assigning a bogus value to Debugger.Frame.prototype.onPop raises a TypeError. |
michael@0 | 8 | function test(badValue) { |
michael@0 | 9 | print("store " + uneval(badValue) + " in Debugger.Frame.prototype.onPop"); |
michael@0 | 10 | |
michael@0 | 11 | var log; |
michael@0 | 12 | dbg.onDebuggerStatement = function handleDebugger(frame) { |
michael@0 | 13 | log += "d"; |
michael@0 | 14 | assertThrowsInstanceOf(function () { frame.onPop = badValue; }, TypeError); |
michael@0 | 15 | }; |
michael@0 | 16 | |
michael@0 | 17 | log = ""; |
michael@0 | 18 | g.eval("debugger"); |
michael@0 | 19 | assertEq(log, "d"); |
michael@0 | 20 | } |
michael@0 | 21 | |
michael@0 | 22 | test(null); |
michael@0 | 23 | test(false); |
michael@0 | 24 | test(1); |
michael@0 | 25 | test("stringy"); |
michael@0 | 26 | test({}); |
michael@0 | 27 | test([]); |
michael@0 | 28 | |
michael@0 | 29 | // Getting and setting the prototype's onPop is an error. |
michael@0 | 30 | assertThrowsInstanceOf(function () { Debugger.Frame.prototype.onPop; }, TypeError); |
michael@0 | 31 | assertThrowsInstanceOf( |
michael@0 | 32 | function () { Debugger.Frame.prototype.onPop = function () {}; }, |
michael@0 | 33 | TypeError); |
michael@0 | 34 | |
michael@0 | 35 | // The getters and setters correctly check the type of their 'this' argument. |
michael@0 | 36 | var descriptor = Object.getOwnPropertyDescriptor(Debugger.Frame.prototype, 'onPop'); |
michael@0 | 37 | assertEq(descriptor.configurable, true); |
michael@0 | 38 | assertEq(descriptor.enumerable, false); |
michael@0 | 39 | assertThrowsInstanceOf(function () { descriptor.get.call({}); }, TypeError); |
michael@0 | 40 | assertThrowsInstanceOf(function () { descriptor.set.call({}, function() {}); }, TypeError); |