Bug 1265202 - Install mozscreenshots as a temporary add-on. r=bgrins draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Sat, 16 Apr 2016 17:29:36 -0700
changeset 352325 6e1630e05c9e9e693f107cae111bf8c3df0e5ebe
parent 352324 b4efa0777048fe4c5ba4599381eff4da385b7311
child 518635 653c6b327b4500847aa0465fc1e8fca18eb2b855
push id15675
push usermozilla@noorenberghe.ca
push dateSun, 17 Apr 2016 00:30:15 +0000
reviewersbgrins
bugs1265202
milestone48.0a1
Bug 1265202 - Install mozscreenshots as a temporary add-on. r=bgrins MozReview-Commit-ID: 2qw2KY1AHb0
browser/tools/mozscreenshots/head.js
browser/tools/mozscreenshots/mozscreenshots/extension/Makefile.in
--- a/browser/tools/mozscreenshots/head.js
+++ b/browser/tools/mozscreenshots/head.js
@@ -1,21 +1,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {AddonWatcher} = Cu.import("resource://gre/modules/AddonWatcher.jsm", {});
+const chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
 const env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
+const EXTENSION_DIR = "chrome://mochitests/content/extensions/mozscreenshots/browser/";
+
 let TestRunner;
 
-function setup() {
+function* setup() {
   requestLongerTimeout(20);
 
+  info("installing extension temporarily");
+  let chromeURL = Services.io.newURI(EXTENSION_DIR, null, null);
+  let dir = chromeRegistry.convertChromeURL(chromeURL).QueryInterface(Ci.nsIFileURL).file;
+  yield AddonManager.installTemporaryAddon(dir);
+
   info("Checking for mozscreenshots extension");
   return new Promise((resolve) => {
     AddonManager.getAddonByID("mozscreenshots@mozilla.org", function(aAddon) {
       isnot(aAddon, null, "The mozscreenshots extension should be installed");
       AddonWatcher.ignoreAddonPermanently(aAddon.id);
       TestRunner = Cu.import("chrome://mozscreenshots/content/TestRunner.jsm", {}).TestRunner;
       resolve();
     });
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/Makefile.in
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/Makefile.in
@@ -1,12 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 TEST_EXTENSIONS_DIR = $(DEPTH)/_tests/testing/mochitest/extensions
-GENERATED_DIRS =  $(TEST_EXTENSIONS_DIR)
+GENERATED_DIRS = $(TEST_EXTENSIONS_DIR)
 XPI_PKGNAME = mozscreenshots@mozilla.org
 
 include $(topsrcdir)/config/rules.mk
 
 libs::
 	(cd $(DIST)/xpi-stage && tar $(TAR_CREATE_FLAGS) - $(XPI_NAME)) | (cd $(TEST_EXTENSIONS_DIR) && tar -xf -)