Bug 1464719 - Remove obsolete code from LightweightThemeConsumer.jsm. r=jaws draft
authorTim Nguyen <ntim.bugs@gmail.com>
Mon, 28 May 2018 01:31:20 +0200
changeset 800399 5f3040621cc0dd279cfefd689c756a8adbd6d88b
parent 800391 20d536fd0f2a02bd4527044d367cf98bebbb358d
push id111339
push userbmo:ntim.bugs@gmail.com
push dateSun, 27 May 2018 23:31:53 +0000
reviewersjaws
bugs1464719
milestone62.0a1
Bug 1464719 - Remove obsolete code from LightweightThemeConsumer.jsm. r=jaws MozReview-Commit-ID: C5NMohgxj70
toolkit/modules/LightweightThemeConsumer.jsm
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -103,38 +103,19 @@ function LightweightThemeConsumer(aDocum
   this._update(temp.LightweightThemeManager.currentThemeForDisplay);
 
   this._win.addEventListener("resolutionchange", this);
   this._win.addEventListener("unload", this, { once: true });
 }
 
 LightweightThemeConsumer.prototype = {
   _lastData: null,
-  // Whether the active lightweight theme should be shown on the window.
-  _enabled: true,
   // Whether a lightweight theme is enabled.
   _active: false,
 
-  enable() {
-    this._enabled = true;
-    this._update(this._lastData);
-  },
-
-  disable() {
-    // Dance to keep the data, but reset the applied styles:
-    let lastData = this._lastData;
-    this._update(null);
-    this._enabled = false;
-    this._lastData = lastData;
-  },
-
-  getData() {
-    return this._enabled ? Cu.cloneInto(this._lastData, this._win) : null;
-  },
-
   observe(aSubject, aTopic, aData) {
     if (aTopic != "lightweight-theme-styling-update")
       return;
 
     const { outerWindowID } = this._win
       .QueryInterface(Ci.nsIInterfaceRequestor)
       .getInterface(Ci.nsIDOMWindowUtils);
 
@@ -164,18 +145,16 @@ LightweightThemeConsumer.prototype = {
   _update(aData) {
     if (!aData) {
       aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
       this._lastData = aData;
     } else {
       this._lastData = aData;
       aData = LightweightThemeImageOptimizer.optimize(aData, this._win.screen);
     }
-    if (!this._enabled)
-      return;
 
     let root = this._doc.documentElement;
 
     if (aData.headerURL) {
       root.setAttribute("lwtheme-image", "true");
     } else {
       root.removeAttribute("lwtheme-image");
     }
@@ -204,19 +183,16 @@ LightweightThemeConsumer.prototype = {
       root.removeAttribute("lwtheme");
       root.removeAttribute("lwthemetextcolor");
     }
 
     if (active && aData.footerURL)
       root.setAttribute("lwthemefooter", "true");
     else
       root.removeAttribute("lwthemefooter");
-
-    Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated",
-                                 JSON.stringify(aData));
   }
 };
 
 function _setImage(aRoot, aActive, aVariableName, aURLs) {
   if (aURLs && !Array.isArray(aURLs)) {
     aURLs = [aURLs];
   }
   _setProperty(aRoot, aActive, aVariableName, aURLs && aURLs.map(v => `url("${v.replace(/"/g, '\\"')}")`).join(","));