From 26a029d407be480d791972afb5975cf62c9360a6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 02:47:55 +0200 Subject: Adding upstream version 124.0.1. Signed-off-by: Daniel Baumann --- .../tests/debug/Frame-onPop-error-error.js | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 js/src/jit-test/tests/debug/Frame-onPop-error-error.js (limited to 'js/src/jit-test/tests/debug/Frame-onPop-error-error.js') diff --git a/js/src/jit-test/tests/debug/Frame-onPop-error-error.js b/js/src/jit-test/tests/debug/Frame-onPop-error-error.js new file mode 100644 index 0000000000..fc6c18b6d4 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-onPop-error-error.js @@ -0,0 +1,60 @@ +// |jit-test| error: TestComplete +// onPop can request a termination when stopped for a termination + +var g = newGlobal({newCompartment: true}); +var dbg = new Debugger(g); + +// We use Debugger.Frame.prototype.eval and ignore the outer 'eval' frame so we +// can catch the termination. + +function test(type, provocation) { + // Help people figure out which 'test' call failed. + print("type: " + JSON.stringify(type)); + print("provocation: " + JSON.stringify(provocation)); + + var log; + dbg.onEnterFrame = function handleFirstFrame(f) { + log += 'f'; + dbg.onDebuggerStatement = function handleDebugger(f) { + log += 'd'; + return null; + }; + + dbg.onEnterFrame = function handleSecondFrame(f) { + log += 'e'; + assertEq(f.type, 'eval'); + + dbg.onEnterFrame = function handleThirdFrame(f) { + log += '('; + assertEq(f.type, type); + + dbg.onEnterFrame = function handleExtraFrames(f) { + // This should never be called. + assertEq(false, true); + }; + + f.onPop = function handlePop(c) { + log += ')'; + assertEq(c, null); + return null; + }; + }; + }; + + assertEq(f.eval(provocation), null); + }; + + log = ''; + // This causes handleFirstFrame to be called. + assertEq(typeof g.eval('eval'), 'function'); + assertEq(log, 'fe(d)'); + + print(); +} + +g.eval('function f() { debugger; return \'termination fail\'; }'); +test('call', 'f();'); +test('call', 'new f;'); +test('eval', 'eval(\'debugger; \\\'termination fail\\\';\');'); +test('global', 'evaluate(\'debugger; \\\'termination fail\\\';\');'); +throw 'TestComplete'; -- cgit v1.2.3