browser_hidden_iframe.js (2398B)
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 /* import-globals-from ../../mochitest/states.js */ 8 /* import-globals-from ../../mochitest/role.js */ 9 loadScripts({ name: "states.js", dir: MOCHITESTS_DIR }); 10 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR }); 11 12 addAccessibleTask( 13 `<input id="textbox" value="hello"/>`, 14 async function (browser, contentDocAcc) { 15 info( 16 "Check that the IFRAME and the IFRAME document are not accessible initially." 17 ); 18 let iframeAcc = findAccessibleChildByID(contentDocAcc, DEFAULT_IFRAME_ID); 19 let iframeDocAcc = findAccessibleChildByID( 20 contentDocAcc, 21 DEFAULT_IFRAME_DOC_BODY_ID 22 ); 23 ok(!iframeAcc, "IFRAME is hidden and should not be accessible"); 24 ok(!iframeDocAcc, "IFRAME document is hidden and should not be accessible"); 25 26 info( 27 "Show the IFRAME and check that it's now available in the accessibility tree." 28 ); 29 30 const events = [[EVENT_REORDER, contentDocAcc]]; 31 32 const onEvents = waitForEvents(events); 33 await SpecialPowers.spawn(browser, [DEFAULT_IFRAME_ID], contentId => { 34 content.document.getElementById(contentId).style.display = ""; 35 }); 36 await onEvents; 37 38 iframeAcc = findAccessibleChildByID(contentDocAcc, DEFAULT_IFRAME_ID); 39 ok(!isDefunct(iframeAcc), "IFRAME should be accessible"); 40 41 // Wait for the child iframe to layout itself. This can happen during or 42 // after the reorder event, depending on timing. 43 iframeDocAcc = await TestUtils.waitForCondition(() => { 44 return findAccessibleChildByID(contentDocAcc, DEFAULT_IFRAME_DOC_BODY_ID); 45 }); 46 47 is(iframeAcc.childCount, 1, "IFRAME accessible should have a single child"); 48 ok(iframeDocAcc, "IFRAME document exists"); 49 ok(!isDefunct(iframeDocAcc), "IFRAME document should be accessible"); 50 is( 51 iframeAcc.firstChild, 52 iframeDocAcc, 53 "An accessible for a IFRAME document is the child of the IFRAME accessible" 54 ); 55 is( 56 iframeDocAcc.parent, 57 iframeAcc, 58 "IFRAME document's parent matches the IFRAME." 59 ); 60 }, 61 { 62 topLevel: false, 63 iframe: true, 64 remoteIframe: true, 65 iframeAttrs: { 66 style: "display: none;", 67 }, 68 skipFissionDocLoad: true, 69 } 70 );