Bug 1563996 - Make browser.xul.error_pages.enabled a static pref. r=bzbarsky

Differential Revision: https://phabricator.services.mozilla.com/D37201

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicholas Nethercote 2019-07-09 07:59:03 +00:00
Родитель 544a779566
Коммит 7c43c6f952
5 изменённых файлов: 15 добавлений и 23 удалений

Просмотреть файл

@ -665,7 +665,6 @@ pref("mousewheel.with_meta.action", 1); // win key on Win, Super/Hyper on Linux
pref("mousewheel.with_control.action",3); pref("mousewheel.with_control.action",3);
pref("mousewheel.with_win.action", 1); pref("mousewheel.with_win.action", 1);
pref("browser.xul.error_pages.enabled", true);
pref("browser.xul.error_pages.expert_bad_cert", false); pref("browser.xul.error_pages.expert_bad_cert", false);
pref("browser.xul.error_pages.show_safe_browsing_details_on_load", false); pref("browser.xul.error_pages.show_safe_browsing_details_on_load", false);

Просмотреть файл

@ -243,10 +243,6 @@ using namespace mozilla::net;
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID); static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
// True means sUseErrorPages has been added to
// preferences var cache.
static bool gAddedPreferencesVarCache = false;
// Number of documents currently loading // Number of documents currently loading
static int32_t gNumberOfDocumentsLoading = 0; static int32_t gNumberOfDocumentsLoading = 0;
@ -271,8 +267,6 @@ const char kBrandBundleURL[] = "chrome://branding/locale/brand.properties";
const char kAppstringsBundleURL[] = const char kAppstringsBundleURL[] =
"chrome://global/locale/appstrings.properties"; "chrome://global/locale/appstrings.properties";
bool nsDocShell::sUseErrorPages = false;
// Global reference to the URI fixup service. // Global reference to the URI fixup service.
nsIURIFixup* nsDocShell::sURIFixup = nullptr; nsIURIFixup* nsDocShell::sURIFixup = nullptr;
@ -2088,7 +2082,8 @@ nsDocShell::GetUseErrorPages(bool* aUseErrorPages) {
NS_IMETHODIMP NS_IMETHODIMP
nsDocShell::SetUseErrorPages(bool aUseErrorPages) { nsDocShell::SetUseErrorPages(bool aUseErrorPages) {
// If mUseErrorPages is set explicitly, stop using sUseErrorPages. // If mUseErrorPages is set explicitly, stop using the
// browser.xul.error_pages_enabled pref.
if (mObserveErrorPages) { if (mObserveErrorPages) {
mObserveErrorPages = false; mObserveErrorPages = false;
} }
@ -4949,14 +4944,7 @@ nsDocShell::Create() {
"security.strict_security_checks.enabled", mUseStrictSecurityChecks); "security.strict_security_checks.enabled", mUseStrictSecurityChecks);
// Should we use XUL error pages instead of alerts if possible? // Should we use XUL error pages instead of alerts if possible?
mUseErrorPages = mUseErrorPages = StaticPrefs::browser_xul_error_pages_enabled();
Preferences::GetBool("browser.xul.error_pages.enabled", mUseErrorPages);
if (!gAddedPreferencesVarCache) {
Preferences::AddBoolVarCache(
&sUseErrorPages, "browser.xul.error_pages.enabled", mUseErrorPages);
gAddedPreferencesVarCache = true;
}
mDisableMetaRefreshWhenInactive = mDisableMetaRefreshWhenInactive =
Preferences::GetBool("browser.meta_refresh_when_inactive.disabled", Preferences::GetBool("browser.meta_refresh_when_inactive.disabled",

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/LinkedList.h" #include "mozilla/LinkedList.h"
#include "mozilla/Maybe.h" #include "mozilla/Maybe.h"
#include "mozilla/Move.h" #include "mozilla/Move.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h" #include "mozilla/WeakPtr.h"
@ -944,7 +945,9 @@ class nsDocShell final : public nsDocLoader,
already_AddRefed<mozilla::dom::ChildSHistory> GetRootSessionHistory(); already_AddRefed<mozilla::dom::ChildSHistory> GetRootSessionHistory();
inline bool UseErrorPages() { inline bool UseErrorPages() {
return (mObserveErrorPages ? sUseErrorPages : mUseErrorPages); return (mObserveErrorPages
? mozilla::StaticPrefs::browser_xul_error_pages_enabled()
: mUseErrorPages);
} }
bool CSSErrorReportingEnabled() const { return mCSSErrorReportingEnabled; } bool CSSErrorReportingEnabled() const { return mCSSErrorReportingEnabled; }
@ -984,9 +987,6 @@ class nsDocShell final : public nsDocLoader,
private: // data members private: // data members
static nsIURIFixup* sURIFixup; static nsIURIFixup* sURIFixup;
// Cached value of the "browser.xul.error_pages.enabled" preference.
static bool sUseErrorPages;
#ifdef DEBUG #ifdef DEBUG
// We're counting the number of |nsDocShells| to help find leaks // We're counting the number of |nsDocShells| to help find leaks
static unsigned long gNumberOfDocShells; static unsigned long gNumberOfDocShells;

Просмотреть файл

@ -277,9 +277,6 @@ pref("chrome.override_package.global", "browser");
pref("chrome.override_package.mozapps", "browser"); pref("chrome.override_package.mozapps", "browser");
pref("chrome.override_package.passwordmgr", "browser"); pref("chrome.override_package.passwordmgr", "browser");
// enable xul error pages
pref("browser.xul.error_pages.enabled", true);
// disable color management // disable color management
pref("gfx.color_management.mode", 0); pref("gfx.color_management.mode", 0);

Просмотреть файл

@ -975,6 +975,14 @@ VARCACHE_PREF(
PREF("browser.visited_color", String, "") PREF("browser.visited_color", String, "")
// Enable xul error pages.
VARCACHE_PREF(
Live,
"browser.xul.error_pages.enabled",
browser_xul_error_pages_enabled,
bool, true
)
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Prefs starting with "canvas." // Prefs starting with "canvas."
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------