Bug 1386959 - [Form Autofill] Add probe for form autofill availability. r=lchang,francois draft
authorsteveck-chung <schung@mozilla.com>
Mon, 14 Aug 2017 11:56:19 +0800
changeset 647903 f0f8131792d70cbc4a671320b9e811ce7aee15c2
parent 647200 4e93516e92e58d166ad37b8544c3230024afb587
child 726663 65bcae37f368118c3fcedb864cf88828da23f62c
push id74576
push userbmo:schung@mozilla.com
push dateThu, 17 Aug 2017 02:33:15 +0000
reviewerslchang, francois
bugs1386959
milestone57.0a1
Bug 1386959 - [Form Autofill] Add probe for form autofill availability. r=lchang,francois MozReview-Commit-ID: KPOBxmHOiuK
browser/extensions/formautofill/bootstrap.js
toolkit/components/telemetry/Scalars.yaml
--- a/browser/extensions/formautofill/bootstrap.js
+++ b/browser/extensions/formautofill/bootstrap.js
@@ -63,16 +63,17 @@ function isAvailable() {
 }
 
 function startup(data) {
   if (!isAvailable()) {
     Services.prefs.clearUserPref("dom.forms.autocomplete.formautofill");
     // reset the sync related prefs incase the feature was previously available
     // but isn't now.
     Services.prefs.clearUserPref("services.sync.engine.addresses.available");
+    Services.telemetry.scalarSet("formautofill.availability", false);
     return;
   }
 
   if (data.hasOwnProperty("instanceID") && data.instanceID) {
     if (AddonManagerPrivate.isDBLoaded()) {
       addUpgradeListener(data.instanceID);
     } else {
       // Wait for the extension database to be loaded so we don't cause its init.
@@ -84,16 +85,17 @@ function startup(data) {
   } else {
     throw Error("no instanceID passed to bootstrap startup");
   }
 
   // This pref is used for web contents to detect the autocomplete feature.
   // When it's true, "element.autocomplete" will return tokens we currently
   // support -- otherwise it'll return an empty string.
   Services.prefs.setBoolPref("dom.forms.autocomplete.formautofill", true);
+  Services.telemetry.scalarSet("formautofill.availability", true);
 
   // This pref determines whether the "addresses" sync engine is available
   // (ie, whether it is shown in any UI etc) - it *does not* determine whether
   // the engine is actually enabled or not.
   Services.prefs.setBoolPref("services.sync.engine.addresses.available", true);
 
   // Listen for the autocomplete popup message to lazily append our stylesheet related to the popup.
   Services.mm.addMessageListener("FormAutoComplete:MaybeOpenPopup", onMaybeOpenPopup);
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -781,16 +781,31 @@ gfx.advanced.layers:
     kind: uint
     expires: "61"
     notification_emails:
       - gfx-telemetry-alerts@mozilla.com
     record_in_processes:
       - 'main'
 
 # The following section contains the form autofill related scalars.
+formautofill:
+  availability:
+    bug_numbers:
+      - 1386959
+    description: A boolean sent once per session to represent whether the formautofill is available in the build
+    expires: never
+    kind: boolean
+    notification_emails:
+      - autofill@lists.mozilla.org
+      - jcheng@mozilla.com
+      - chsiang@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
 formautofill.addresses:
   fill_type_manual:
     bug_numbers:
       - 990200
     description: Count at submission time whether the submitted form was filled manually.
     expires: never
     kind: uint
     notification_emails: