browser_test_doc_creation.js (1754B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const tab1URL = `data:text/html, 8 <html xmlns="http://www.w3.org/1999/xhtml"> 9 <head> 10 <meta charset="utf-8"/> 11 <title>First tab to be loaded</title> 12 </head> 13 <body> 14 <butotn>JUST A BUTTON</butotn> 15 </body> 16 </html>`; 17 18 const tab2URL = `data:text/html, 19 <html xmlns="http://www.w3.org/1999/xhtml"> 20 <head> 21 <meta charset="utf-8"/> 22 <title>Second tab to be loaded</title> 23 </head> 24 <body> 25 <butotn>JUST A BUTTON</butotn> 26 </body> 27 </html>`; 28 29 // Checking that, if there are open windows before accessibility was started, 30 // root accessibles for open windows are created so that all root accessibles 31 // are stored in application accessible children array. 32 add_task(async function testDocumentCreation() { 33 let tab1 = await openNewTab(tab1URL); 34 let tab2 = await openNewTab(tab2URL); 35 let accService = await initAccessibilityService(); 36 37 info("Verifying that each tab content document is in accessible cache."); 38 for (const browser of [...gBrowser.browsers]) { 39 await SpecialPowers.spawn(browser, [], async () => { 40 let accServiceContent = Cc[ 41 "@mozilla.org/accessibilityService;1" 42 ].getService(Ci.nsIAccessibilityService); 43 Assert.ok( 44 !!accServiceContent.getAccessibleFromCache(content.document), 45 "Document accessible is in cache." 46 ); 47 }); 48 } 49 50 BrowserTestUtils.removeTab(tab1); 51 BrowserTestUtils.removeTab(tab2); 52 53 accService = null; // eslint-disable-line no-unused-vars 54 await shutdownAccessibilityService(); 55 });