From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/tests/mochitest/chrome/child_focus_frame.html | 2 +- dom/tests/mochitest/chrome/file_bug800817.xhtml | 11 +---- dom/tests/mochitest/chrome/test_bug800817.xhtml | 10 +--- dom/tests/mochitest/chrome/window_focus.xhtml | 57 +++++++++++++++++++---- 4 files changed, 50 insertions(+), 30 deletions(-) (limited to 'dom/tests/mochitest/chrome') diff --git a/dom/tests/mochitest/chrome/child_focus_frame.html b/dom/tests/mochitest/chrome/child_focus_frame.html index d7f0ff63cd..89e9b8aae1 100644 --- a/dom/tests/mochitest/chrome/child_focus_frame.html +++ b/dom/tests/mochitest/chrome/child_focus_frame.html @@ -43,8 +43,8 @@
Options One -
+
abc
diff --git a/dom/tests/mochitest/chrome/file_bug800817.xhtml b/dom/tests/mochitest/chrome/file_bug800817.xhtml index bcd64b3ca7..ea646a74a1 100644 --- a/dom/tests/mochitest/chrome/file_bug800817.xhtml +++ b/dom/tests/mochitest/chrome/file_bug800817.xhtml @@ -30,16 +30,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817 var b1 = document.getElementById("b1"); var b2 = document.getElementById("b2"); - var testMozBrowser = window.arguments[0].testMozBrowser; - if (testMozBrowser) { - b1.setAttribute("mozbrowser", "true"); - b2.setAttribute("mozbrowser", "true"); - } - - if (testMozBrowser) - window.arguments[0].info("Testing with mozbrowser=true"); - else - window.arguments[0].info("Testing without mozbrowser"); + window.arguments[0].info("Testing..."); b1.contentWindow.focus(); window.arguments[0].is(document.activeElement, b1, diff --git a/dom/tests/mochitest/chrome/test_bug800817.xhtml b/dom/tests/mochitest/chrome/test_bug800817.xhtml index fefaf2c155..76ea31a2fc 100644 --- a/dom/tests/mochitest/chrome/test_bug800817.xhtml +++ b/dom/tests/mochitest/chrome/test_bug800817.xhtml @@ -20,20 +20,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=800817 element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + partialTabList = ["t3", "t5", "t9", "t10", "t11", "t12", "t14", "t15", + "t16", "t19", "t20", "t21", "t22", "t26", "t27", "t28", "t29", "t30"]; + } for (var idx = 0; idx < partialTabList.length; idx++) { expectFocusShift(pressTab, null, getById(partialTabList[idx]), true, "partial tab key " + partialTabList[idx]); } @@ -415,6 +428,13 @@ function startTest() else { // TAB key for (var idx = 1; idx <= kTabbableSteps; idx++) { + if (!gCanTabMoveFocusToRootElement) { + if (idx == kChildDocumentRootIndex) + // t13 is the element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + continue; + } expectFocusShift(pressTab, null, getById("t" + idx), true, "tab key t" + idx); } @@ -427,6 +447,14 @@ function startTest() // Shift+TAB key setFocusTo("o5", window); for (idx = kTabbableSteps; idx > 0; idx--) { + if (!gCanTabMoveFocusToRootElement) { + if (idx == kChildDocumentRootIndex) { + // t13 is the element in child_focus_frame.html, + // and it's not getting the focus + // when gCanTabMoveFocusToRootElement is false. + continue; + } + } expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}), null, getById("t" + idx), true, "shift tab key t" + idx); } @@ -1158,29 +1186,38 @@ function framesetWindowLoaded(framesetWindow) gOldExpectedWindow = getTopWindow(framesetWindow); gMoveToFocusFrame = true; - for (var idx = 1; idx <= 8; idx++) { - gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1]; - if (idx % 2) + let steps = gCanTabMoveFocusToRootElement ? 8 : 4; + for (var idx = 1; idx <= steps; idx++) { + let frameIndex = gCanTabMoveFocusToRootElement ? (idx - 1) >> 1 : idx - 1; + gNewExpectedWindow = framesetWindow.frames[frameIndex]; + if (gCanTabMoveFocusToRootElement) { + if (idx % 2) { + initEvents(gNewExpectedWindow); + } + } else { initEvents(gNewExpectedWindow); + } expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow), - gNewExpectedWindow, getById("f" + idx), true, "frameset tab key f" + idx); + gNewExpectedWindow, getById("f" + (gCanTabMoveFocusToRootElement ? idx : idx * 2)), true, "frameset tab key f" + idx); gMoveToFocusFrame = false; gOldExpectedWindow = gNewExpectedWindow; } gNewExpectedWindow = framesetWindow.frames[0]; expectFocusShift(() => synthesizeKey("KEY_Tab", {}, framesetWindow), - gNewExpectedWindow, getById("f1"), true, "frameset tab key wrap to start"); + gNewExpectedWindow, gCanTabMoveFocusToRootElement ? getById("f1") : getById("f2"), true, "frameset tab key wrap to start"); gOldExpectedWindow = gNewExpectedWindow; gNewExpectedWindow = framesetWindow.frames[3]; expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow), gNewExpectedWindow, getById("f8"), true, "frameset shift tab key wrap to end"); - for (idx = 7; idx >= 1; idx--) { + steps = gCanTabMoveFocusToRootElement ? 7 : 3; + for (idx = steps; idx >= 1; idx--) { gOldExpectedWindow = gNewExpectedWindow; - gNewExpectedWindow = framesetWindow.frames[(idx - 1) >> 1]; + let frameIndex = gCanTabMoveFocusToRootElement ? (idx - 1) >> 1 : idx - 1; + gNewExpectedWindow = framesetWindow.frames[frameIndex]; expectFocusShift(() => synthesizeKey("KEY_Tab", {shiftKey: true}, framesetWindow), - gNewExpectedWindow, getById("f" + idx), true, "frameset shift tab key f" + idx); + gNewExpectedWindow, getById("f" + (gCanTabMoveFocusToRootElement ? idx : idx * 2)), true, "frameset shift tab key f" + idx); } // document shifting -- cgit v1.2.3