Bug 1268069 - embeded object collection may be not updated on removals, r=yzen
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 25 May 2016 15:48:45 -0400
changeset 338029 045768176a0b6d39b94d63c6c5d15b78f84050bf
parent 338028 97d4fa9f099b14a98d4242f1c73507beb1f70081
child 338030 99f8a5fcc34dd5e65d63b2a3928aa90a052cc8cc
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1268069
milestone49.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 1268069 - embeded object collection may be not updated on removals, r=yzen
accessible/base/EventTree.cpp
accessible/tests/mochitest/hypertext/test_update.html
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -151,20 +151,17 @@ TreeMutation::Done()
   }
 #endif
 
   for (uint32_t idx = mStartIdx; idx < length; idx++) {
     mParent->mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1;
     mParent->mChildren[idx]->mStateFlags |= Accessible::eGroupInfoDirty;
   }
 
-  if (mStartIdx < mParent->mChildren.Length() - 1) {
-    mParent->mEmbeddedObjCollector = nullptr;
-  }
-
+  mParent->mEmbeddedObjCollector = nullptr;
   mParent->mStateFlags |= mStateFlagsCopy & Accessible::eKidsMutating;
 
 #ifdef DEBUG
   mIsDone = true;
 #endif
 
 #ifdef A11Y_LOG
   if (mEventTree != kNoEventTree && logging::IsEnabled(logging::eEventTree)) {
--- a/accessible/tests/mochitest/hypertext/test_update.html
+++ b/accessible/tests/mochitest/hypertext/test_update.html
@@ -146,27 +146,59 @@
       }
 
       this.getID = function removeFirstChild_getID()
       {
         return "Remove first child and check embedded object indeces";
       }
     }
 
+    function removeLastChild(aContainer)
+    {
+      this.ht = getAccessible(aContainer, [ nsIAccessibleHyperText ]);
+      this.eventSeq = [
+        new invokerChecker(EVENT_REORDER, aContainer)
+      ];
+
+      this.invoke = function removeLastChild_invoke()
+      {
+        is(this.ht.linkCount, 1, "Wrong embedded objects count before removal");
+
+        getNode(aContainer).removeChild(getNode(aContainer).lastElementChild);
+      }
+
+      this.finalCheck = function removeLastChild_finalCheck()
+      {
+        is(this.ht.linkCount, 0, "Wrong embedded objects count after removal");
+
+        var link = null;
+        try {
+          link = this.ht.getLinkAt(0);
+        } catch (e) { }
+        ok(!link, "No embedded object is expected");
+      }
+
+      this.getID = function removeLastChild_getID()
+      {
+        return "Remove last child and try its embedded object";
+      }
+    }
+
     //gA11yEventDumpToConsole = true; // debug stuff
 
     var gQueue = null;
     function doTest()
     {
       gQueue = new eventQueue();
       gQueue.push(new addLinks("p1"));
       gQueue.push(new updateText("p2"));
       gQueue.push(new removeChild("div1","div2",
                                   "hello my good friend", "hello friend"));
       gQueue.push(new removeFirstChild("c4"));
+      gQueue.push(new removeLastChild("c5"));
 
       gQueue.invoke(); // Will call SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
@@ -194,10 +226,11 @@
 
   <p id="p1"></p>
   <p id="p2"><b>hello</b><a>friend</a></p>
   <div id="div1">hello<span id="div2"> my<span id="div3"> good</span></span> friend</span></div>
   <form id="c4">
     <label for="c4_input">label</label>
     <input id="c4_input">
   </form>
+  <div id="c5">TextLeaf<input id="c5_input"></div>
 </body>
 </html>