Bug 577694 - Add detection of accessibility instantiation [r=mark.finkle]
authorJono X <jdicarlo@mozilla.com>
Mon, 11 Apr 2011 22:30:44 -0400
changeset 67891 a18b849ec28534afc8df319cb57851f403acad77
parent 67890 f7a0e34308cd80f580ded151c3a10426ba3f05a8
child 67892 2a2c474ec4a12eaa9e89df55bfe613d36540aaec
push idunknown
push userunknown
push dateunknown
reviewersmark
bugs577694
milestone2.2a1pre
Bug 577694 - Add detection of accessibility instantiation [r=mark.finkle]
browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/metadata.js
--- a/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/metadata.js
+++ b/browser/app/profile/extensions/testpilot@labs.mozilla.com/modules/metadata.js
@@ -112,16 +112,29 @@ let MetadataCollector = {
 
     for (let i = 0; i < length; i++) {
       prefName = "accessibility." + children[i];
       prefValue =
         Application.prefs.getValue(prefName, "");
       accessibilities.push({ name: prefName, value: prefValue });
     }
 
+    /* Detect accessibility instantiation
+     * (David Bolter's code from bug 577694) */
+    let enabled;
+    try {
+      enabled = Components.manager.QueryInterface(Ci.nsIServiceManager)
+                  .isServiceInstantiatedByContractID(
+                    "@mozilla.org/accessibilityService;1",
+                    Ci.nsISupports);
+    } catch (ex) {
+      enabled = false;
+    }
+    accessibilities.push({name: "isInstantiated", value: enabled});
+
     return accessibilities;
   },
 
   getLocation: function MetadataCollector_getLocation() {
     // we don't want the lat/long, we just want the country
     // so use the Locale.
     return Application.prefs.getValue(LOCALE_PREF, "");
   },