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/noExecute-06.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/noExecute-06.js')
-rw-r--r-- | js/src/jit-test/tests/debug/noExecute-06.js | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/debug/noExecute-06.js b/js/src/jit-test/tests/debug/noExecute-06.js new file mode 100644 index 000000000..50b0be2c6 --- /dev/null +++ b/js/src/jit-test/tests/debug/noExecute-06.js @@ -0,0 +1,81 @@ +// Tests that NX disallows debuggee execution for multiple debuggers and +// multiple debuggees. + +load(libdir + "asserts.js"); +load(libdir + "debuggerNXHelper.js"); + +var g1 = newGlobal(); +var g2 = newGlobal(); +var dbg1 = new Debugger; +var dbg2 = new Debugger; + +g1w1 = dbg1.addDebuggee(g1); + +g1w2 = dbg2.addDebuggee(g1); +g2w = dbg2.addDebuggee(g2); + +g1.eval(` + function d(f) { debugger; return f; } + function f() { return 42; } + var o = { + get p() { return 42; }, + set p(x) { } + }; + `); + +g2.eval(` + function d(f) { debugger; return f; } + function f() { return 42; } + var o = { + get p() { return 42; }, + set p(x) { } + }; + `); + +var strs = ["f();", "o.p", "o.p = 42"]; + +var fw1; +dbg1.onDebuggerStatement = (frame) => { + fw1 = frame.arguments[0]; +} +g1.eval('d(f)'); +dbg1.onDebuggerStatement = undefined; +var fw2; +dbg2.onDebuggerStatement = (frame) => { + fw2 = frame.arguments[0]; +} +g2.eval('d(f)'); +dbg2.onDebuggerStatement = undefined; + +function testHook(hookName) { + var newestG1Frame = dbg1.getNewestFrame(); + if (hookName != 'onNewGlobalObject' && + hookName != 'onNewScript' && + hookName != 'onNewPromise' && + hookName != 'onPromiseSettled') + { + var newestG2Frame = dbg2.getNewestFrame(); + } + + for (var s of strs) { + // When this hook is called, g1 has been locked twice, so even invocation + // functions do not work. + assertEq(g1w1.executeInGlobal(s).throw.unsafeDereference() instanceof Debugger.DebuggeeWouldRun, true); + assertEq(g1w2.executeInGlobal(s).throw.unsafeDereference() instanceof Debugger.DebuggeeWouldRun, true); + if (newestG1Frame) { + assertEq(newestG1Frame.eval(s).throw.unsafeDereference() instanceof Debugger.DebuggeeWouldRun, true); + } + assertEq(fw1.apply(null).throw.unsafeDereference() instanceof Debugger.DebuggeeWouldRun, true); + + // But g2 has only been locked once and so should work. + assertEq(g2w.executeInGlobal(s).throw, undefined); + if (newestG2Frame) { + assertEq(newestG2Frame.eval(s).throw, undefined); + } + assertEq(fw2.apply(null).return, 42); + } +} + +testDebuggerHooksNX(dbg1, g1, () => { + testDebuggerHooksNX(dbg2, g2, testHook); +}); |