mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-30 11:07:29 +09:00
Issue #1124: [Basilisk] Remove Dev Edition front-end tie-ins.
This commit is contained in:
parent
1f68992bee
commit
188fdce00f
7 changed files with 2 additions and 211 deletions
|
|
@ -1,142 +0,0 @@
|
||||||
/* 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/. */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Listeners for the DevEdition theme. This adds an extra stylesheet
|
|
||||||
* to browser.xul if a pref is set and no other themes are applied.
|
|
||||||
*/
|
|
||||||
var DevEdition = {
|
|
||||||
_devtoolsThemePrefName: "devtools.theme",
|
|
||||||
styleSheetLocation: "chrome://browser/skin/devedition.css",
|
|
||||||
styleSheet: null,
|
|
||||||
initialized: false,
|
|
||||||
|
|
||||||
get isStyleSheetEnabled() {
|
|
||||||
return this.styleSheet && !this.styleSheet.sheet.disabled;
|
|
||||||
},
|
|
||||||
|
|
||||||
get isThemeCurrentlyApplied() {
|
|
||||||
let theme = LightweightThemeManager.currentTheme;
|
|
||||||
return theme && theme.id == "firefox-devedition@mozilla.org";
|
|
||||||
},
|
|
||||||
|
|
||||||
init: function () {
|
|
||||||
this.initialized = true;
|
|
||||||
Services.prefs.addObserver(this._devtoolsThemePrefName, this, false);
|
|
||||||
Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
|
|
||||||
Services.obs.addObserver(this, "lightweight-theme-window-updated", false);
|
|
||||||
this._updateDevtoolsThemeAttribute();
|
|
||||||
|
|
||||||
if (this.isThemeCurrentlyApplied) {
|
|
||||||
this._toggleStyleSheet(true);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
createStyleSheet: function() {
|
|
||||||
let styleSheetAttr = `href="${this.styleSheetLocation}" type="text/css"`;
|
|
||||||
this.styleSheet = document.createProcessingInstruction(
|
|
||||||
"xml-stylesheet", styleSheetAttr);
|
|
||||||
this.styleSheet.addEventListener("load", this);
|
|
||||||
document.insertBefore(this.styleSheet, document.documentElement);
|
|
||||||
this.styleSheet.sheet.disabled = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
|
||||||
if (topic == "lightweight-theme-styling-update") {
|
|
||||||
let newTheme = JSON.parse(data);
|
|
||||||
if (newTheme && newTheme.id == "firefox-devedition@mozilla.org") {
|
|
||||||
this._toggleStyleSheet(true);
|
|
||||||
} else {
|
|
||||||
this._toggleStyleSheet(false);
|
|
||||||
}
|
|
||||||
} else if (topic == "lightweight-theme-window-updated" && subject == window) {
|
|
||||||
this._updateLWTBrightness();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (topic == "nsPref:changed" && data == this._devtoolsThemePrefName) {
|
|
||||||
this._updateDevtoolsThemeAttribute();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_inferBrightness: function() {
|
|
||||||
ToolbarIconColor.inferFromText();
|
|
||||||
// Get an inverted full screen button if the dark theme is applied.
|
|
||||||
if (this.isStyleSheetEnabled &&
|
|
||||||
document.documentElement.getAttribute("devtoolstheme") == "dark") {
|
|
||||||
document.documentElement.setAttribute("brighttitlebarforeground", "true");
|
|
||||||
} else {
|
|
||||||
document.documentElement.removeAttribute("brighttitlebarforeground");
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_updateLWTBrightness() {
|
|
||||||
if (this.isThemeCurrentlyApplied) {
|
|
||||||
let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
|
|
||||||
let textColor = devtoolsTheme == "dark" ? "bright" : "dark";
|
|
||||||
document.documentElement.setAttribute("lwthemetextcolor", textColor);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_updateDevtoolsThemeAttribute: function() {
|
|
||||||
// Set an attribute on root element to make it possible
|
|
||||||
// to change colors based on the selected devtools theme.
|
|
||||||
let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
|
|
||||||
if (devtoolsTheme != "dark") {
|
|
||||||
devtoolsTheme = "light";
|
|
||||||
}
|
|
||||||
document.documentElement.setAttribute("devtoolstheme", devtoolsTheme);
|
|
||||||
this._updateLWTBrightness();
|
|
||||||
this._inferBrightness();
|
|
||||||
},
|
|
||||||
|
|
||||||
handleEvent: function(e) {
|
|
||||||
if (e.type === "load") {
|
|
||||||
this.styleSheet.removeEventListener("load", this);
|
|
||||||
this.refreshBrowserDisplay();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
refreshBrowserDisplay: function() {
|
|
||||||
// Don't touch things on the browser if gBrowserInit.onLoad hasn't
|
|
||||||
// yet fired.
|
|
||||||
if (this.initialized) {
|
|
||||||
gBrowser.tabContainer._positionPinnedTabs();
|
|
||||||
this._inferBrightness();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_toggleStyleSheet: function(deveditionThemeEnabled) {
|
|
||||||
let wasEnabled = this.isStyleSheetEnabled;
|
|
||||||
if (deveditionThemeEnabled && !wasEnabled) {
|
|
||||||
// The stylesheet may not have been created yet if it wasn't
|
|
||||||
// needed on initial load. Make it now.
|
|
||||||
if (!this.styleSheet) {
|
|
||||||
this.createStyleSheet();
|
|
||||||
}
|
|
||||||
this.styleSheet.sheet.disabled = false;
|
|
||||||
this.refreshBrowserDisplay();
|
|
||||||
} else if (!deveditionThemeEnabled && wasEnabled) {
|
|
||||||
this.styleSheet.sheet.disabled = true;
|
|
||||||
this.refreshBrowserDisplay();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
uninit: function () {
|
|
||||||
Services.prefs.removeObserver(this._devtoolsThemePrefName, this);
|
|
||||||
Services.obs.removeObserver(this, "lightweight-theme-styling-update", false);
|
|
||||||
Services.obs.removeObserver(this, "lightweight-theme-window-updated", false);
|
|
||||||
if (this.styleSheet) {
|
|
||||||
this.styleSheet.removeEventListener("load", this);
|
|
||||||
}
|
|
||||||
this.styleSheet = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// If the DevEdition theme is going to be applied in gBrowserInit.onLoad,
|
|
||||||
// then preload it now. This prevents a flash of unstyled content where the
|
|
||||||
// normal theme is applied while the DevEdition stylesheet is loading.
|
|
||||||
if (!AppConstants.RELEASE_OR_BETA &&
|
|
||||||
this != Services.appShell.hiddenDOMWindow && DevEdition.isThemeCurrentlyApplied) {
|
|
||||||
DevEdition.createStyleSheet();
|
|
||||||
}
|
|
||||||
|
|
@ -961,7 +961,6 @@ var gBrowserInit = {
|
||||||
gPageStyleMenu.init();
|
gPageStyleMenu.init();
|
||||||
BrowserOnClick.init();
|
BrowserOnClick.init();
|
||||||
FeedHandler.init();
|
FeedHandler.init();
|
||||||
DevEdition.init();
|
|
||||||
AboutPrivateBrowsingListener.init();
|
AboutPrivateBrowsingListener.init();
|
||||||
TrackingProtection.init();
|
TrackingProtection.init();
|
||||||
RefreshBlocker.init();
|
RefreshBlocker.init();
|
||||||
|
|
@ -1484,8 +1483,6 @@ var gBrowserInit = {
|
||||||
|
|
||||||
FeedHandler.uninit();
|
FeedHandler.uninit();
|
||||||
|
|
||||||
DevEdition.uninit();
|
|
||||||
|
|
||||||
TrackingProtection.uninit();
|
TrackingProtection.uninit();
|
||||||
|
|
||||||
RefreshBlocker.uninit();
|
RefreshBlocker.uninit();
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-captivePortal.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-captivePortal.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-ctrlTab.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-ctrlTab.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-customization.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-customization.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-devedition.js"/>
|
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-feeds.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-feeds.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-fullScreenAndPointerLock.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-fullScreenAndPointerLock.js"/>
|
||||||
<script type="application/javascript" src="chrome://browser/content/browser-fullZoom.js"/>
|
<script type="application/javascript" src="chrome://browser/content/browser-fullZoom.js"/>
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,6 @@ browser.jar:
|
||||||
content/browser/browser-ctrlTab.js (content/browser-ctrlTab.js)
|
content/browser/browser-ctrlTab.js (content/browser-ctrlTab.js)
|
||||||
content/browser/browser-customization.js (content/browser-customization.js)
|
content/browser/browser-customization.js (content/browser-customization.js)
|
||||||
content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
|
content/browser/browser-data-submission-info-bar.js (content/browser-data-submission-info-bar.js)
|
||||||
content/browser/browser-devedition.js (content/browser-devedition.js)
|
|
||||||
content/browser/browser-feeds.js (content/browser-feeds.js)
|
content/browser/browser-feeds.js (content/browser-feeds.js)
|
||||||
content/browser/browser-fullScreenAndPointerLock.js (content/browser-fullScreenAndPointerLock.js)
|
content/browser/browser-fullScreenAndPointerLock.js (content/browser-fullScreenAndPointerLock.js)
|
||||||
content/browser/browser-fullZoom.js (content/browser-fullZoom.js)
|
content/browser/browser-fullZoom.js (content/browser-fullZoom.js)
|
||||||
|
|
|
||||||
|
|
@ -676,19 +676,6 @@ BrowserGlue.prototype = {
|
||||||
// Ensure we keep track of places/pw-mananager undo by init'ing this early.
|
// Ensure we keep track of places/pw-mananager undo by init'ing this early.
|
||||||
Cu.import("resource:///modules/AutoMigrate.jsm");
|
Cu.import("resource:///modules/AutoMigrate.jsm");
|
||||||
|
|
||||||
if (!AppConstants.RELEASE_OR_BETA) {
|
|
||||||
let themeName = gBrowserBundle.GetStringFromName("deveditionTheme.name");
|
|
||||||
let vendorShortName = gBrandBundle.GetStringFromName("vendorShortName");
|
|
||||||
|
|
||||||
LightweightThemeManager.addBuiltInTheme({
|
|
||||||
id: "firefox-devedition@mozilla.org",
|
|
||||||
name: themeName,
|
|
||||||
headerURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.header.png",
|
|
||||||
iconURL: "resource:///chrome/browser/content/browser/defaultthemes/devedition.icon.png",
|
|
||||||
author: vendorShortName,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
TabCrashHandler.init();
|
TabCrashHandler.init();
|
||||||
|
|
||||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||||
|
|
@ -1943,14 +1930,8 @@ BrowserGlue.prototype = {
|
||||||
defaultThemeSelected = Services.prefs.getCharPref("general.skins.selectedSkin") == "classic/1.0";
|
defaultThemeSelected = Services.prefs.getCharPref("general.skins.selectedSkin") == "classic/1.0";
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
// If we are on the devedition channel, the devedition theme is on by
|
// If we have the dev edition theme selected, reset it.
|
||||||
// default. But we need to handle the case where they didn't want it
|
if (selectedThemeID == "firefox-devedition@mozilla.org") {
|
||||||
// applied, and unapply the theme.
|
|
||||||
let userChoseToNotUseDeveditionTheme =
|
|
||||||
!defaultThemeSelected ||
|
|
||||||
(lightweightThemeSelected && selectedThemeID != "firefox-devedition@mozilla.org");
|
|
||||||
|
|
||||||
if (userChoseToNotUseDeveditionTheme && selectedThemeID == "firefox-devedition@mozilla.org") {
|
|
||||||
Services.prefs.setCharPref("lightweightThemes.selectedThemeID", "");
|
Services.prefs.setCharPref("lightweightThemes.selectedThemeID", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
/* 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";
|
|
||||||
|
|
||||||
this.EXPORTED_SYMBOLS = ["DevEdition"];
|
|
||||||
|
|
||||||
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
||||||
const THEME_ID = "firefox-devedition@mozilla.org";
|
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
|
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
|
||||||
Cu.import("resource://gre/modules/Task.jsm");
|
|
||||||
|
|
||||||
this.DevEdition = {
|
|
||||||
init(libDir) {},
|
|
||||||
|
|
||||||
configurations: {
|
|
||||||
devEditionLight: {
|
|
||||||
applyConfig: Task.async(() => {
|
|
||||||
Services.prefs.setCharPref("devtools.theme", "light");
|
|
||||||
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(THEME_ID);
|
|
||||||
Services.prefs.setBoolPref("browser.devedition.theme.showCustomizeButton", true);
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
devEditionDark: {
|
|
||||||
applyConfig: Task.async(() => {
|
|
||||||
Services.prefs.setCharPref("devtools.theme", "dark");
|
|
||||||
LightweightThemeManager.currentTheme = LightweightThemeManager.getUsedTheme(THEME_ID);
|
|
||||||
Services.prefs.setBoolPref("browser.devedition.theme.showCustomizeButton", true);
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
devEditionOff: {
|
|
||||||
applyConfig: Task.async(() => {
|
|
||||||
Services.prefs.clearUserPref("devtools.theme");
|
|
||||||
LightweightThemeManager.currentTheme = null;
|
|
||||||
Services.prefs.clearUserPref("browser.devedition.theme.showCustomizeButton");
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
@ -32,7 +32,6 @@ const SCRIPTS = [
|
||||||
"browser/base/content/browser-addons.js",
|
"browser/base/content/browser-addons.js",
|
||||||
"browser/base/content/browser-ctrlTab.js",
|
"browser/base/content/browser-ctrlTab.js",
|
||||||
"browser/base/content/browser-customization.js",
|
"browser/base/content/browser-customization.js",
|
||||||
"browser/base/content/browser-devedition.js",
|
|
||||||
"browser/base/content/browser-feeds.js",
|
"browser/base/content/browser-feeds.js",
|
||||||
"browser/base/content/browser-fullScreenAndPointerLock.js",
|
"browser/base/content/browser-fullScreenAndPointerLock.js",
|
||||||
"browser/base/content/browser-fullZoom.js",
|
"browser/base/content/browser-fullZoom.js",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue