diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/jit-test/tests/debug/Frame-onPop-source-location.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/jit-test/tests/debug/Frame-onPop-source-location.js')
-rw-r--r-- | js/src/jit-test/tests/debug/Frame-onPop-source-location.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/Frame-onPop-source-location.js b/js/src/jit-test/tests/debug/Frame-onPop-source-location.js new file mode 100644 index 0000000000..b0a01436d3 --- /dev/null +++ b/js/src/jit-test/tests/debug/Frame-onPop-source-location.js @@ -0,0 +1,58 @@ +// Ensure onPop hook for the final return/yield uses the correct source location +// (closing '}' of the function body). + +var g = newGlobal({newCompartment: true}); +var dbg = new Debugger(g); +dbg.onEnterFrame = frame => { + if (frame.type === "global") { + return; + } + frame.onPop = c => { + if (c.yield !== true) { + const data = frame.script.getOffsetMetadata(frame.offset); + g.log.push(`pop(${data.lineNumber}:${data.columnNumber})`); + } + }; +}; +g.evaluate(` // line 1 +this.log = []; // 2 +function A() { // 3 + log.push("A"); // 4 + if (log === null) { // 5 + throw "fail"; // 6 + } // 7 +} // 8 +function* B() { // 9 + log.push("B"); // 10 + if (log === null) { // 11 + throw "fail"; // 12 + } // 13 +} // 14 +async function C() { // 15 + log.push("C"); // 16 + if (log === null) { // 17 + throw "fail"; // 18 + } // 19 +} // 20 +let D = async () => { // 21 + log.push("D"); // 22 + if (log === null) { // 23 + throw "fail"; // 24 + } // 25 +}; // 26 +class E extends class {} { // 27 + constructor() { // 28 + log.push("E"); // 29 + super(); // 30 + if (log === null) { // 31 + throw "fail"; // 32 + } // 33 + } // 34 +} // 35 +A(); +for (let x of B()) {} +C(); +D(); +new E(); +`); +assertEq(g.log.join(","), "A,pop(8:0),B,pop(14:0),C,pop(20:0),D,pop(26:0),E,pop(27:16),pop(34:4)"); |