diff --git a/accessible/ipc/RemoteAccessibleBase.cpp b/accessible/ipc/RemoteAccessibleBase.cpp index 949696a05727..eedd0cffa197 100644 --- a/accessible/ipc/RemoteAccessibleBase.cpp +++ b/accessible/ipc/RemoteAccessibleBase.cpp @@ -696,12 +696,27 @@ nsTArray RemoteAccessibleBase::PreProcessRelations( AccAttributes* aFields) { nsTArray updateTracker(ArrayLength(kRelationTypeAtoms)); for (auto const& data : kRelationTypeAtoms) { - if (data.mValidTag && TagName() != data.mValidTag) { - // If the relation we're currently processing only applies to specific - // elements, and we are not one of them, do no pre-processing. Also, - // note in our updateTracker that we should do no post-processing. - updateTracker.AppendElement(false); - continue; + if (data.mValidTag) { + // The relation we're currently processing only applies to particular + // elements. Check to see if we're one of them. + nsAtom* tag = TagName(); + if (!tag) { + // TagName() returns null on an initial cache push -- check aFields + // for a tag name instead. + if (auto maybeTag = + aFields->GetAttribute>(nsGkAtoms::tag)) { + tag = *maybeTag; + } + } + MOZ_ASSERT( + tag || IsTextLeaf(), + "Could not fetch tag via TagName() or from initial cache push!"); + if (tag != data.mValidTag) { + // If this rel doesn't apply to us, do no pre-processing. Also, + // note in our updateTracker that we should do no post-processing. + updateTracker.AppendElement(false); + continue; + } } nsStaticAtom* const relAtom = data.mAtom; diff --git a/accessible/tests/browser/e10s/browser_caching_relations.js b/accessible/tests/browser/e10s/browser_caching_relations.js index b0625d002eaf..91e320bd8b9b 100644 --- a/accessible/tests/browser/e10s/browser_caching_relations.js +++ b/accessible/tests/browser/e10s/browser_caching_relations.js @@ -264,3 +264,18 @@ addAccessibleTask( }, { iframe: true, remoteIframe: true } ); + +/** + * Test rel caching for