diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/debug/breakpoint-12.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/debug/breakpoint-12.js')
-rw-r--r-- | js/src/jit-test/tests/debug/breakpoint-12.js | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/breakpoint-12.js b/js/src/jit-test/tests/debug/breakpoint-12.js new file mode 100644 index 000000000..54f48b7c6 --- /dev/null +++ b/js/src/jit-test/tests/debug/breakpoint-12.js @@ -0,0 +1,78 @@ +// Removing a global as a debuggee forgets all its breakpoints. + + +var dbgA = new Debugger; +var logA = ''; + +var dbgB = new Debugger; +var logB = ''; + +var g1 = newGlobal(); +g1.eval('function g1f() { print("Weltuntergang"); }'); +var DOAg1 = dbgA.addDebuggee(g1); +var DOAg1f = DOAg1.getOwnPropertyDescriptor('g1f').value; +DOAg1f.script.setBreakpoint(0, { hit: () => { logA += '1'; } }); + +var DOBg1 = dbgB.addDebuggee(g1); +var DOBg1f = DOBg1.getOwnPropertyDescriptor('g1f').value; +DOBg1f.script.setBreakpoint(0, { hit: () => { logB += '1'; } }); + + +var g2 = newGlobal(); +g2.eval('function g2f() { print("Mokushi"); }'); + +var DOAg2 = dbgA.addDebuggee(g2); +var DOAg2f = DOAg2.getOwnPropertyDescriptor('g2f').value; +DOAg2f.script.setBreakpoint(0, { hit: () => { logA += '2'; } }); + +var DOBg2 = dbgB.addDebuggee(g2); +var DOBg2f = DOBg2.getOwnPropertyDescriptor('g2f').value; +DOBg2f.script.setBreakpoint(0, { hit: () => { logB += '2'; } }); + +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '12'); +assertEq(logB, '12'); +logA = logB = ''; + +// Removing a global as a debuggee should make its breakpoint not hit. +dbgA.removeDebuggee(g2); +dbgB.removeDebuggee(g1); +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '1'); +assertEq(logB, '2'); +logA = logB = ''; + +// Adding the global back as a debuggee should not resurrect its breakpoints. +dbgA.addDebuggee(g2); +dbgB.addDebuggee(g1); +assertEq(logA, ''); +assertEq(logB, ''); +g1.g1f(); +g2.g2f(); +assertEq(logA, '1'); +assertEq(logB, '2'); +logA = logB = ''; + +// But, we can set them again, and it all works. +DOAg2f.script.setBreakpoint(0, { hit: () => { logA += '2'; } }); +assertEq(logA, ''); +assertEq(logB, ''); +g2.g2f(); +g1.g1f(); +assertEq(logA, '21'); +assertEq(logB, '2'); +logA = logB = ''; + +DOBg1f.script.setBreakpoint(0, { hit: () => { logB += '1'; } }); +assertEq(logA, ''); +assertEq(logB, ''); +g2.g2f(); +g1.g1f(); +assertEq(logA, '21'); +assertEq(logB, '21'); |