Bug 1508664 - Avoid importing Extension.jsm too early r=kmag a=test-only
authorAndrew Swan <aswan@mozilla.com>
Fri, 14 Dec 2018 16:29:38 -0800
changeset 509003 17686e2a8e1057e9a968df2398d8789808556430
parent 509002 d2bd2bb0c329208ce96e3c6fcb5e741f88c35227
child 509004 e1ec36f44f7309e240c3688e4f60665385789fb5
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag, test-only
bugs1508664
milestone65.0
Bug 1508664 - Avoid importing Extension.jsm too early r=kmag a=test-only The test failure from this bug was due to code that reads Services.appinfo running too early before our test code that overrides appinfo got a chance to run. Addon Manager test code could use a more thorough cleanup pass, but this is a quick-and-dirty fix suitable for uplifting in the short term. Differential Revision: https://phabricator.services.mozilla.com/D14656
toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -18,21 +18,20 @@ ChromeUtils.import("resource://gre/modul
 ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/Timer.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {EventEmitter} = ChromeUtils.import("resource://gre/modules/EventEmitter.jsm", {});
 const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm", {});
 
-
 ChromeUtils.defineModuleGetter(this, "AMTelemetry",
                                "resource://gre/modules/AddonManager.jsm");
-ChromeUtils.defineModuleGetter(this, "Extension",
-                               "resource://gre/modules/Extension.jsm");
+ChromeUtils.defineModuleGetter(this, "ExtensionTestCommon",
+                               "resource://testing-common/ExtensionTestCommon.jsm");
 XPCOMUtils.defineLazyGetter(this, "Management", () => {
   let {Management} = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
   return Management;
 });
 
 ChromeUtils.defineModuleGetter(this, "FileTestUtils",
                                "resource://testing-common/FileTestUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "HttpServer",
@@ -1127,21 +1126,21 @@ var AddonTestUtils = {
   },
 
   /**
    * Creates an XPI file for some WebExtension data in the temporary directory and
    * returns the nsIFile for it. The file will be deleted when the test completes.
    *
    * @param {Object} data
    *        The object holding data about the add-on, as expected by
-   *        |Extension.generateXPI|.
+   *        |ExtensionTestCommon.generateXPI|.
    * @return {nsIFile} A file pointing to the created XPI file
    */
   createTempWebExtensionFile(data) {
-    let file = Extension.generateXPI(data);
+    let file = ExtensionTestCommon.generateXPI(data);
     this.tempXPIs.push(file);
     return file;
   },
 
   /**
    * Creates an XPI with the given files and installs it.
    *
    * @param {object} files