Commit 3ba3aebc authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Fix behavior on login screen

This change allows Switch Access users to navigate the login screen and
enter their password by fixing two bugs.

1. On the login screen, there were two copies of Switch Access running.
2. Pending childrenChanged events were being fired on the DesktopNode
   after it was no longer focused.

AX-Relnotes: n/a.
Bug: 1121260
Change-Id: Ia4ef3791fbf5480003ded0b1de70dd4df1f5b9d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2378891Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#802446}
parent 27c4613d
......@@ -52,9 +52,18 @@ class RepeatedEventHandler {
/** @private {boolean} */
this.capture_ = options.capture || false;
/** @private {boolean} */
this.listening_ = false;
/** @private {!function(!chrome.automation.AutomationEvent)} */
this.handler_ = this.onEvent_.bind(this);
this.startListening();
}
/** Starts listening or handling events. */
startListening() {
this.listening_ = true;
for (const node of this.nodes_) {
node.addEventListener(this.type_, this.handler_, this.capture_);
}
......@@ -62,6 +71,7 @@ class RepeatedEventHandler {
/** Stops listening or handling future events. */
stopListening() {
this.listening_ = false;
for (const node of this.nodes_) {
node.removeEventListener(this.type_, this.handler_, this.capture_);
}
......@@ -78,7 +88,7 @@ class RepeatedEventHandler {
/** @private */
handleEvent_() {
if (this.eventStack_.length === 0) {
if (!this.listening_ || this.eventStack_.length === 0) {
return;
}
......
......@@ -2,4 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// In 'split' manifest mode, the extension system runs two copies of the
// extension. One in an incognito context; the other not. In guest mode, the
// extension system runs only the extension in an incognito context. To prevent
// doubling of this extension, only continue for one context.
const manifest =
/** @type {{incognito: (string|undefined)}} */ (
chrome.runtime.getManifest());
if (manifest.incognito == 'split' && !chrome.extension.inIncognitoContext) {
window.close();
}
SwitchAccess.initialize();
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