Bug 1534287 - Catch exception when sending a11y event when platform a11y is disabled. r=geckoview-reviewers,snorp

Differential Revision: https://phabricator.services.mozilla.com/D59419

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eitan Isaacson 2020-01-10 15:35:06 +00:00
Родитель e5ff62b3c3
Коммит 20e563fc1c
1 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -751,13 +751,6 @@ public class SessionAccessibility {
return; return;
} }
if (!Settings.isPlatformEnabled() && !isInTest()) {
// Accessibility could be activated in Gecko via xpcom, for example when using a11y
// devtools. Here we assure that either Android a11y is *really* enabled, or no
// display is attached and we must be in a junit test.
return;
}
GeckoBundle cachedBundle = getMostRecentBundle(sourceId); GeckoBundle cachedBundle = getMostRecentBundle(sourceId);
if (cachedBundle == null && sourceId != View.NO_ID) { if (cachedBundle == null && sourceId != View.NO_ID) {
// Suppress events from non cached nodes. // Suppress events from non cached nodes.
@ -857,7 +850,12 @@ public class SessionAccessibility {
break; break;
} }
((ViewParent) mView).requestSendAccessibilityEvent(mView, event); try {
((ViewParent) mView).requestSendAccessibilityEvent(mView, event);
} catch (IllegalStateException ex) {
// Accessibility could be activated in Gecko via xpcom, for example when using a11y
// devtools. Events that are forwarded to the platform will throw an exception.
}
} }
private synchronized GeckoBundle getMostRecentBundle(final int virtualViewId) { private synchronized GeckoBundle getMostRecentBundle(final int virtualViewId) {