Bug 1374289 - Click-to-play rollout: stop watching for pref changes after the first change has been noticed. r=bsmedberg
authorFelipe Gomes <felipc@gmail.com>
Wed, 21 Jun 2017 15:36:41 -0300
changeset 404425 169fc55f0e8a0af033af153a7df93437f9b66eae
parent 404424 ba747e6f311fc8d89b2d681aa0c1802a7569f187
child 404426 114ccfb493914f914a2ce4c8a1e9317e58c2c9cd
push id57
push userfmarier@mozilla.com
push dateSat, 24 Jun 2017 00:05:50 +0000
reviewersbsmedberg
bugs1374289
milestone56.0a1
Bug 1374289 - Click-to-play rollout: stop watching for pref changes after the first change has been noticed. r=bsmedberg MozReview-Commit-ID: 367MfF0INfV
browser/extensions/clicktoplay-rollout/bootstrap.js
browser/extensions/clicktoplay-rollout/install.rdf.in
--- a/browser/extensions/clicktoplay-rollout/bootstrap.js
+++ b/browser/extensions/clicktoplay-rollout/bootstrap.js
@@ -125,19 +125,20 @@ function setCohort(cohortName) {
   try {
     if (Ci.nsICrashReporter) {
       Services.appinfo.QueryInterface(Ci.nsICrashReporter).annotateCrashReport("CTPCohort", cohortName);
     }
   } catch (e) {}
 }
 
 function watchForPrefChanges() {
-  Preferences.observe(PREF_FLASH_STATE, function() {
+  Preferences.observe(PREF_FLASH_STATE, function prefWatcher() {
     let currentCohort = Preferences.get(PREF_COHORT_NAME, "unknown");
     setCohort(`user-changed-from-${currentCohort}`);
+    Preferences.ignore(PREF_FLASH_STATE, prefWatcher);
   });
 }
 
 function install() {
 }
 
 function shutdown(data, reason) {
 }
--- a/browser/extensions/clicktoplay-rollout/install.rdf.in
+++ b/browser/extensions/clicktoplay-rollout/install.rdf.in
@@ -5,17 +5,17 @@
 
 #filter substitution
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>clicktoplay-rollout@mozilla.org</em:id>
-    <em:version>1.1</em:version>
+    <em:version>1.2</em:version>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
     <em:multiprocessCompatible>true</em:multiprocessCompatible>
 
     <!-- Target Application this theme can install into,
         with minimum and maximum supported versions. -->
     <em:targetApplication>
       <Description>