Bug 1555310 - remove unused variables in MockProvider r=robwu
authorabowler2 <abowler2@gmail.com>
Mon, 23 Sep 2019 22:11:18 +0000
changeset 494639 2340335f5458aa016e027e911a376db0987db1a7
parent 494638 6a1f7dcb1266d47857db1895ca9cc12ca9eeff45
child 494640 d508d856dfc6d5303e6ddd62c1d1b36cbcd5661a
push id96137
push usercsabou@mozilla.com
push dateTue, 24 Sep 2019 03:25:32 +0000
treeherderautoland@2340335f5458 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobwu
bugs1555310
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1555310 - remove unused variables in MockProvider r=robwu Differential Revision: https://phabricator.services.mozilla.com/D46546
toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js
toolkit/mozapps/extensions/test/browser/browser_webapi_enable.js
toolkit/mozapps/extensions/test/browser/head.js
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_addon_listener.js
@@ -12,17 +12,17 @@ async function getListenerEvents(browser
 
   return result.split("\n").map(JSON.parse);
 }
 
 const RESTARTLESS_ID = "restartless@tests.mozilla.org";
 const INSTALL_ID = "install@tests.mozilla.org";
 const CANCEL_ID = "cancel@tests.mozilla.org";
 
-let provider = new MockProvider(false);
+let provider = new MockProvider();
 provider.createAddons([
   {
     id: RESTARTLESS_ID,
     name: "Restartless add-on",
     operationsRequiringRestart: AddonManager.OP_NEED_RESTART_NONE,
   },
   {
     id: CANCEL_ID,
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_enable.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_enable.js
@@ -10,17 +10,17 @@ async function getListenerEvents(browser
     return content.document.getElementById("result").textContent;
   });
 
   return result.split("\n").map(JSON.parse);
 }
 
 const ID = "test@tests.mozilla.org";
 
-let provider = new MockProvider(false);
+let provider = new MockProvider();
 provider.createAddons([
   {
     id: ID,
     name: "Test add-on",
     operationsRequiringRestart: AddonManager.OP_NEED_RESTART_NONE,
   },
 ]);
 
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -726,55 +726,45 @@ function addCertOverrides() {
       "expired.example.com",
       Ci.nsICertOverrideService.ERROR_TIME
     ),
   ]);
 }
 
 /** *** Mock Provider *****/
 
-function MockProvider(aUseAsyncCallbacks, aTypes) {
+function MockProvider() {
   this.addons = [];
   this.installs = [];
-  this.callbackTimers = [];
-  this.timerLocations = new Map();
-  this.useAsyncCallbacks =
-    aUseAsyncCallbacks === undefined ? true : aUseAsyncCallbacks;
-  this.types =
-    aTypes === undefined
-      ? [
-          {
-            id: "extension",
-            name: "Extensions",
-            uiPriority: 4000,
-            flags:
-              AddonManager.TYPE_UI_VIEW_LIST |
-              AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL,
-          },
-        ]
-      : aTypes;
+  this.types = [
+    {
+      id: "extension",
+      name: "Extensions",
+      uiPriority: 4000,
+      flags:
+        AddonManager.TYPE_UI_VIEW_LIST |
+        AddonManager.TYPE_SUPPORTS_UNDO_RESTARTLESS_UNINSTALL,
+    },
+  ];
 
   var self = this;
   registerCleanupFunction(function() {
     if (self.started) {
       self.unregister();
     }
   });
 
   this.register();
 }
 
 MockProvider.prototype = {
   addons: null,
   installs: null,
   started: null,
   apiDelay: 10,
-  callbackTimers: null,
-  timerLocations: null,
-  useAsyncCallbacks: null,
   types: null,
 
   /** *** Utility functions *****/
 
   /**
    * Register this provider with the AddonManager
    */
   register: function MP_register() {
@@ -963,36 +953,16 @@ MockProvider.prototype = {
   startup: function MP_startup() {
     this.started = true;
   },
 
   /**
    * Called when the provider should shutdown.
    */
   shutdown: function MP_shutdown() {
-    if (this.callbackTimers.length) {
-      info(
-        "MockProvider: pending callbacks at shutdown(): calling immediately"
-      );
-    }
-    while (this.callbackTimers.length) {
-      // When we notify the callback timer, it removes itself from our array
-      let timer = this.callbackTimers[0];
-      try {
-        let setAt = this.timerLocations.get(timer);
-        info("Notifying timer set at " + (setAt || "unknown location"));
-        timer.callback.notify(timer);
-        timer.cancel();
-      } catch (e) {
-        info("Timer notify failed: " + e);
-      }
-    }
-    this.callbackTimers = [];
-    this.timerLocations = null;
-
     this.started = false;
   },
 
   /**
    * Called to get an Addon with a particular ID.
    *
    * @param  aId
    *         The ID of the add-on to retrieve