Bug 1464719 - Remove obsolete code from LightweightThemeConsumer.jsm. r=jaws
MozReview-Commit-ID: C5NMohgxj70
--- 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(","));