fune/js/ductwork/debugger/tests/test_nativewrappers.js
Ted Campbell 410e8dff3f Bug 1790912 - Fix lint issues in js/ductwork/debugger. r=ochameau
When we move this out of the js/ directory, a number of lint exceptions stop
applying so we should just fix the issues now.

Differential Revision: https://phabricator.services.mozilla.com/D157521
2022-09-25 09:03:33 +00:00

45 lines
1.1 KiB
JavaScript

"use strict";
function run_test() {
const { addDebuggerToGlobal } = ChromeUtils.import(
"resource://gre/modules/jsdebugger.jsm"
);
Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
registerCleanupFunction(() => {
Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
});
addDebuggerToGlobal(globalThis);
const g = testGlobal("test1");
const dbg = new Debugger();
dbg.addDebuggee(g);
dbg.onDebuggerStatement = function(frame) {
const args = frame.arguments;
try {
args[0];
Assert.ok(true);
} catch (ex) {
Assert.ok(false);
}
};
g.eval("function stopMe(arg) {debugger;}");
const g2 = testGlobal("test2");
g2.g = g;
g2.eval(
"(" +
function createBadEvent() {
// eslint-disable-next-line mozilla/reject-importGlobalProperties
Cu.importGlobalProperties(["DOMParser"]);
const parser = new DOMParser();
const doc = parser.parseFromString("<foo></foo>", "text/xml");
g.stopMe(doc.createEvent("MouseEvent"));
} +
")()"
);
dbg.removeAllDebuggees();
}