From e90eb53ff118c329d55199ff6d59484cf7f6810f Mon Sep 17 00:00:00 2001 From: Yura Zenevich Date: Wed, 24 Aug 2016 15:52:20 -0400 Subject: [PATCH] Bug 1258960 - use getters in marionette accessibility states structure to avoid Ci.nsIAccessibleStates undefined errors in builds with accessibility disabled. r=whimboo MozReview-Commit-ID: 2SMM5AS0cVr --HG-- extra : rebase_source : 5b9db7f8e6b326a981641aa7d21fbfb4c40f44bc --- testing/marionette/accessibility.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/testing/marionette/accessibility.js b/testing/marionette/accessibility.js index 6de45b1c192e..b8e7e4c7b08e 100644 --- a/testing/marionette/accessibility.js +++ b/testing/marionette/accessibility.js @@ -41,12 +41,23 @@ this.accessibility = {}; /** * Accessible states used to check element"s state from the accessiblity API * perspective. + * Note: if gecko is built with --disable-accessibility, the interfaces are not + * defined. This is why we use getters instead to be able to use these + * statically. */ accessibility.State = { - Unavailable: Ci.nsIAccessibleStates.STATE_UNAVAILABLE, - Focusable: Ci.nsIAccessibleStates.STATE_FOCUSABLE, - Selectable: Ci.nsIAccessibleStates.STATE_SELECTABLE, - Selected: Ci.nsIAccessibleStates.STATE_SELECTED, + get Unavailable() { + return Ci.nsIAccessibleStates.STATE_UNAVAILABLE; + }, + get Focusable() { + return Ci.nsIAccessibleStates.STATE_FOCUSABLE; + }, + get Selectable() { + return Ci.nsIAccessibleStates.STATE_SELECTABLE; + }, + get Selected() { + return Ci.nsIAccessibleStates.STATE_SELECTED; + } }; /**