summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/debugger/test')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js10
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js45
-rw-r--r--devtools/client/debugger/test/mochitest/examples/event-breakpoints.js7
3 files changed, 61 insertions, 1 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
index 1065674186..49b3d3ffce 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-event-breakpoints.js
@@ -7,6 +7,7 @@
add_task(async function () {
await pushPref("dom.element.invokers.enabled", true);
await pushPref("dom.element.popover.enabled", true);
+ await pushPref("dom.events.textevent.enabled", true);
const dbg = await initDebugger(
"doc-event-breakpoints.html",
@@ -151,6 +152,15 @@ add_task(async function () {
assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 63);
await resume(dbg);
+ info("Test textInput");
+ await toggleEventBreakpoint(dbg, "Keyboard", "event.keyboard.textInput");
+ invokeOnElement("#focus-text", "focus");
+ EventUtils.sendChar("N");
+ await waitForPaused(dbg);
+ assertPausedAtSourceAndLine(dbg, eventBreakpointsSource.id, 98);
+ await resume(dbg);
+ await toggleEventBreakpoint(dbg, "Keyboard", "event.keyboard.textInput");
+
info(`Check that breakpoint can be set on "scrollend"`);
await toggleEventBreakpoint(dbg, "Control", "event.control.scrollend");
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
index bfa2447474..29335af768 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-javascript-tracer.js
@@ -12,6 +12,19 @@ add_task(async function () {
const dbg = await initDebugger("doc-scripts.html");
+ // Add an iframe before starting the tracer to later check for key event on it
+ const preExistingIframeBrowsingContext = await SpecialPowers.spawn(
+ gBrowser.selectedBrowser,
+ [],
+ async function () {
+ const iframe = content.document.createElement("iframe");
+ iframe.src = `data:text/html,<input type="text" value="pre existing iframe" onkeydown="console.log('keydown')" />`;
+ content.document.body.appendChild(iframe);
+ await new Promise(resolve => (iframe.onload = resolve));
+ return iframe.contentWindow.browsingContext;
+ }
+ );
+
info("Enable the tracing");
await clickElement(dbg, "trace");
@@ -55,6 +68,38 @@ add_task(async function () {
await hasConsoleMessage(dbg, "DOM | click");
await hasConsoleMessage(dbg, "λ simple");
+ const iframeBrowsingContext = await SpecialPowers.spawn(
+ gBrowser.selectedBrowser,
+ [],
+ async function () {
+ const iframe = content.document.createElement("iframe");
+ iframe.src = `data:text/html,<input type="text" value="new iframe" onkeypress="console.log('keypress')" />`;
+ content.document.body.appendChild(iframe);
+ await new Promise(resolve => (iframe.onload = resolve));
+ iframe.contentWindow.document.querySelector("input").focus();
+ return iframe.contentWindow.browsingContext;
+ }
+ );
+
+ await BrowserTestUtils.synthesizeKey("x", {}, iframeBrowsingContext);
+ await hasConsoleMessage(dbg, "DOM | keypress");
+ await hasConsoleMessage(dbg, "λ onkeypress");
+
+ await SpecialPowers.spawn(
+ preExistingIframeBrowsingContext,
+ [],
+ async function () {
+ content.document.querySelector("input").focus();
+ }
+ );
+ await BrowserTestUtils.synthesizeKey(
+ "x",
+ {},
+ preExistingIframeBrowsingContext
+ );
+ await hasConsoleMessage(dbg, "DOM | keydown");
+ await hasConsoleMessage(dbg, "λ onkeydown");
+
// Test Blackboxing
info("Clear the console from previous traces");
const { hud } = await dbg.toolbox.getPanel("webconsole");
diff --git a/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js b/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js
index f9aa16b858..3d8163a8c4 100644
--- a/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js
+++ b/devtools/client/debugger/test/mochitest/examples/event-breakpoints.js
@@ -91,4 +91,9 @@ function onBeforeToggle(event) {
popover.addEventListener("toggle", onToggle);
function onToggle(event) {
console.log("toggle", event);
-} \ No newline at end of file
+}
+
+document.getElementById("focus-text").addEventListener("textInput", onTextInput);
+function onTextInput() {
+ console.log("textInput");
+}