Bug 1090450 - Properly check add-on update state during update interval. r=Mossop, a=lmandel
authorJ. Ryan Stinnett <jryans@gmail.com>
Tue, 28 Oct 2014 20:26:00 -0400
changeset 225891 06d2090db817
parent 225890 340cfd2affa7
child 225892 546105a6d5c0
push id4059
push userryanvm@gmail.com
push date2014-10-31 21:13 +0000
treeherdermozilla-beta@631a73cdbc91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMossop, lmandel
bugs1090450, 995108
milestone34.0
Bug 1090450 - Properly check add-on update state during update interval. r=Mossop, a=lmandel A refactoring in bug 995108 inadvertently disabled background add-on updates by moving the timer handler to AddonManagerPrivate without fixing the values the method uses to point to meaningful locations.
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -2413,21 +2413,21 @@ this.AddonManagerPrivate = {
   },
 
   backgroundUpdateCheck: function AMP_backgroundUpdateCheck() {
     return AddonManagerInternal.backgroundUpdateCheck();
   },
 
   backgroundUpdateTimerHandler() {
     // Don't call through to the real update check if no checks are enabled.
-    let checkHotfix = this.hotfixID &&
+    let checkHotfix = AddonManagerInternal.hotfixID &&
                       Services.prefs.getBoolPref(PREF_APP_UPDATE_ENABLED) &&
                       Services.prefs.getBoolPref(PREF_APP_UPDATE_AUTO);
 
-    if (!this.updateEnabled && !checkHotfix) {
+    if (!AddonManagerInternal.updateEnabled && !checkHotfix) {
       logger.info("Skipping background update check");
       return;
     }
     // Don't return the promise here, since the caller doesn't care.
     AddonManagerInternal.backgroundUpdateCheck();
   },
 
   addStartupChange: function AMP_addStartupChange(aType, aID) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
@@ -39,17 +39,18 @@ function run_test_1() {
     do_check_eq(aAddons.length, 0);
 
     Services.obs.addObserver(function() {
       Services.obs.removeObserver(arguments.callee, "addons-background-update-complete");
 
       do_execute_soon(run_test_2);
     }, "addons-background-update-complete", false);
 
-    AddonManagerPrivate.backgroundUpdateCheck();
+    // Trigger the background update timer handler
+    gInternalManager.notify(null);
   });
 }
 
 // Verify that with two add-ons installed both of which claim to have updates
 // available we get the notification after both updates attempted to start
 function run_test_2() {
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
@@ -115,10 +116,11 @@ function run_test_2() {
       completeCount++;
       if (completeCount == 3) {
         do_check_true(sawCompleteNotification);
         end_test();
       }
     }
   });
 
-  AddonManagerPrivate.backgroundUpdateCheck();
+  // Trigger the background update timer handler
+  gInternalManager.notify(null);
 }