Bug 1374289 - Click-to-play rollout: stop watching for pref changes after the first change has been noticed. r=bsmedberg draft
authorFelipe Gomes <felipc@gmail.com>
Wed, 21 Jun 2017 15:36:41 -0300
changeset 598501 b79572d53503d9f8e3ab9b5644fd94576a5e46a4
parent 598405 6779547fa0fca357851739ebee9bfd461675c7aa
child 634483 7e8d779c44ae2fc6468aee73160165c3bf33ce7f
push id65211
push userfelipc@gmail.com
push dateWed, 21 Jun 2017 18:37:01 +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>