Bug 659620 - Hang when trying to edit a page on WikiMo with NVDA running, r=surkov, a=clegnitto
authorTrevor Saunders <trev.saunders@gmail.com>
Thu, 16 Jun 2011 09:34:27 +0200
changeset 70306 addb57fc93b597406ae12ea9759e9fdfdf4cce41
parent 70305 2508c3f190a6756a320e1ad025a6618bc06513d3
child 70307 e160897167a60bf675f15b6a31eaf6656b7c00f8
push id151
push usermzehe@mozilla.com
push dateThu, 16 Jun 2011 07:50:20 +0000
treeherdermozilla-aurora@addb57fc93b5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, clegnitto
bugs659620
milestone6.0a2
Bug 659620 - Hang when trying to edit a page on WikiMo with NVDA running, r=surkov, a=clegnitto
accessible/src/base/nsBaseWidgetAccessible.cpp
accessible/tests/mochitest/actions/test_general.html
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -136,17 +136,17 @@ nsLinkableAccessible::GetValue(nsAString
 }
 
 
 NS_IMETHODIMP
 nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions)
 {
   NS_ENSURE_ARG_POINTER(aNumActions);
 
-  *aNumActions = mActionAcc ? 1 : 0;
+  *aNumActions = (mIsOnclick || mIsLink) ? 1 : 0;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLinkableAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
 {
   aName.Truncate();
 
@@ -223,17 +223,16 @@ nsLinkableAccessible::BindToParent(nsAcc
   nsAccessibleWrap::BindToParent(aParent, aIndexInParent);
 
   // Cache action content.
   mActionAcc = nsnull;
   mIsLink = PR_FALSE;
   mIsOnclick = PR_FALSE;
 
   if (nsCoreUtils::HasClickListener(mContent)) {
-    mActionAcc = this;
     mIsOnclick = PR_TRUE;
     return;
   }
 
   // XXX: The logic looks broken since the click listener may be registered
   // on non accessible node in parent chain but this node is skipped when tree
   // is traversed.
   nsAccessible* walkUpAcc = this;
--- a/accessible/tests/mochitest/actions/test_general.html
+++ b/accessible/tests/mochitest/actions/test_general.html
@@ -31,19 +31,29 @@
           ID: "li_clickable2",
           actionName: "click",
           events: CLICK_EVENTS
         },
         {
           ID: "li_clickable3",
           actionName: "click",
           events: CLICK_EVENTS
+        },
+        {
+          ID: "onclick_img",
+          actionName: "click",
+          events: CLICK_EVENTS
         }
       ];
+
       testActions(actionsArray);
+
+      getAccessible("onclick_img").takeFocus();
+is(getAccessible("link1").numActions, 1, "links should have one action");
+is(getAccessible("link2").numActions, 1, "link with onclick handler should have 1 action");
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 
 <body>
@@ -53,20 +63,31 @@
      title="nsHTMLLiAccessible shouldn't be inherited from linkable accessible">
     Mozilla Bug 523789
   </a><br>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
      title="Expose click action if mouseup and mousedown are registered">
     Mozilla Bug 423409
   </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=659620"
+     title="hang when trying to edit a page on wikimo with NVDA running">
+    Mozilla Bug 659620
+  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <ul>
     <li id="li_clickable1" onclick="">Clickable list item</li>
     <li id="li_clickable2" onmousedown="">Clickable list item</li>
     <li id="li_clickable3" onmouseup="">Clickable list item</li>
   </ul>
+
+  <!-- linkable accessibles -->
+  <img id="onclick_img" onclick="" src="../moz.png">
+
+  <a id="link1" href="www">linkable textleaf accessible</a>
+  <div id="link2" onclick="">linkable textleaf accessible</div>
 </body>
 </html>