mirror of
https://github.com/HeyPuter/firefox.git
synced 2026-11-25 11:37:43 -10:00
MozReview-Commit-ID: K3twiMih7e9 Differential Revision: https://phabricator.services.mozilla.com/D15113
41 lines
1.1 KiB
JavaScript
41 lines
1.1 KiB
JavaScript
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
"use strict";
|
|
|
|
loader.lazyRequireGetter(this, "Ci", "chrome", true);
|
|
loader.lazyRequireGetter(this, "Services");
|
|
|
|
/**
|
|
* Helper function that determines if nsIAccessible object is in defunct state.
|
|
*
|
|
* @param {nsIAccessible} accessible
|
|
* object to be tested.
|
|
* @return {Boolean}
|
|
* True if accessible object is defunct, false otherwise.
|
|
*/
|
|
function isDefunct(accessible) {
|
|
// If accessibility is disabled, safely assume that the accessible object is
|
|
// now dead.
|
|
if (!Services.appinfo.accessibilityEnabled) {
|
|
return true;
|
|
}
|
|
|
|
let defunct = false;
|
|
|
|
try {
|
|
const extraState = {};
|
|
accessible.getState({}, extraState);
|
|
// extraState.value is a bitmask. We are applying bitwise AND to mask out
|
|
// irrelevant states.
|
|
defunct = !!(extraState.value & Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT);
|
|
} catch (e) {
|
|
defunct = true;
|
|
}
|
|
|
|
return defunct;
|
|
}
|
|
|
|
exports.isDefunct = isDefunct;
|