From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- accessible/tests/browser/states/browser.ini | 17 +++ .../browser_deck_has_out_of_process_iframe.js | 133 +++++++++++++++++++++ ...r_offscreen_element_in_out_of_process_iframe.js | 98 +++++++++++++++ .../tests/browser/states/browser_test_link.js | 47 ++++++++ .../browser/states/browser_test_visibility.js | 52 ++++++++ accessible/tests/browser/states/head.js | 81 +++++++++++++ accessible/tests/browser/states/target.html | 3 + .../test_deck_has_out_of_process_iframe.xhtml | 10 ++ 8 files changed, 441 insertions(+) create mode 100644 accessible/tests/browser/states/browser.ini create mode 100644 accessible/tests/browser/states/browser_deck_has_out_of_process_iframe.js create mode 100644 accessible/tests/browser/states/browser_offscreen_element_in_out_of_process_iframe.js create mode 100644 accessible/tests/browser/states/browser_test_link.js create mode 100644 accessible/tests/browser/states/browser_test_visibility.js create mode 100644 accessible/tests/browser/states/head.js create mode 100644 accessible/tests/browser/states/target.html create mode 100644 accessible/tests/browser/states/test_deck_has_out_of_process_iframe.xhtml (limited to 'accessible/tests/browser/states') diff --git a/accessible/tests/browser/states/browser.ini b/accessible/tests/browser/states/browser.ini new file mode 100644 index 0000000000..726c7f4f03 --- /dev/null +++ b/accessible/tests/browser/states/browser.ini @@ -0,0 +1,17 @@ +[DEFAULT] +support-files = + head.js + !/accessible/tests/browser/shared-head.js + !/accessible/tests/mochitest/*.js + !/accessible/tests/browser/*.jsm + +[browser_test_link.js] +skip-if = verify +[browser_test_visibility.js] +[browser_deck_has_out_of_process_iframe.js] +skip-if = (!debug && webrender && (os == 'win')) # bug 1584037 +support-files = + target.html + test_deck_has_out_of_process_iframe.xhtml +[browser_offscreen_element_in_out_of_process_iframe.js] +skip-if = (webrender && os == 'win') # bug 1580706 diff --git a/accessible/tests/browser/states/browser_deck_has_out_of_process_iframe.js b/accessible/tests/browser/states/browser_deck_has_out_of_process_iframe.js new file mode 100644 index 0000000000..155ac4c954 --- /dev/null +++ b/accessible/tests/browser/states/browser_deck_has_out_of_process_iframe.js @@ -0,0 +1,133 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const { Preferences } = ChromeUtils.import( + "resource://gre/modules/Preferences.jsm" +); + +const DIRPATH = getRootDirectory(gTestPath).replace( + "chrome://mochitests/content/", + "" +); +const parentPATH = DIRPATH + "test_deck_has_out_of_process_iframe.xhtml"; +const iframePATH = DIRPATH + "target.html"; + +// XXX: Using external files here since using data URL breaks something, e.g. it +// makes querying the second iframe in a hidden deck failure for some reasons. +const parentURL = `http://example.com/${parentPATH}`; +const iframeURL = `http://example.org/${iframePATH}`; + +add_task(async function() { + if (Preferences.locked("fission.autostart")) { + ok( + true, + "fission.autostart pref is locked on this channel which means " + + "we don't need to run the following tests" + ); + return; + } + + const win = await BrowserTestUtils.openNewBrowserWindow({ + fission: true, + }); + + try { + const browser = win.gBrowser.selectedTab.linkedBrowser; + + BrowserTestUtils.loadURI(browser, parentURL); + await BrowserTestUtils.browserLoaded(browser, false, parentURL); + + async function setupIFrame(id, url) { + const iframe = content.document.getElementById(id); + + iframe.contentWindow.location = url; + await new Promise(resolve => { + iframe.addEventListener("load", resolve, { once: true }); + }); + + return iframe.browsingContext; + } + + async function spawnSelectDeck(index) { + async function selectDeck(i) { + const deck = content.document.getElementById("deck"); + + deck.setAttribute("selectedIndex", i); + await new Promise(resolve => { + content.window.addEventListener("MozAfterPaint", resolve, { + once: true, + }); + }); + return deck.selectedIndex; + } + await SpecialPowers.spawn(browser, [index], selectDeck); + + await waitForIFrameUpdates(); + } + + const firstIFrame = await SpecialPowers.spawn( + browser, + ["first", iframeURL], + setupIFrame + ); + const secondIFrame = await SpecialPowers.spawn( + browser, + ["second", iframeURL], + setupIFrame + ); + + await waitForIFrameUpdates(); + + await spawnTestStates( + firstIFrame, + "target", + 0, + nsIAccessibleStates.STATE_OFFSCREEN + ); + // Disable the check for the target element in the unselected pane of the + // deck, this should be fixed by bug 1578932. + // Note: As of now we can't use todo in the script transfered into the + // out-of-process. + //await spawnTestStates( + // secondIFrame, + // "target", + // nsIAccessibleStates.STATE_OFFSCREEN, + // nsIAccessibleStates.STATE_INVISIBLE + //); + + // Select the second panel. + await spawnSelectDeck(1); + await spawnTestStates( + firstIFrame, + "target", + nsIAccessibleStates.STATE_OFFSCREEN, + nsIAccessibleStates.STATE_INVISIBLE + ); + await spawnTestStates( + secondIFrame, + "target", + 0, + nsIAccessibleStates.STATE_OFFSCREEN + ); + + // Select the first panel again. + await spawnSelectDeck(0); + await spawnTestStates( + firstIFrame, + "target", + 0, + nsIAccessibleStates.STATE_OFFSCREEN + ); + await spawnTestStates( + secondIFrame, + "target", + nsIAccessibleStates.STATE_OFFSCREEN, + nsIAccessibleStates.STATE_INVISIBLE + ); + } finally { + await BrowserTestUtils.closeWindow(win); + } +}); diff --git a/accessible/tests/browser/states/browser_offscreen_element_in_out_of_process_iframe.js b/accessible/tests/browser/states/browser_offscreen_element_in_out_of_process_iframe.js new file mode 100644 index 0000000000..289d3fec9a --- /dev/null +++ b/accessible/tests/browser/states/browser_offscreen_element_in_out_of_process_iframe.js @@ -0,0 +1,98 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +const parentURL = + "data:text/html;charset=utf-8," + + '
' + + '
' + + '