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 --- .../browser/general/browser_test_doc_creation.js | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 accessible/tests/browser/general/browser_test_doc_creation.js (limited to 'accessible/tests/browser/general/browser_test_doc_creation.js') diff --git a/accessible/tests/browser/general/browser_test_doc_creation.js b/accessible/tests/browser/general/browser_test_doc_creation.js new file mode 100644 index 0000000000..7ee07f63fd --- /dev/null +++ b/accessible/tests/browser/general/browser_test_doc_creation.js @@ -0,0 +1,55 @@ +/* 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 tab1URL = `data:text/html, + + + + First tab to be loaded + + + JUST A BUTTON + + `; + +const tab2URL = `data:text/html, + + + + Second tab to be loaded + + + JUST A BUTTON + + `; + +// Checking that, if there are open windows before accessibility was started, +// root accessibles for open windows are created so that all root accessibles +// are stored in application accessible children array. +add_task(async function testDocumentCreation() { + let tab1 = await openNewTab(tab1URL); + let tab2 = await openNewTab(tab2URL); + let accService = await initAccessibilityService(); + + info("Verifying that each tab content document is in accessible cache."); + for (const browser of [...gBrowser.browsers]) { + await SpecialPowers.spawn(browser, [], async () => { + let accServiceContent = Cc[ + "@mozilla.org/accessibilityService;1" + ].getService(Ci.nsIAccessibilityService); + Assert.ok( + !!accServiceContent.getAccessibleFromCache(content.document), + "Document accessible is in cache." + ); + }); + } + + BrowserTestUtils.removeTab(tab1); + BrowserTestUtils.removeTab(tab2); + + accService = null; // eslint-disable-line no-unused-vars + await shutdownAccessibilityService(); +}); -- cgit v1.2.3