Merge remote-tracking branch 'origin/master' into custom

This commit is contained in:
Roy Tam 2020-01-31 09:56:42 +08:00
commit cf19eaad64
13 changed files with 225 additions and 154 deletions

View file

@ -1372,3 +1372,7 @@ pref("services.sync.validation.enabled", true);
// The counter resets when the page is reloaded from the UI // The counter resets when the page is reloaded from the UI
// (content-reloads do NOT clear this to mitigate reloading tricks). // (content-reloads do NOT clear this to mitigate reloading tricks).
pref("prompts.authentication_dialog_abuse_limit", 3); pref("prompts.authentication_dialog_abuse_limit", 3);
// Enable WASM and its baseline jit (platform default is false)
pref("javascript.options.wasm", true);
pref("javascript.options.wasm_baselinejit", true);

View file

@ -533,7 +533,7 @@
${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0 ${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0
${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0 ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0
${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0 ${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0
${WriteRegStr2} $1 "$0" "Publisher" "Mozilla" 0 ${WriteRegStr2} $1 "$0" "Publisher" "Moonchild Productions" 0
${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0 ${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0
DeleteRegValue SHCTX "$0" "URLInfoAbout" DeleteRegValue SHCTX "$0" "URLInfoAbout"
; Don't add URLUpdateInfo which is the release notes url except for the release ; Don't add URLUpdateInfo which is the release notes url except for the release

View file

@ -3,25 +3,25 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
malformedURI=The URL is not valid and cannot be loaded. malformedURI=The URL is not valid and cannot be loaded.
fileNotFound=Firefox can’t find the file at %S. fileNotFound=Basilisk can’t find the file at %S.
fileAccessDenied=The file at %S is not readable. fileAccessDenied=The file at %S is not readable.
dnsNotFound=Firefox can’t find the server at %S. dnsNotFound=Basilisk can’t find the server at %S.
unknownProtocolFound=Firefox doesn’t know how to open this address, because one of the following protocols (%S) isn’t associated with any program or is not allowed in this context. unknownProtocolFound=Basilisk doesn’t know how to open this address, because one of the following protocols (%S) isn’t associated with any program or is not allowed in this context.
connectionFailure=Firefox can’t establish a connection to the server at %S. connectionFailure=Firefox can’t establish a connection to the server at %S.
netInterrupt=The connection to %S was interrupted while the page was loading. netInterrupt=The connection to %S was interrupted while the page was loading.
netTimeout=The server at %S is taking too long to respond. netTimeout=The server at %S is taking too long to respond.
redirectLoop=Firefox has detected that the server is redirecting the request for this address in a way that will never complete. redirectLoop=Basilisk has detected that the server is redirecting the request for this address in a way that will never complete.
## LOCALIZATION NOTE (confirmRepostPrompt): In this item, don’t translate "%S" ## LOCALIZATION NOTE (confirmRepostPrompt): In this item, don’t translate "%S"
confirmRepostPrompt=To display this page, %S must send information that will repeat any action (such as a search or order confirmation) that was performed earlier. confirmRepostPrompt=To display this page, %S must send information that will repeat any action (such as a search or order confirmation) that was performed earlier.
resendButton.label=Resend resendButton.label=Resend
unknownSocketType=Firefox doesn’t know how to communicate with the server. unknownSocketType=Basilisk doesn’t know how to communicate with the server.
netReset=The connection to the server was reset while the page was loading. netReset=The connection to the server was reset while the page was loading.
notCached=This document is no longer available. notCached=This document is no longer available.
netOffline=Firefox is currently in offline mode and can’t browse the Web. netOffline=Basilisk is currently in offline mode and can’t browse the Web.
isprinting=The document cannot change while Printing or in Print Preview. isprinting=The document cannot change while Printing or in Print Preview.
deniedPortAccess=This address uses a network port which is normally used for purposes other than Web browsing. Firefox has canceled the request for your protection. deniedPortAccess=This address uses a network port which is normally used for purposes other than Web browsing. Basilisk has canceled the request for your protection.
proxyResolveFailure=Firefox is configured to use a proxy server that can’t be found. proxyResolveFailure=Basilisk is configured to use a proxy server that can’t be found.
proxyConnectFailure=Firefox is configured to use a proxy server that is refusing connections. proxyConnectFailure=Basilisk is configured to use a proxy server that is refusing connections.
contentEncodingError=The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. contentEncodingError=The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
unsafeContentType=The page you are trying to view cannot be shown because it is contained in a file type that may not be safe to open. Please contact the website owners to inform them of this problem. unsafeContentType=The page you are trying to view cannot be shown because it is contained in a file type that may not be safe to open. Please contact the website owners to inform them of this problem.
externalProtocolTitle=External Protocol Request externalProtocolTitle=External Protocol Request
@ -35,9 +35,9 @@ unwantedBlocked=The site at %S has been reported as serving unwanted software an
deceptiveBlocked=This web page at %S has been reported as a deceptive site and has been blocked based on your security preferences. deceptiveBlocked=This web page at %S has been reported as a deceptive site and has been blocked based on your security preferences.
cspBlocked=This page has a content security policy that prevents it from being loaded in this way. cspBlocked=This page has a content security policy that prevents it from being loaded in this way.
corruptedContentErrorv2=The site at %S has experienced a network protocol violation that cannot be repaired. corruptedContentErrorv2=The site at %S has experienced a network protocol violation that cannot be repaired.
remoteXUL=This page uses an unsupported technology that is no longer available by default in Firefox. remoteXUL=This page uses an unsupported technology that is no longer available by default in Basilisk.
## LOCALIZATION NOTE (sslv3Used) - Do not translate "%S". ## LOCALIZATION NOTE (sslv3Used) - Do not translate "%S".
sslv3Used=Firefox cannot guarantee the safety of your data on %S because it uses SSLv3, a broken security protocol. sslv3Used=Basilisk cannot guarantee the safety of your data on %S because it uses SSLv3, a broken security protocol.
## LOCALIZATION NOTE (weakCryptoUsed) - Do not translate "%S". ## LOCALIZATION NOTE (weakCryptoUsed) - Do not translate "%S".
weakCryptoUsed=The owner of %S has configured their website improperly. To protect your information from being stolen, Firefox has not connected to this website. weakCryptoUsed=The owner of %S has configured their website improperly. To protect your information from being stolen, Basilisk has not connected to this website.
inadequateSecurityError=The website tried to negotiate an inadequate level of security. inadequateSecurityError=The website tried to negotiate an inadequate level of security.

View file

@ -869,7 +869,7 @@ pref("browser.sessionstore.restore_pinned_tabs_on_demand", false);
// 0 = standard behavior: pull fully from cache // 0 = standard behavior: pull fully from cache
// 1 = perform a soft refresh when restoring a tab (check network) // 1 = perform a soft refresh when restoring a tab (check network)
// 2 = perform a hard refresh when restoring a tab (bypass cache completely) // 2 = perform a hard refresh when restoring a tab (bypass cache completely)
pref("browser.sessionstore.cache_behavior", 0); pref("browser.sessionstore.cache_behavior", 1);
// Pale Moon: Allow exact positioning of windows to previous locations, even // Pale Moon: Allow exact positioning of windows to previous locations, even
// if they would be outside of the screen bounds // if they would be outside of the screen bounds
pref("browser.sessionstore.exactPos", false); pref("browser.sessionstore.exactPos", false);

View file

@ -449,12 +449,14 @@
var cancel = false; var cancel = false;
let { AppConstants } =
Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
// Catch any keys that could potentially move the caret. Ctrl can be // Catch any keys that could potentially move the caret. Ctrl can be
// used in combination with these keys on Windows and Linux; and Alt // used in combination with these keys on Windows and Linux; and Alt
// can be used on OS X, so make sure the unused one isn't used. // can be used on OS X, so make sure the unused one isn't used.
let metaKey = AppConstants.platform == "macosx" ? aEvent.ctrlKey : aEvent.altKey; #ifdef XP_MACOSX
let metaKey = aEvent.ctrlKey;
#else
let metaKey = aEvent.altKey;
#endif
if (!this.disableKeyNavigation && !metaKey) { if (!this.disableKeyNavigation && !metaKey) {
switch (aEvent.keyCode) { switch (aEvent.keyCode) {
case KeyEvent.DOM_VK_LEFT: case KeyEvent.DOM_VK_LEFT:
@ -492,11 +494,11 @@
cancel = this.mController.handleEscape(); cancel = this.mController.handleEscape();
break; break;
case KeyEvent.DOM_VK_RETURN: case KeyEvent.DOM_VK_RETURN:
if (AppConstants.platform == "macosx") { #ifdef XP_MACOSX
// Prevent the default action, since it will beep on Mac // Prevent the default action, since it will beep on Mac
if (aEvent.metaKey) if (aEvent.metaKey)
aEvent.preventDefault(); aEvent.preventDefault();
} #endif
this.mEnterEvent = aEvent; this.mEnterEvent = aEvent;
if (this.mController.selection) { if (this.mController.selection) {
this._selectionDetails = { this._selectionDetails = {
@ -507,15 +509,19 @@
cancel = this.handleEnter(); cancel = this.handleEnter();
break; break;
case KeyEvent.DOM_VK_DELETE: case KeyEvent.DOM_VK_DELETE:
if (AppConstants.platform == "macosx" && !aEvent.shiftKey) { #ifdef XP_MACOSX
if (!aEvent.shiftKey) {
break; break;
} }
#endif
cancel = this.handleDelete(); cancel = this.handleDelete();
break; break;
case KeyEvent.DOM_VK_BACK_SPACE: case KeyEvent.DOM_VK_BACK_SPACE:
if (AppConstants.platform == "macosx" && aEvent.shiftKey) { #ifdef XP_MACOSX
if (aEvent.shiftKey) {
cancel = this.handleDelete(); cancel = this.handleDelete();
} }
#endif
break; break;
case KeyEvent.DOM_VK_DOWN: case KeyEvent.DOM_VK_DOWN:
case KeyEvent.DOM_VK_UP: case KeyEvent.DOM_VK_UP:
@ -523,9 +529,9 @@
this.toggleHistoryPopup(); this.toggleHistoryPopup();
break; break;
case KeyEvent.DOM_VK_F4: case KeyEvent.DOM_VK_F4:
if (AppConstants.platform != "macosx") { #ifndef XP_MACOSX
this.toggleHistoryPopup(); this.toggleHistoryPopup();
} #endif
break; break;
} }

View file

@ -1198,7 +1198,7 @@ BrowserGlue.prototype = {
}, },
_migrateUI: function BG__migrateUI() { _migrateUI: function BG__migrateUI() {
const UI_VERSION = 20; const UI_VERSION = 22;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#"; const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0; let currentUIVersion = 0;
try { try {
@ -1397,12 +1397,6 @@ BrowserGlue.prototype = {
this._notifyNotificationsUpgrade(); this._notifyNotificationsUpgrade();
} }
if (this._dirty)
this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
delete this._rdf;
delete this._dataSource;
if (currentUIVersion < 18) { if (currentUIVersion < 18) {
// Make sure the doNotTrack value conforms to the conversion from // Make sure the doNotTrack value conforms to the conversion from
// three-state to two-state. (This reverts a setting of "please track me" // three-state to two-state. (This reverts a setting of "please track me"
@ -1438,6 +1432,47 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("security.cert_pinning.enforcement_level"); Services.prefs.clearUserPref("security.cert_pinning.enforcement_level");
} }
if (currentUIVersion < 21) {
// Remove key4.db and cert9.db if those files exist
// XXX: Remove this code block once we actually start using them.
let dsCertFile = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties)
.get("ProfD", Ci.nsIFile);
dsKeyFile = dsCertFile.clone();
dsCertFile.append("cert9.db");
if (dsCertFile.exists()) {
try {
dsCertFile.remove(false);
} catch(e) { }
}
dsKeyFile.append("key4.db");
if (dsKeyFile.exists()) {
try {
dsKeyFile.remove(false);
} catch(e) { }
}
}
if (currentUIVersion < 22) {
if (Services.prefs.prefHasUserValue("layers.acceleration.disabled")) {
let HWADisabled = Service.prefs.getBoolPref("layers.acceleration.disabled");
Services.prefs.setBoolPref("layers.acceleration.enabled", !HWADisabled);
Services.prefs.setBoolPref("gfx.direct2d.disabled", HWADisabled);
}
if (Services.prefs.getBoolPref("layers.acceleration.force-enabled", false)) {
Services.prefs.setBoolPref("layers.acceleration.force", true);
}
Services.prefs.clearUserPref("layers.acceleration.disabled");
Services.prefs.clearUserPref("layers.acceleration.force-enabled");
}
// Clear out dirty storage
if (this._dirty)
this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
delete this._rdf;
delete this._dataSource;
// Update the migration version. // Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION); Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
}, },

View file

@ -51,6 +51,8 @@ var gAdvancedPane = {
this.updateActualCacheSize(); this.updateActualCacheSize();
this.updateActualAppCacheSize(); this.updateActualAppCacheSize();
this.updateHWADisplay();
// Notify observers that the UI is now ready // Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "advanced-pane-loaded", null); Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
}, },
@ -156,9 +158,18 @@ var gAdvancedPane = {
updateHardwareAcceleration: function() updateHardwareAcceleration: function()
{ {
#ifdef XP_WIN #ifdef XP_WIN
var fromPref = document.getElementById("layers.acceleration.disabled"); var fromPref = document.getElementById("layers.acceleration.enabled");
var toPref = document.getElementById("gfx.direct2d.disabled"); var toPref = document.getElementById("gfx.direct2d.disabled");
toPref.value = fromPref.value; toPref.value = !fromPref.value;
#endif
this.updateHWADisplay();
},
updateHWADisplay: function()
{
#ifdef XP_LINUX
let HWA = document.getElementById("layers.acceleration.enabled");
document.getElementById("forceHWAccel").disabled = !HWA.value;
#endif #endif
}, },

View file

@ -31,7 +31,7 @@
<preference id="general.autoScroll" name="general.autoScroll" type="bool"/> <preference id="general.autoScroll" name="general.autoScroll" type="bool"/>
<preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/> <preference id="general.smoothScroll" name="general.smoothScroll" type="bool"/>
<preference id="layers.acceleration.disabled" name="layers.acceleration.disabled" type="bool" inverted="true" <preference id="layers.acceleration.enabled" name="layers.acceleration.enabled" type="bool"
onchange="gAdvancedPane.updateHardwareAcceleration()"/> onchange="gAdvancedPane.updateHardwareAcceleration()"/>
#ifdef XP_WIN #ifdef XP_WIN
<preference id="gfx.direct2d.disabled" name="gfx.direct2d.disabled" type="bool" inverted="true"/> <preference id="gfx.direct2d.disabled" name="gfx.direct2d.disabled" type="bool" inverted="true"/>
@ -152,10 +152,6 @@
label="&useAutoScroll.label;" label="&useAutoScroll.label;"
accesskey="&useAutoScroll.accesskey;" accesskey="&useAutoScroll.accesskey;"
preference="general.autoScroll"/> preference="general.autoScroll"/>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.disabled"/>
<checkbox id="checkSpelling" <checkbox id="checkSpelling"
label="&checkSpelling.label;" label="&checkSpelling.label;"
accesskey="&checkSpelling.accesskey;" accesskey="&checkSpelling.accesskey;"
@ -164,6 +160,21 @@
preference="layout.spellcheckDefault"/> preference="layout.spellcheckDefault"/>
</groupbox> </groupbox>
<!-- Hardware Acceleration -->
<groupbox id="browsingGroup" align="start">
<caption label="&HWAccel.label;"/>
<label>&restartRequired.label;</label>
<checkbox id="allowHWAccel"
label="&allowHWAccel.label;"
accesskey="&allowHWAccel.accesskey;"
preference="layers.acceleration.enabled"/>
#ifdef XP_LINUX
<checkbox id="forceHWAccel" class="indent"
label="&forceHWAccel.label;"
preference="layers.acceleration.force"/>
#endif
</groupbox>
#ifdef HAVE_SHELL_SERVICE #ifdef HAVE_SHELL_SERVICE
<!-- System Defaults --> <!-- System Defaults -->
<groupbox id="systemDefaultsGroup" orient="vertical"> <groupbox id="systemDefaultsGroup" orient="vertical">

View file

@ -8,7 +8,6 @@ this.EXPORTED_SYMBOLS = ["ShellService"];
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry", XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
@ -26,20 +25,17 @@ var ShellServiceInternal = {
* environments. * environments.
*/ */
get canSetDesktopBackground() { get canSetDesktopBackground() {
if (AppConstants.platform == "win" || #ifdef XP_LINUX
AppConstants.platform == "macosx") { if (this.shellService) {
return true; let linuxShellService = this.shellService
.QueryInterface(Ci.nsIGNOMEShellService);
return linuxShellService.canSetDesktopBackground;
} }
#elif defined(XP_WIN) || defined(XP_MACOSX)
if (AppConstants.platform == "linux") { return true;
if (this.shellService) { #else
let linuxShellService = this.shellService
.QueryInterface(Ci.nsIGNOMEShellService);
return linuxShellService.canSetDesktopBackground;
}
}
return false; return false;
#endif
}, },
/** /**
@ -60,18 +56,18 @@ var ShellServiceInternal = {
return false; return false;
} }
if (AppConstants.platform == "win") { #ifdef XP_WIN
let optOutValue = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, let optOutValue = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
"Software\\Mozilla\\PaleMoon", "Software\\Mozilla\\PaleMoon",
"DefaultBrowserOptOut"); "DefaultBrowserOptOut");
WindowsRegistry.removeRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER, WindowsRegistry.removeRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
"Software\\Mozilla\\PaleMoon", "Software\\Mozilla\\PaleMoon",
"DefaultBrowserOptOut"); "DefaultBrowserOptOut");
if (optOutValue == "True") { if (optOutValue == "True") {
Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", false); Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", false);
return false; return false;
}
} }
#endif
return true; return true;
}, },

View file

@ -7,8 +7,13 @@ Components.utils.import("resource://gre/modules/AppConstants.jsm");
var Ci = Components.interfaces; var Ci = Components.interfaces;
var gSetBackground = { var gSetBackground = {
_position : AppConstants.platform == "macosx" ? "STRETCH" : "", #ifdef XP_MACOSX
_backgroundColor : AppConstants.platform != "macosx" ? 0 : undefined, _position : "STRETCH",
_backgroundColor : undefined,
#else
_position : "",
_backgroundColor : 0,
#endif
_screenWidth : 0, _screenWidth : 0,
_screenHeight : 0, _screenHeight : 0,
_image : null, _image : null,
@ -25,23 +30,23 @@ var gSetBackground = {
this._canvas = document.getElementById("screen"); this._canvas = document.getElementById("screen");
this._screenWidth = screen.width; this._screenWidth = screen.width;
this._screenHeight = screen.height; this._screenHeight = screen.height;
if (AppConstants.platform == "macosx") { #ifdef XP_MACOSX
document.documentElement.getButton("accept").hidden = true; document.documentElement.getButton("accept").hidden = true;
} #endif
if (this._screenWidth / this._screenHeight >= 1.6) if (this._screenWidth / this._screenHeight >= 1.6)
document.getElementById("monitor").setAttribute("aspectratio", "16:10"); document.getElementById("monitor").setAttribute("aspectratio", "16:10");
if (AppConstants.platform == "win") { #ifdef XP_WIN
// Hide fill + fit options if < Win7 since they don't work. // Hide fill + fit options if < Win7 since they don't work.
var version = Components.classes["@mozilla.org/system-info;1"] var version = Components.classes["@mozilla.org/system-info;1"]
.getService(Ci.nsIPropertyBag2) .getService(Ci.nsIPropertyBag2)
.getProperty("version"); .getProperty("version");
var isWindows7OrHigher = (parseFloat(version) >= 6.1); var isWindows7OrHigher = (parseFloat(version) >= 6.1);
if (!isWindows7OrHigher) { if (!isWindows7OrHigher) {
document.getElementById("fillPosition").hidden = true; document.getElementById("fillPosition").hidden = true;
document.getElementById("fitPosition").hidden = true; document.getElementById("fitPosition").hidden = true;
}
} }
#endif
// make sure that the correct dimensions will be used // make sure that the correct dimensions will be used
setTimeout(function(self) { setTimeout(function(self) {
@ -60,28 +65,25 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d"); var ctx = this._canvas.getContext("2d");
ctx.scale(this._canvas.clientWidth / this._screenWidth, this._canvas.clientHeight / this._screenHeight); ctx.scale(this._canvas.clientWidth / this._screenWidth, this._canvas.clientHeight / this._screenHeight);
if (AppConstants.platform != "macosx") { #ifdef XP_MACOSX
this._initColor(); // Make sure to reset the button state in case the user has already
} else { // set an image as their desktop background.
// Make sure to reset the button state in case the user has already var setDesktopBackground = document.getElementById("setDesktopBackground");
// set an image as their desktop background. setDesktopBackground.hidden = false;
var setDesktopBackground = document.getElementById("setDesktopBackground"); var bundle = document.getElementById("backgroundBundle");
setDesktopBackground.hidden = false; setDesktopBackground.label = bundle.getString("DesktopBackgroundSet");
var bundle = document.getElementById("backgroundBundle"); setDesktopBackground.disabled = false;
setDesktopBackground.label = bundle.getString("DesktopBackgroundSet");
setDesktopBackground.disabled = false;
document.getElementById("showDesktopPreferences").hidden = true; document.getElementById("showDesktopPreferences").hidden = true;
} #else
this._initColor();
#endif
this.updatePosition(); this.updatePosition();
}, },
setDesktopBackground: function () setDesktopBackground: function ()
{ {
if (AppConstants.platform != "macosx") { #ifdef XP_MACOSX
document.persist("menuPosition", "value");
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
} else {
Components.classes["@mozilla.org/observer-service;1"] Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService) .getService(Ci.nsIObserverService)
.addObserver(this, "shell:desktop-background-changed", false); .addObserver(this, "shell:desktop-background-changed", false);
@ -90,7 +92,10 @@ var gSetBackground = {
var setDesktopBackground = document.getElementById("setDesktopBackground"); var setDesktopBackground = document.getElementById("setDesktopBackground");
setDesktopBackground.disabled = true; setDesktopBackground.disabled = true;
setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading"); setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading");
} #else
document.persist("menuPosition", "value");
this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
#endif
this._shell.setDesktopBackground(this._image, this._shell.setDesktopBackground(this._image,
Ci.nsIShellService["BACKGROUND_" + this._position]); Ci.nsIShellService["BACKGROUND_" + this._position]);
}, },
@ -100,9 +105,9 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d"); var ctx = this._canvas.getContext("2d");
ctx.clearRect(0, 0, this._screenWidth, this._screenHeight); ctx.clearRect(0, 0, this._screenWidth, this._screenHeight);
if (AppConstants.platform != "macosx") { #ifndef XP_MACOSX
this._position = document.getElementById("menuPosition").value; this._position = document.getElementById("menuPosition").value;
} #endif
switch (this._position) { switch (this._position) {
case "TILE": case "TILE":
@ -158,57 +163,57 @@ var gSetBackground = {
} }
}; };
if (AppConstants.platform != "macosx") { #ifdef XP_MACOSX
gSetBackground["_initColor"] = function () gSetBackground["observe"] = function (aSubject, aTopic, aData)
{ {
var color = this._shell.desktopBackgroundColor; if (aTopic == "shell:desktop-background-changed") {
document.getElementById("setDesktopBackground").hidden = true;
document.getElementById("showDesktopPreferences").hidden = false;
const rMask = 4294901760; Components.classes["@mozilla.org/observer-service;1"]
const gMask = 65280; .getService(Ci.nsIObserverService)
const bMask = 255; .removeObserver(this, "shell:desktop-background-changed");
var r = (color & rMask) >> 16; }
var g = (color & gMask) >> 8; };
var b = (color & bMask);
this.updateColor(this._rgbToHex(r, g, b));
var colorpicker = document.getElementById("desktopColor"); gSetBackground["showDesktopPrefs"] = function()
colorpicker.color = this._backgroundColor; {
}; this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP);
};
#else
gSetBackground["_initColor"] = function ()
{
var color = this._shell.desktopBackgroundColor;
gSetBackground["updateColor"] = function (aColor) const rMask = 4294901760;
{ const gMask = 65280;
this._backgroundColor = aColor; const bMask = 255;
this._canvas.style.backgroundColor = aColor; var r = (color & rMask) >> 16;
}; var g = (color & gMask) >> 8;
var b = (color & bMask);
this.updateColor(this._rgbToHex(r, g, b));
// Converts a color string in the format "#RRGGBB" to an integer. var colorpicker = document.getElementById("desktopColor");
gSetBackground["_hexStringToLong"] = function (aString) colorpicker.color = this._backgroundColor;
{ };
return parseInt(aString.substring(1, 3), 16) << 16 |
parseInt(aString.substring(3, 5), 16) << 8 |
parseInt(aString.substring(5, 7), 16);
};
gSetBackground["_rgbToHex"] = function (aR, aG, aB) gSetBackground["updateColor"] = function (aColor)
{ {
return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1")) this._backgroundColor = aColor;
.join("").toUpperCase(); this._canvas.style.backgroundColor = aColor;
}; };
} else {
gSetBackground["observe"] = function (aSubject, aTopic, aData)
{
if (aTopic == "shell:desktop-background-changed") {
document.getElementById("setDesktopBackground").hidden = true;
document.getElementById("showDesktopPreferences").hidden = false;
Components.classes["@mozilla.org/observer-service;1"] // Converts a color string in the format "#RRGGBB" to an integer.
.getService(Ci.nsIObserverService) gSetBackground["_hexStringToLong"] = function (aString)
.removeObserver(this, "shell:desktop-background-changed"); {
} return parseInt(aString.substring(1, 3), 16) << 16 |
}; parseInt(aString.substring(3, 5), 16) << 8 |
parseInt(aString.substring(5, 7), 16);
};
gSetBackground["showDesktopPrefs"] = function() gSetBackground["_rgbToHex"] = function (aR, aG, aB)
{ {
this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP); return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1"))
}; .join("").toUpperCase();
} };
#endif

View file

@ -4,4 +4,4 @@
browser.jar: browser.jar:
* content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul) * content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul)
content/browser/setDesktopBackground.js (content/setDesktopBackground.js) * content/browser/setDesktopBackground.js (content/setDesktopBackground.js)

View file

@ -32,7 +32,7 @@ EXTRA_COMPONENTS += [
'nsSetDefaultBrowser.manifest', 'nsSetDefaultBrowser.manifest',
] ]
EXTRA_JS_MODULES += ['ShellService.jsm'] EXTRA_PP_JS_MODULES += ['ShellService.jsm']
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'): for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'):
DEFINES[var] = '"%s"' % CONFIG[var] DEFINES[var] = '"%s"' % CONFIG[var]

View file

@ -21,10 +21,13 @@
<!ENTITY useAutoScroll.accesskey "a"> <!ENTITY useAutoScroll.accesskey "a">
<!ENTITY useSmoothScrolling.label "Use smooth scrolling"> <!ENTITY useSmoothScrolling.label "Use smooth scrolling">
<!ENTITY useSmoothScrolling.accesskey "m"> <!ENTITY useSmoothScrolling.accesskey "m">
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
<!ENTITY allowHWAccel.accesskey "r">
<!ENTITY checkSpelling.label "Check my spelling as I type"> <!ENTITY checkSpelling.label "Check my spelling as I type">
<!ENTITY checkSpelling.accesskey "t"> <!ENTITY checkSpelling.accesskey "t">
<!ENTITY HWAccel.label "Hardware Acceleration (HWA)">
<!ENTITY restartRequired.label "Changes to these settings require a browser restart.">
<!ENTITY allowHWAccel.label "Use hardware acceleration when available">
<!ENTITY allowHWAccel.accesskey "r">
<!ENTITY forceHWAccel.label "Force hardware acceleration">
<!ENTITY systemDefaults.label "System Defaults"> <!ENTITY systemDefaults.label "System Defaults">
<!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default browser on startup"><!--XXX--> <!ENTITY alwaysCheckDefault.label "Always check to see if &brandShortName; is the default browser on startup"><!--XXX-->