diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /js/ductwork/debugger/tests | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/ductwork/debugger/tests')
-rw-r--r-- | js/ductwork/debugger/tests/head_dbg.js | 13 | ||||
-rw-r--r-- | js/ductwork/debugger/tests/test_nativewrappers.js | 38 | ||||
-rw-r--r-- | js/ductwork/debugger/tests/xpcshell.ini | 7 |
3 files changed, 58 insertions, 0 deletions
diff --git a/js/ductwork/debugger/tests/head_dbg.js b/js/ductwork/debugger/tests/head_dbg.js new file mode 100644 index 0000000000..aad37f5f12 --- /dev/null +++ b/js/ductwork/debugger/tests/head_dbg.js @@ -0,0 +1,13 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +function testGlobal(aName) { + let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"] + .createInstance(Ci.nsIPrincipal); + + let sandbox = Cu.Sandbox(systemPrincipal); + Cu.evalInSandbox("this.__name = '" + aName + "'", sandbox); + return sandbox; +} diff --git a/js/ductwork/debugger/tests/test_nativewrappers.js b/js/ductwork/debugger/tests/test_nativewrappers.js new file mode 100644 index 0000000000..ccddb1e845 --- /dev/null +++ b/js/ductwork/debugger/tests/test_nativewrappers.js @@ -0,0 +1,38 @@ +function run_test() +{ + const {addDebuggerToGlobal} = ChromeUtils.import("resource://gre/modules/jsdebugger.jsm"); + const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); + + Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true); + registerCleanupFunction(() => { + Services.prefs.clearUserPref("security.allow_eval_with_system_principal"); + }); + + addDebuggerToGlobal(this); + var g = testGlobal("test1"); + + var dbg = new Debugger(); + dbg.addDebuggee(g); + dbg.onDebuggerStatement = function(aFrame) { + let args = aFrame["arguments"]; + try { + args[0]; + Assert.ok(true); + } catch(ex) { + Assert.ok(false); + } + }; + + g.eval("function stopMe(arg) {debugger;}"); + + g2 = testGlobal("test2"); + g2.g = g; + g2.eval("(" + function createBadEvent() { + Cu.importGlobalProperties(["DOMParser"]); + let parser = new DOMParser(); + let doc = parser.parseFromString("<foo></foo>", "text/xml"); + g.stopMe(doc.createEvent("MouseEvent")); + } + ")()"); + + dbg.removeAllDebuggees(); +} diff --git a/js/ductwork/debugger/tests/xpcshell.ini b/js/ductwork/debugger/tests/xpcshell.ini new file mode 100644 index 0000000000..c2a1cd07af --- /dev/null +++ b/js/ductwork/debugger/tests/xpcshell.ini @@ -0,0 +1,7 @@ +[DEFAULT] +head = head_dbg.js +skip-if = toolkit == 'android' + +[test_nativewrappers.js] +# Bug 685068 +fail-if = os == "android" |