Bug 1396267 - Check that owner has content before aria-owns relocation. r=surkov
authorEitan Isaacson <eitan@monotonous.org>
Mon, 11 Sep 2017 13:56:00 -0400
changeset 429812 32268f6138e0e93ac223c863d9587ff680549764
parent 429811 9c55653c204f3ec22b996495a60938b1d3d4037b
child 429813 e58e11f74cc02a5aec2b4588190385b1980654e0
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1396267
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1396267 - Check that owner has content before aria-owns relocation. r=surkov
accessible/base/NotificationController.cpp
accessible/tests/browser/tree/browser_aria_owns.js
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -804,17 +804,18 @@ NotificationController::WillRefresh(mozi
   }
 
   // Process invalidation list of the document after all accessible tree
   // modification are done.
   mDocument->ProcessInvalidationList();
 
   // 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]);
     }
   }
   mRelocations.Clear();
 
   // If a generic notification occurs after this point then we may be allowed to
   // process it synchronously.  However we do not want to reenter if fireing
   // events causes script to run.
--- a/accessible/tests/browser/tree/browser_aria_owns.js
+++ b/accessible/tests/browser/tree/browser_aria_owns.js
@@ -142,8 +142,27 @@ addAccessibleTask(`
       // be in a good state and all is fine..
       document.getElementById("two").setAttribute("aria-owns", "a b");
     });
 
     testChildrenIds(one, ["c"]);
     testChildrenIds(two, ["a", "b"]);
   }
 );
+
+addAccessibleTask(`<div id="a"></div><div id="b"></div>`,
+  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, []);
+  }
+);