diff --git a/accessible/base/NotificationController.cpp b/accessible/base/NotificationController.cpp index d2ebb7decb2d..d08500458221 100644 --- a/accessible/base/NotificationController.cpp +++ b/accessible/base/NotificationController.cpp @@ -809,7 +809,8 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime) // Process relocation list. for (uint32_t idx = 0; idx < mRelocations.Length(); idx++) { - if (mRelocations[idx]->IsInDocument()) { + // owner should be in a document and have na associated DOM node (docs sometimes don't) + if (mRelocations[idx]->IsInDocument() && mRelocations[idx]->HasOwnContent()) { mDocument->DoARIAOwnsRelocation(mRelocations[idx]); } } diff --git a/accessible/tests/browser/tree/browser_aria_owns.js b/accessible/tests/browser/tree/browser_aria_owns.js index 40587b3cd22d..06b5fe47295f 100644 --- a/accessible/tests/browser/tree/browser_aria_owns.js +++ b/accessible/tests/browser/tree/browser_aria_owns.js @@ -147,3 +147,22 @@ addAccessibleTask(` testChildrenIds(two, ["a", "b"]); } ); + +addAccessibleTask(`
`, + async function(browser, accDoc) { + testChildrenIds(accDoc, ["a", "b"]); + + let waitFor = { + expected: [[ EVENT_REORDER, e => e.accessible == accDoc ]] + }; + + await contentSpawnMutation(browser, waitFor, function() { + document.documentElement.style.display = "none"; + document.documentElement.getBoundingClientRect(); + document.body.setAttribute("aria-owns", "b a"); + document.documentElement.remove(); + }); + + testChildrenIds(accDoc, []); + } +);