Bug 1599875 - handle cases where async operations within the accessibility related actors run while the actors get destroyed. r=nchevobbe

Depends on D55145

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Yura Zenevich 2019-11-29 08:05:12 +00:00
Родитель 3967a2e27c
Коммит ac5c8a1892
2 изменённых файлов: 18 добавлений и 1 удалений

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

@ -193,7 +193,7 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, {
},
get isDestroyed() {
return this.actorID == null;
return this.walker == null || this.actorID == null;
},
get role() {
@ -369,6 +369,10 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, {
}
const doc = await this.walker.getDocument();
if (this.isDestroyed) {
// This accessible actor is destroyed.
return relationObjects;
}
relations.forEach(relation => {
if (RELATIONS_TO_IGNORE.has(relation.relationType)) {
return;
@ -475,6 +479,10 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, {
appliedColorMatrix: this.walker.colorMatrix,
});
if (this.isDestroyed) {
// This accessible actor is destroyed.
return null;
}
walker.restoreStyles(win);
return contrastRatio;

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

@ -23,6 +23,12 @@ loader.lazyRequireGetter(
"nodeConstants",
"devtools/shared/dom-node-constants"
);
loader.lazyRequireGetter(
this,
"isDefunct",
"devtools/server/actors/utils/accessibility",
true
);
const {
accessibility: {
@ -483,6 +489,9 @@ function tabIndexRule(accessible) {
}
function auditKeyboard(accessible) {
if (isDefunct(accessible)) {
return null;
}
// Do not test anything on accessible objects for documents or frames.
if (
accessible.role === Ci.nsIAccessibleRole.ROLE_DOCUMENT ||