Bug 1431274 - Move the "Allow Firefox to install and run studies" checkbox to the below of the "Allow Nightly to send technical and interaction data to Mozilla" checkbox to match spec. draft
authorEvan Tseng <evan@tseng.io>
Thu, 18 Jan 2018 10:06:46 +0800
changeset 721900 0f9b096e94a741c205e3efd2ede604e3e5ec2fff
parent 721830 b7a651281314d6369658eeb58e3bb181cf95016f
child 746476 a8b85107af620062632d0e2ee2781712178f5805
push id95991
push userbmo:evan@tseng.io
push dateThu, 18 Jan 2018 02:14:36 +0000
bugs1431274
milestone59.0a1
Bug 1431274 - Move the "Allow Firefox to install and run studies" checkbox to the below of the "Allow Nightly to send technical and interaction data to Mozilla" checkbox to match spec. MozReview-Commit-ID: S3vrVmtILl
browser/extensions/shield-recipe-client/lib/ShieldPreferences.jsm
--- a/browser/extensions/shield-recipe-client/lib/ShieldPreferences.jsm
+++ b/browser/extensions/shield-recipe-client/lib/ShieldPreferences.jsm
@@ -104,17 +104,18 @@ this.ShieldPreferences = {
     hContainer.setAttribute("align", "center");
     container.appendChild(hContainer);
 
     const checkbox = doc.createElementNS(XUL_NS, "checkbox");
     checkbox.setAttribute("id", "optOutStudiesEnabled");
     checkbox.setAttribute("class", "tail-with-learn-more");
     checkbox.setAttribute("label", "Allow Firefox to install and run studies");
     checkbox.setAttribute("preference", OPT_OUT_STUDIES_ENABLED_PREF);
-    checkbox.setAttribute("disabled", !Services.prefs.getBoolPref(FHR_UPLOAD_ENABLED_PREF));
+    checkbox.setAttribute("disabled", Services.prefs.prefIsLocked(FHR_UPLOAD_ENABLED_PREF) ||
+      !AppConstants.MOZ_TELEMETRY_REPORTING);
     hContainer.appendChild(checkbox);
 
     const viewStudies = doc.createElementNS(XUL_NS, "label");
     viewStudies.setAttribute("id", "viewShieldStudies");
     viewStudies.setAttribute("href", "about:studies");
     viewStudies.setAttribute("useoriginprincipal", true);
     viewStudies.textContent = "View Firefox Studies";
     viewStudies.classList.add("learnMore", "text-link");
@@ -132,12 +133,12 @@ this.ShieldPreferences = {
     const fhrPref = doc.defaultView.Preferences.add({ id: FHR_UPLOAD_ENABLED_PREF, type: "bool" });
     fhrPref.on("change", function(event) {
       // Avoid reference to the document directly, to avoid leaks.
       const eventTargetCheckbox = event.target.ownerDocument.getElementById("optOutStudiesEnabled");
       eventTargetCheckbox.disabled = !Services.prefs.getBoolPref(FHR_UPLOAD_ENABLED_PREF);
     });
 
     // Actually inject the elements we've created.
-    const parent = doc.getElementById("submitHealthReportBox").closest("vbox");
+    const parent = doc.getElementById("submitHealthReportBox").closest("description");
     parent.appendChild(container);
   },
 };