mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1585239 - Wait for accessibility document ready in iframe. r=surkov
Differential Revision: https://phabricator.services.mozilla.com/D55067 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
8da4de5388
commit
d1e6184f73
@ -57,7 +57,7 @@ add_task(async function() {
|
||||
// Setup an out-of-process iframe which is initially scrolled out.
|
||||
const iframe = await SpecialPowers.spawn(browser, [iframeURL], setup);
|
||||
|
||||
await waitForIFrameUpdates();
|
||||
await waitForIFrameA11yReady(iframe);
|
||||
await spawnTestStates(
|
||||
iframe,
|
||||
"target",
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
/* exported waitForIFrameUpdates, spawnTestStates */
|
||||
/* exported waitForIFrameA11yReady, waitForIFrameUpdates, spawnTestStates */
|
||||
|
||||
// Load the shared-head file first.
|
||||
/* import-globals-from ../shared-head.js */
|
||||
@ -20,6 +20,35 @@ loadScripts(
|
||||
{ name: "promisified-events.js", dir: MOCHITESTS_DIR }
|
||||
);
|
||||
|
||||
// This is another version of addA11yLoadEvent for fission.
|
||||
async function waitForIFrameA11yReady(iFrameBrowsingContext) {
|
||||
async function waitForReady() {
|
||||
new Promise(resolve => {
|
||||
function waitForDocLoad() {
|
||||
SpecialPowers.executeSoon(() => {
|
||||
const acc = SpecialPowers.Cc[
|
||||
"@mozilla.org/accessibilityService;1"
|
||||
].getService(SpecialPowers.Ci.nsIAccessibilityService);
|
||||
|
||||
const accDoc = acc.getAccessibleFor(content.document);
|
||||
let state = {};
|
||||
accDoc.getState(state, {});
|
||||
if (state.value & SpecialPowers.Ci.nsIAccessibleStates.STATE_BUSY) {
|
||||
SpecialPowers.executeSoon(waitForDocLoad);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
}, 0);
|
||||
}
|
||||
waitForDocLoad();
|
||||
});
|
||||
}
|
||||
|
||||
await SimpleTest.promiseFocus(window);
|
||||
|
||||
await SpecialPowers.spawn(iFrameBrowsingContext, [], waitForReady);
|
||||
}
|
||||
|
||||
// A utility function to make sure the information of scroll position or visible
|
||||
// area changes reach to out-of-process iframes.
|
||||
async function waitForIFrameUpdates() {
|
||||
|
Loading…
Reference in New Issue
Block a user