Bug 1598750: Make browser_nested_iframe.js wait for doc load complete if the nested iframe doc accessible isn't present yet. r=morgan

For OOP iframes, a doc load complete event on the embedder document doesn't necessarily mean the iframe document has finished loading yet.
We already checked for the busy state on the nested iframe doc and waited for a doc load complete event in that case.
However, depending on timing, it might be possible there is no document at all (even a busy one), so we should wait for doc load complete in that case too.
This is a speculative fix; I wasn't able to reproduce this myself.

Differential Revision: https://phabricator.services.mozilla.com/D118123
This commit is contained in:
James Teh 2021-06-22 23:11:25 +00:00
Родитель 0901151ac2
Коммит 165b6e2e26
1 изменённых файлов: 17 добавлений и 7 удалений

Просмотреть файл

@ -38,17 +38,27 @@ function getOsPid(browsingContext) {
addAccessibleTask(
`<iframe id="${NESTED_IFRAME_ID}" src="${nestedURL.href}"/>`,
async function(browser, iframeDocAcc, contentDocAcc) {
ok(iframeDocAcc, "IFRAME document accessible is present");
let nestedDocAcc = findAccessibleChildByID(
iframeDocAcc,
NESTED_IFRAME_DOC_BODY_ID
);
ok(iframeDocAcc, "IFRAME document accessible is present");
ok(nestedDocAcc, "Nested IFRAME document accessible is present");
let waitForNestedDocLoad = false;
if (nestedDocAcc) {
const state = {};
nestedDocAcc.getState(state, {});
if (state.value & STATE_BUSY) {
info("Nested IFRAME document accessible is present but busy");
waitForNestedDocLoad = true;
} else {
ok(true, "Nested IFRAME document accessible is present and ready");
}
} else {
info("Nested IFRAME document accessible is not present yet");
waitForNestedDocLoad = true;
}
if (waitForNestedDocLoad) {
info("Waiting for doc load complete on nested iframe document");
nestedDocAcc = (
await waitForEvent(
EVENT_DOCUMENT_LOAD_COMPLETE,