Commit 6614cdd4 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Remove event listener from invalidated node.

This is a quick fix for a small bug related to the listener for
childrenChanged events.

Bug: None
Change-Id: I72dad6423d68301597fa1728feae4f775b6e6337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013914Reviewed-by: default avatarAran Gilman <gilmanmh@google.com>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#734155}
parent bccaa89e
......@@ -211,6 +211,9 @@ class RootNodeWrapper extends SARootNode {
/** @private {!AutomationNode} */
this.baseNode_ = baseNode;
/** @private {boolean} */
this.invalidated_ = false;
/** @private {function(chrome.automation.AutomationEvent)} */
this.childrenChangedHandler_ = this.refresh_.bind(this);
......@@ -256,7 +259,11 @@ class RootNodeWrapper extends SARootNode {
/** @override */
isValidGroup() {
return !!this.baseNode_.role && super.isValidGroup();
if (!this.baseNode_.role) {
// If the underlying automation node has been invalidated, return false.
return false;
}
return !this.invalidated_ && super.isValidGroup();
}
/** @override */
......@@ -302,6 +309,8 @@ class RootNodeWrapper extends SARootNode {
try {
RootNodeWrapper.findAndSetChildren(this, childConstructor);
} catch (e) {
this.onUnfocus();
this.invalidated_ = true;
SwitchAccess.moveToValidNode();
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment