Backed out changeset edbaacc4f3d6 (bug 1455416) for ContentCache crashes a=backout

This commit is contained in:
Noemi Erli 2023-05-16 00:55:24 +03:00
Родитель 71d235742a
Коммит ce43b5ee97
3 изменённых файлов: 11 добавлений и 117 удалений

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

@ -2405,11 +2405,6 @@ void DocAccessible::PutChildrenBack(
LocalAccessible* origContainer =
AccessibleOrTrueContainer(content->GetFlattenedTreeParentNode());
if (origContainer) {
// If the target container isn't in the document, there's no need to
// determine where the child should go for relocation. We can move on.
if (!origContainer->IsInDocument()) {
continue;
}
TreeWalker walker(origContainer);
if (walker.Seek(content)) {
LocalAccessible* prevChild = walker.Prev();
@ -2601,24 +2596,19 @@ void DocAccessible::UncacheChildrenInSubtree(LocalAccessible* aRoot) {
CachedTableAccessible::Invalidate(aRoot);
}
// Put relocated children back in their original places instead of removing
// them from the tree.
nsTArray<RefPtr<LocalAccessible>>* owned = mARIAOwnsHash.Get(aRoot);
if (owned) {
PutChildrenBack(owned, 0);
MOZ_ASSERT(owned->IsEmpty(),
"Owned Accessibles should be cleared after PutChildrenBack.");
mARIAOwnsHash.Remove(aRoot);
owned = nullptr;
}
const uint32_t count = aRoot->ContentChildCount();
for (uint32_t idx = 0; idx < count; ++idx) {
uint32_t count = aRoot->ContentChildCount();
for (uint32_t idx = 0; idx < count; idx++) {
LocalAccessible* child = aRoot->ContentChildAt(idx);
MOZ_ASSERT(!child->IsRelocated(),
"No children should be relocated here. They should all have "
"been relocated by PutChildrenBack.");
if (child->IsRelocated()) {
MOZ_ASSERT(owned, "IsRelocated flag is out of sync with mARIAOwnsHash");
owned->RemoveElement(child);
if (owned->Length() == 0) {
mARIAOwnsHash.Remove(aRoot);
owned = nullptr;
}
}
// Removing this accessible from the document doesn't mean anything about
// accessibles for subdocuments, so skip removing those from the tree.

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

@ -323,99 +323,3 @@ addAccessibleTask(
});
}
);
// Verify that removing the parent of a DOM-sibling aria-owned child keeps the
// formerly-owned child in the tree.
addAccessibleTask(
`<input id='x'></input><div aria-owns='x'></div>`,
async function(browser, accDoc) {
testAccessibleTree(accDoc, {
DOCUMENT: [{ SECTION: [{ ENTRY: [] }] }],
});
info("Removing the div that aria-owns a DOM sibling");
let onReorder = waitForEvent(EVENT_REORDER, accDoc);
await invokeContentTask(browser, [], () => {
content.document.querySelector("div").remove();
});
await onReorder;
info("Verifying that the formerly-owned child is still present");
testAccessibleTree(accDoc, {
DOCUMENT: [{ ENTRY: [] }],
});
},
{ chrome: true, iframe: true, remoteIframe: true }
);
// Verify that removing the parent of multiple DOM-sibling aria-owned children
// keeps all formerly-owned children in the tree.
addAccessibleTask(
`<input id='x'></input><input id='y'><div aria-owns='x y'></div>`,
async function(browser, accDoc) {
testAccessibleTree(accDoc, {
DOCUMENT: [
{
SECTION: [{ ENTRY: [] }, { ENTRY: [] }],
},
],
});
info("Removing the div that aria-owns DOM siblings");
let onReorder = waitForEvent(EVENT_REORDER, accDoc);
await invokeContentTask(browser, [], () => {
content.document.querySelector("div").remove();
});
await onReorder;
info("Verifying that the formerly-owned children are still present");
testAccessibleTree(accDoc, {
DOCUMENT: [{ ENTRY: [] }, { ENTRY: [] }],
});
},
{ chrome: true, iframe: true, remoteIframe: true }
);
// Verify that reordering owned elements by changing the aria-owns attribute
// properly reorders owned elements.
addAccessibleTask(
`
<div id="container" aria-owns="b d c a">
<div id="a" role="button"></div>
<div id="b" role="checkbox"></div>
</div>
<div id="c" role="radio"></div>
<div id="d"></div>`,
async function(browser, accDoc) {
testAccessibleTree(accDoc, {
DOCUMENT: [
{
SECTION: [
{ CHECKBUTTON: [] }, // b
{ SECTION: [] }, // d
{ RADIOBUTTON: [] }, // c
{ PUSHBUTTON: [] }, // a
],
},
],
});
info("Removing the div that aria-owns other elements");
let onReorder = waitForEvent(EVENT_REORDER, accDoc);
await invokeContentTask(browser, [], () => {
content.document.querySelector("#container").remove();
});
await onReorder;
info(
"Verify DOM children are removed, order of remaining elements is correct"
);
testAccessibleTree(accDoc, {
DOCUMENT: [
{ RADIOBUTTON: [] }, // c
{ SECTION: [] }, // d
],
});
},
{ chrome: true, iframe: true, remoteIframe: true }
);

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

@ -654,7 +654,7 @@
this.finalCheck = () => {
let tree =
{ SECTION: [ // t10_container
{ ENTRY: [] }, // t10_child
// { ENTRY: [] }, // t10_child
{ PARAGRAPH: [] },
] };
testAccessibleTree("t10_container", tree);