From a6ddde9097fbef2940c6a4f785dae15978ef2533 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 14 Feb 2019 16:59:52 +0100 Subject: Port several Skia upstream fixes. --- modules/libpref/init/all.js | 2 -- 1 file changed, 2 deletions(-) (limited to 'modules') diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index f6e90170e..9bdd00c80 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -795,8 +795,6 @@ pref("gfx.content.azure.backends", "direct2d1.1,cairo"); #ifdef XP_MACOSX pref("gfx.content.azure.backends", "cg"); pref("gfx.canvas.azure.backends", "skia,cg"); -// Accelerated cg canvas where available (10.7+) -pref("gfx.canvas.azure.accelerated", true); #else // Linux etc. pref("gfx.canvas.azure.backends", "skia,cairo"); -- cgit v1.2.3 From c13bd1bba28a71d0a2263882b3c72d59a8c32478 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Sun, 17 Feb 2019 14:54:12 +0100 Subject: Revert "Port several Skia upstream fixes." This reverts commit 260b06c1c96285459947231a93f08e413be89dd0. This fixes #976 --- modules/libpref/init/all.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules') diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 9bdd00c80..f6e90170e 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -795,6 +795,8 @@ pref("gfx.content.azure.backends", "direct2d1.1,cairo"); #ifdef XP_MACOSX pref("gfx.content.azure.backends", "cg"); pref("gfx.canvas.azure.backends", "skia,cg"); +// Accelerated cg canvas where available (10.7+) +pref("gfx.canvas.azure.accelerated", true); #else // Linux etc. pref("gfx.canvas.azure.backends", "skia,cairo"); -- cgit v1.2.3 From c08b490c5c44f5f04049f408ad0848e9843f0702 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 28 Feb 2019 13:58:23 +0100 Subject: Move default-enable pref to application. --- modules/libpref/init/all.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index f6e90170e..3666ca425 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -5451,8 +5451,9 @@ pref("dom.storageManager.enabled", true); pref("dom.storageManager.enabled", false); #endif -// When a user cancels this number of authentication dialogs coming from -// a single web page in a row, all following authentication dialogs will -// be blocked (automatically canceled) for that page. The counter resets -// when the page is reloaded. To turn this feature off, just set the limit to 0. -pref("prompts.authentication_dialog_abuse_limit", 3); +// DoS protection for HTTP Auth prompt spawning. +// -1 = completely disable HTTP Auth prompting. (careful!) +// 0 = disable this DoS protection +// >0 = suppress further prompts after the user has canceled the dialog n times +// See application preferences for appropriate defaults. +pref("prompts.authentication_dialog_abuse_limit", 0); -- cgit v1.2.3 From d38ddd92e159113aae22c4dc8f03dc2285e01b14 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 7 Mar 2019 12:45:54 +0100 Subject: Part 1: network component changes. --- modules/libpref/init/all.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 3666ca425..4111ca8a9 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1474,7 +1474,10 @@ pref("network.http.request.max-start-delay", 10); pref("network.http.request.max-attempts", 10); // Headers -pref("network.http.accept.default", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); +pref("network.http.accept.default", "*/*"); +pref("network.http.accept.navigation", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); +pref("network.http.accept.image", "image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"); +pref("network.http.accept.style", "text/css,*/*;q=0.1"); // Prefs allowing granular control of referers // 0=don't send any, 1=send only on clicks, 2=send on image requests as well -- cgit v1.2.3 From 890bb438b000821586c076ed8f880e95ea03f075 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 21 Mar 2019 09:53:24 +0100 Subject: Pref the use of unboxed plain objects in JS and disable by default. This should be all that's needed for #1017, but verification of impact is definitely desired. --- modules/libpref/init/all.js | 1 + 1 file changed, 1 insertion(+) (limited to 'modules') diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 4111ca8a9..aed20c854 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1264,6 +1264,7 @@ pref("javascript.options.strict", false); #ifdef DEBUG pref("javascript.options.strict.debug", false); #endif +pref("javascript.options.unboxed_objects", false); pref("javascript.options.baselinejit", true); pref("javascript.options.ion", true); pref("javascript.options.asmjs", true); -- cgit v1.2.3 From cac3f9678de46298a93537e8913912bba28d89f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Sat, 23 Mar 2019 10:02:03 -0400 Subject: Bug 1338306 - nsIPrefBranch.get*Pref should support providing a default value, r=bsmedberg. --- modules/libpref/nsIPrefBranch.idl | 24 +++++++++-- modules/libpref/nsPrefBranch.cpp | 57 +++++++++++++++++++++++++ modules/libpref/test/unit/test_defaultValues.js | 48 +++++++++++++++++++++ modules/libpref/test/unit/xpcshell.ini | 1 + 4 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 modules/libpref/test/unit/test_defaultValues.js (limited to 'modules') diff --git a/modules/libpref/nsIPrefBranch.idl b/modules/libpref/nsIPrefBranch.idl index ee0c11ef0..900806b42 100644 --- a/modules/libpref/nsIPrefBranch.idl +++ b/modules/libpref/nsIPrefBranch.idl @@ -57,12 +57,16 @@ interface nsIPrefBranch : nsISupports * Called to get the state of an individual boolean preference. * * @param aPrefName The boolean preference to get the state of. + * @param aDefaultValue The value to return if the preference is not set. * * @return boolean The value of the requested boolean preference. * * @see setBoolPref */ - boolean getBoolPref(in string aPrefName); + [optional_argc,binaryname(GetBoolPrefWithDefault)] + boolean getBoolPref(in string aPrefName, [optional] in boolean aDefaultValue); + [noscript,binaryname(GetBoolPref)] + boolean getBoolPrefXPCOM(in string aPrefName); /** * Called to set the state of an individual boolean preference. @@ -83,23 +87,31 @@ interface nsIPrefBranch : nsISupports * are converted to floating point numbers. * * @param aPrefName The floating point preference to get the state of. + * @param aDefaultValue The value to return if the preference is not set. * * @return float The value of the requested floating point preference. * * @see setCharPref */ - float getFloatPref(in string aPrefName); + [optional_argc,binaryname(GetFloatPrefWithDefault)] + float getFloatPref(in string aPrefName, [optional] in float aDefaultValue); + [noscript,binaryname(GetFloatPref)] + float getFloatPrefXPCOM(in string aPrefName); /** * Called to get the state of an individual string preference. * * @param aPrefName The string preference to retrieve. + * @param aDefaultValue The string to return if the preference is not set. * * @return string The value of the requested string preference. * * @see setCharPref */ - string getCharPref(in string aPrefName); + [optional_argc,binaryname(GetCharPrefWithDefault)] + string getCharPref(in string aPrefName, [optional] in string aDefaultValue); + [noscript,binaryname(GetCharPref)] + string getCharPrefXPCOM(in string aPrefName); /** * Called to set the state of an individual string preference. @@ -118,12 +130,16 @@ interface nsIPrefBranch : nsISupports * Called to get the state of an individual integer preference. * * @param aPrefName The integer preference to get the value of. + * @param aDefaultValue The value to return if the preference is not set. * * @return long The value of the requested integer preference. * * @see setIntPref */ - long getIntPref(in string aPrefName); + [optional_argc,binaryname(GetIntPrefWithDefault)] + long getIntPref(in string aPrefName, [optional] in long aDefaultValue); + [noscript,binaryname(GetIntPref)] + long getIntPrefXPCOM(in string aPrefName); /** * Called to set the state of an individual integer preference. diff --git a/modules/libpref/nsPrefBranch.cpp b/modules/libpref/nsPrefBranch.cpp index 98e06aaa4..5173db06e 100644 --- a/modules/libpref/nsPrefBranch.cpp +++ b/modules/libpref/nsPrefBranch.cpp @@ -141,6 +141,20 @@ NS_IMETHODIMP nsPrefBranch::GetPrefType(const char *aPrefName, int32_t *_retval) return NS_OK; } +NS_IMETHODIMP nsPrefBranch::GetBoolPrefWithDefault(const char *aPrefName, + bool aDefaultValue, + uint8_t _argc, bool *_retval) +{ + nsresult rv = GetBoolPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetBoolPref(const char *aPrefName, bool *_retval) { NS_ENSURE_ARG(aPrefName); @@ -156,6 +170,20 @@ NS_IMETHODIMP nsPrefBranch::SetBoolPref(const char *aPrefName, bool aValue) return PREF_SetBoolPref(pref, aValue, mIsDefault); } +NS_IMETHODIMP nsPrefBranch::GetFloatPrefWithDefault(const char *aPrefName, + float aDefaultValue, + uint8_t _argc, float *_retval) +{ + nsresult rv = GetFloatPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval) { NS_ENSURE_ARG(aPrefName); @@ -169,6 +197,21 @@ NS_IMETHODIMP nsPrefBranch::GetFloatPref(const char *aPrefName, float *_retval) return rv; } +NS_IMETHODIMP nsPrefBranch::GetCharPrefWithDefault(const char *aPrefName, + const char *aDefaultValue, + uint8_t _argc, char **_retval) +{ + nsresult rv = GetCharPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + NS_ENSURE_ARG(aDefaultValue); + *_retval = NS_strdup(aDefaultValue); + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetCharPref(const char *aPrefName, char **_retval) { NS_ENSURE_ARG(aPrefName); @@ -195,6 +238,20 @@ nsresult nsPrefBranch::SetCharPrefInternal(const char *aPrefName, const char *aV return PREF_SetCharPref(pref, aValue, mIsDefault); } +NS_IMETHODIMP nsPrefBranch::GetIntPrefWithDefault(const char *aPrefName, + int32_t aDefaultValue, + uint8_t _argc, int32_t *_retval) +{ + nsresult rv = GetIntPref(aPrefName, _retval); + + if (NS_FAILED(rv) && _argc == 1) { + *_retval = aDefaultValue; + return NS_OK; + } + + return rv; +} + NS_IMETHODIMP nsPrefBranch::GetIntPref(const char *aPrefName, int32_t *_retval) { NS_ENSURE_ARG(aPrefName); diff --git a/modules/libpref/test/unit/test_defaultValues.js b/modules/libpref/test/unit/test_defaultValues.js new file mode 100644 index 000000000..d04bcc04a --- /dev/null +++ b/modules/libpref/test/unit/test_defaultValues.js @@ -0,0 +1,48 @@ +/* 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/. */ + +/* Tests for providing a default value to get{Bool,Char,Float,Int}Pref */ + +function run_test() { + var ps = Cc["@mozilla.org/preferences-service;1"] + .getService(Ci.nsIPrefService) + .QueryInterface(Ci.nsIPrefBranch); + + let prefName = "test.default.values.bool"; + do_check_throws(function() { ps.getBoolPref(prefName); }, + Cr.NS_ERROR_UNEXPECTED); + strictEqual(ps.getBoolPref(prefName, false), false); + strictEqual(ps.getBoolPref(prefName, true), true); + ps.setBoolPref(prefName, true); + strictEqual(ps.getBoolPref(prefName), true); + strictEqual(ps.getBoolPref(prefName, false), true); + strictEqual(ps.getBoolPref(prefName, true), true); + + prefName = "test.default.values.char"; + do_check_throws(function() { ps.getCharPref(prefName); }, + Cr.NS_ERROR_UNEXPECTED); + strictEqual(ps.getCharPref(prefName, ""), ""); + strictEqual(ps.getCharPref(prefName, "string"), "string"); + ps.setCharPref(prefName, "foo"); + strictEqual(ps.getCharPref(prefName), "foo"); + strictEqual(ps.getCharPref(prefName, "string"), "foo"); + + prefName = "test.default.values.float"; + do_check_throws(function() { ps.getFloatPref(prefName); }, + Cr.NS_ERROR_UNEXPECTED); + strictEqual(ps.getFloatPref(prefName, 3.5), 3.5); + strictEqual(ps.getFloatPref(prefName, 0), 0); + ps.setCharPref(prefName, 1.75); + strictEqual(ps.getFloatPref(prefName), 1.75); + strictEqual(ps.getFloatPref(prefName, 3.5), 1.75); + + prefName = "test.default.values.int"; + do_check_throws(function() { ps.getIntPref(prefName); }, + Cr.NS_ERROR_UNEXPECTED); + strictEqual(ps.getIntPref(prefName, 3), 3); + strictEqual(ps.getIntPref(prefName, 0), 0); + ps.setIntPref(prefName, 42); + strictEqual(ps.getIntPref(prefName), 42); + strictEqual(ps.getIntPref(prefName, 3), 42); +} diff --git a/modules/libpref/test/unit/xpcshell.ini b/modules/libpref/test/unit/xpcshell.ini index 74c56907a..66458863f 100644 --- a/modules/libpref/test/unit/xpcshell.ini +++ b/modules/libpref/test/unit/xpcshell.ini @@ -13,6 +13,7 @@ support-files = [test_stickyprefs.js] support-files = data/testPrefSticky.js data/testPrefStickyUser.js [test_changeType.js] +[test_defaultValues.js] [test_dirtyPrefs.js] [test_extprefs.js] [test_libPrefs.js] -- cgit v1.2.3 From a2786c051173286c9d7ccee2c3c6a19c15966322 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 1 Apr 2019 00:11:06 +0200 Subject: Remove AIX 1st party code OS checks, part 2 Issue #186 --- modules/libpref/Preferences.cpp | 3 --- 1 file changed, 3 deletions(-) (limited to 'modules') diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index 31867ca0a..c56cad98d 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -1306,9 +1306,6 @@ static nsresult pref_InitInitialObjects() "winpref.js" #elif defined(XP_UNIX) "unix.js" -#if defined(_AIX) - , "aix.js" -#endif #elif defined(XP_BEOS) "beos.js" #endif -- cgit v1.2.3