Bug 1525762: Part 1k - Update mozscreenshots to use AddonManager rather than LightweightThemeManager. r=MattN
authorKris Maglione <maglione.k@gmail.com>
Thu, 21 Mar 2019 13:06:24 -0700
changeset 466970 e289c1b047d7e2c02845decf7618f31bf145dea6
parent 466969 7c7df3ee8aaa9367dfc9715edd95586acfb2627a
child 466971 f31ce378439a073fb7a54c44ffe5dc68e1c03b77
push id35789
push userbtara@mozilla.com
push dateSun, 31 Mar 2019 09:00:52 +0000
treeherdermozilla-central@c06dfc552c64 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1525762
milestone68.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 1525762: Part 1k - Update mozscreenshots to use AddonManager rather than LightweightThemeManager. r=MattN
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/lib/black_theme.png
browser/tools/mozscreenshots/mozscreenshots/extension/lib/white_theme.png
browser/tools/mozscreenshots/mozscreenshots/extension/moz.build
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
@@ -1,87 +1,40 @@
 /* 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";
 
 var EXPORTED_SYMBOLS = ["LightweightThemes"];
 
-const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm");
-const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
-const {setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
+const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 
 var LightweightThemes = {
   init(libDir) {
-    // convert -size 3000x200 canvas:#333 black_theme.png
-    let blackImage = libDir.clone();
-    blackImage.append("black_theme.png");
-    this._blackImageURL = Services.io.newFileURI(blackImage).spec;
-
-    // convert -size 3000x200 canvas:#eee white_theme.png
-    let whiteImage = libDir.clone();
-    whiteImage.append("white_theme.png");
-    this._whiteImageURL = Services.io.newFileURI(whiteImage).spec;
   },
 
   configurations: {
     noLWT: {
       selectors: [],
       async applyConfig() {
-        LightweightThemeManager.currentTheme = null;
-      },
-    },
-
-    darkLWT: {
-      selectors: [],
-      applyConfig() {
-        LightweightThemeManager.setLocalTheme({
-          id:          "black",
-          name:        "black",
-          headerURL:   LightweightThemes._blackImageURL,
-          textcolor:   "#eeeeee",
-          accentcolor: "#111111",
-        });
-
-        // Wait for LWT listener
-        return new Promise(resolve => {
-          setTimeout(() => {
-            resolve();
-          }, 500);
-        });
-      },
-    },
-
-    lightLWT: {
-      selectors: [],
-      applyConfig() {
-        LightweightThemeManager.setLocalTheme({
-          id:          "white",
-          name:        "white",
-          headerURL:   LightweightThemes._whiteImageURL,
-          textcolor:   "#111111",
-          accentcolor: "#eeeeee",
-        });
-        // Wait for LWT listener
-        return new Promise(resolve => {
-          setTimeout(() => {
-            resolve();
-          }, 500);
-        });
+        let addon = await AddonManager.getAddonByID("default-theme@mozilla.org");
+        await addon.enable();
       },
     },
 
     compactLight: {
       selectors: [],
-      applyConfig() {
-        LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-light@mozilla.org");
+      async applyConfig() {
+        let addon = await AddonManager.getAddonByID("firefox-compact-light@mozilla.org");
+        await addon.enable();
       },
     },
 
     compactDark: {
       selectors: [],
-      applyConfig() {
-        LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme("firefox-compact-dark@mozilla.org");
+      async applyConfig() {
+        let addon = await AddonManager.getAddonByID("firefox-compact-dark@mozilla.org");
+        await addon.enable();
       },
     },
   },
 };
deleted file mode 100644
index f298189952fa8139a911365d3da9392f092dd0d6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
deleted file mode 100644
index 94882c56dd6243501ca9dd66a76116d64667059f..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
GIT binary patch
literal 0
Hc$@<O00001
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/moz.build
@@ -31,29 +31,27 @@ FINAL_TARGET_FILES.resources.configurati
     'configurations/Tabs.jsm',
     'configurations/TabsInTitlebar.jsm',
     'configurations/Toolbars.jsm',
     'configurations/UIDensities.jsm',
     'configurations/WindowSize.jsm',
 ]
 
 FINAL_TARGET_FILES.resources.lib += [
-    'lib/black_theme.png',
     'lib/borderify.xpi',
     'lib/mozscreenshots-script.js',
     'lib/mozscreenshots-style.css',
     'lib/mozscreenshots.html',
     'lib/permissionPrompts.html',
     'lib/robot.png',
     'lib/robot_center.png',
     'lib/robot_cropped_diagonal.png',
     'lib/robot_diagonal.png',
     'lib/robot_uncropped.png',
     'lib/robot_upperleft.png',
-    'lib/white_theme.png',
 ]
 
 FINAL_TARGET_FILES.resources.lib.controlCenter += [
     'lib/controlCenter/mixed.html',
     'lib/controlCenter/mixed_active.html',
     'lib/controlCenter/mixed_passive.html',
     'lib/controlCenter/password.html',
     'lib/controlCenter/tracking.html',