commit 975653d57082e79f623516a3ca4376ac27a2dda3
parent 9700371b499e86864dfd7f80ca560741eb2e80ab
Author: Alexandra Borovova <aborovova@mozilla.com>
Date: Wed, 26 Nov 2025 08:17:44 +0000
Bug 1706066 - [devtools] Extend mochitests to checks for maxTouchPoints in a iframe. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D273974
Diffstat:
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/devtools/client/responsive/test/browser/browser_max_touchpoints.js b/devtools/client/responsive/test/browser/browser_max_touchpoints.js
@@ -19,6 +19,11 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
0,
"navigator.maxTouchPoints is 0 when touch simulation is not enabled"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 0,
+ "navigator.maxTouchPoints in the iframe is 0 when touch simulation is not enabled"
+ );
info(
"Test value maxTouchPoints is non-zero when touch simulation is enabled."
@@ -29,6 +34,11 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
1,
"navigator.maxTouchPoints should be 1 after enabling touch simulation"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 1,
+ "navigator.maxTouchPoints in the iframe should be 1 after enabling touch simulation"
+ );
info("Toggling off touch simulation.");
await toggleTouchSimulation(ui);
@@ -38,6 +48,12 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
"navigator.maxTouchPoints should be 0 after turning off touch simulation"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 0,
+ "navigator.maxTouchPoints in the iframe should be 0 after turning off touch simulation"
+ );
+
info("Enabling touch simulation again");
await toggleTouchSimulation(ui);
is(
@@ -45,6 +61,11 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
1,
"navigator.maxTouchPoints should be 1 after enabling touch simulation again"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 1,
+ "navigator.maxTouchPoints in the iframe should be 1 after enabling touch simulation again"
+ );
info("Check maxTouchPoints override persists after reload");
await reloadBrowser();
@@ -54,6 +75,11 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
1,
"navigator.maxTouchPoints is still 1 after reloading"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 1,
+ "navigator.maxTouchPoints in the iframe is still 1 after reloading"
+ );
info(
"Check that maxTouchPoints persist after navigating to a page that forces the creation of a new browsing context"
@@ -78,6 +104,11 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
1,
"navigator.maxTouchPoints is still 1 after navigating to a new browsing context"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 1,
+ "navigator.maxTouchPoints in the iframe is still 1 after navigating to a new browsing context"
+ );
info("Check that the value is reset when closing RDM");
// Closing RDM trigers a reload
@@ -90,14 +121,19 @@ addRDMTask(TEST_COM_URL, async function ({ ui, browser, tab }) {
0,
"navigator.maxTouchPoints is 0 after closing RDM"
);
+ is(
+ await getMaxTouchPoints(browser.browsingContext.children[0]),
+ 0,
+ "navigator.maxTouchPoints in the iframe is 0 after closing RDM"
+ );
reloadOnTouchChange(false);
});
function getMaxTouchPoints(browserOrBrowsingContext) {
- return ContentTask.spawn(
+ return SpecialPowers.spawn(
browserOrBrowsingContext,
- null,
+ [],
() => content.navigator.maxTouchPoints
);
}