Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Backed out changeset 7c05090a2cd0 (bug 1342433) for failing browser_t…
Browse files Browse the repository at this point in the history
…reeupdate_listener.js. r=backout
  • Loading branch information
Archaeopteryx committed Mar 15, 2017
1 parent 8cc3111 commit c9a4fdd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
17 changes: 10 additions & 7 deletions accessible/base/nsAccessibilityService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,16 @@ nsAccessibilityService::ListenersChanged(nsIArray* aEventChanges)
nsIDocument* ownerDoc = node->OwnerDoc();
DocAccessible* document = GetExistingDocAccessible(ownerDoc);

// Create an accessible for a inaccessible element having click event
// handler.
if (document && !document->HasAccessible(node) &&
nsCoreUtils::HasClickListener(node)) {
nsIContent* parentEl = node->GetFlattenedTreeParent();
if (parentEl) {
document->ContentInserted(parentEl, node, node->GetNextSibling());
// Always recreate for onclick changes.
if (document) {
if (nsCoreUtils::HasClickListener(node)) {
if (!document->GetAccessible(node)) {
document->RecreateAccessible(node);
}
} else {
if (document->GetAccessible(node)) {
document->RecreateAccessible(node);
}
}
break;
}
Expand Down
8 changes: 3 additions & 5 deletions accessible/tests/mochitest/treeupdate/test_bug1175913.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
function testRemoveListener()
{
this.eventSeq = [
new unexpectedInvokerChecker(EVENT_HIDE, getNode("parent")),
new invokerChecker(EVENT_HIDE, getNode("parent")),
];

this.invoke = function testRemoveListener_invoke()
Expand All @@ -57,10 +57,8 @@

this.finalCheck = function testRemoveListener_finalCheck()
{
ok(getAccessible("parent", null, null, DONOTFAIL_IF_NO_ACC),
"Parent stays accessible after click event listener is removed");
ok(!getAccessible("child", null, null, DONOTFAIL_IF_NO_ACC),
"Child stays inaccessible");
is(getAccessible("parent", null, null, DONOTFAIL_IF_NO_ACC), null, "Check that parent is not accessible.");
is(getAccessible("child", null, null, DONOTFAIL_IF_NO_ACC), null, "Check that child is not accessible.");
}

this.getID = function testRemoveListener_getID()
Expand Down
23 changes: 14 additions & 9 deletions accessible/tests/mochitest/treeupdate/test_textleaf.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,22 @@
var node = getNode(aID);
node.setAttribute("onclick", "alert(3);");
var textLeaf = getAccessible(node).firstChild;
is(textLeaf.actionCount, 1, "setOnClickAttr: wrong action numbers!");
is(textLeaf.actionCount, 1, "Wrong action numbers!");
}

function removeOnClickAttr(aID)
{
let node = getNode(aID);
node.removeAttribute("onclick");
let textLeaf = getAccessible(node).firstChild;
is(textLeaf.actionCount, 0,
"removeOnClickAttr: wrong action numbers!");
this.__proto__ = new textLeafUpdate(aID, false);

this.invoke = function removeOnClickAttr_invoke()
{
this.node.removeAttribute("onclick");
}

this.getID = function removeOnClickAttr_getID()
{
return "unmake " + prettyName(aID) + " linkable";
}
}

function setOnClickNRoleAttrs(aID)
Expand Down Expand Up @@ -123,11 +129,10 @@
{
// adds onclick on element, text leaf should inherit its action
setOnClickAttr("div");
// remove onclick attribute, text leaf shouldn't have any action
removeOnClickAttr("div");

// Call rest of event tests.
gQueue = new eventQueue();
// remove onclick attribute, text leaf shouldn't have any action
gQueue.push(new removeOnClickAttr("div"));

// set onclick attribute making span accessible, it's inserted into tree
// and adopts text leaf accessible, text leaf should have an action
Expand Down

0 comments on commit c9a4fdd

Please sign in to comment.