Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - browser.autofocus, r=Ehsan

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2019-05-01 21:10:56 +00:00
Родитель 19f484d03e
Коммит 81a8b494c1
5 изменённых файлов: 9 добавлений и 12 удалений

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

@ -310,7 +310,6 @@ nsString* nsContentUtils::sAltText = nullptr;
nsString* nsContentUtils::sModifierSeparator = nullptr;
bool nsContentUtils::sInitialized = false;
bool nsContentUtils::sAutoFocusEnabled = true;
#ifndef RELEASE_OR_BETA
bool nsContentUtils::sBypassCSSOMOriginCheck = false;
#endif
@ -613,8 +612,6 @@ nsresult nsContentUtils::Init() {
sBypassCSSOMOriginCheck = getenv("MOZ_BYPASS_CSSOM_ORIGIN_CHECK");
#endif
Preferences::AddBoolVarCache(&sAutoFocusEnabled, "browser.autofocus", true);
Preferences::AddBoolVarCache(&sIsBytecodeCacheEnabled,
"dom.script_loader.bytecode_cache.enabled",
false);

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

@ -3188,10 +3188,6 @@ class nsContentUtils {
*/
static bool GetUserIsInteracting();
// Check pref "browser.autofocus" to see if we want to enable autofocusing
// elements when the page requests it.
static bool AutoFocusEnabled() { return sAutoFocusEnabled; }
// Check pref "dom.script_loader.bytecode_cache.enabled" to see
// if we want to cache JS bytecode on the cache entry.
static bool IsBytecodeCacheEnabled() { return sIsBytecodeCacheEnabled; }
@ -3408,7 +3404,6 @@ class nsContentUtils {
static bool sIsHandlingKeyBoardEvent;
static bool sAllowXULXBL_for_file;
static bool sAutoFocusEnabled;
#ifndef RELEASE_OR_BETA
static bool sBypassCSSOMOriginCheck;
#endif

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

@ -15,6 +15,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/PresShell.h"
#include "mozilla/TextEditor.h"
#include "mozilla/StaticPrefs.h"
#include "nscore.h"
#include "nsGenericHTMLElement.h"
@ -1606,7 +1607,7 @@ nsresult nsGenericHTMLFormElement::BindToTree(Document* aDocument,
// the document should not be already loaded and the "browser.autofocus"
// preference should be 'true'.
if (IsAutofocusable() && HasAttr(kNameSpaceID_None, nsGkAtoms::autofocus) &&
nsContentUtils::AutoFocusEnabled() && aDocument) {
StaticPrefs::browser_autofocus() && aDocument) {
aDocument->SetAutoFocusElement(this);
}

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

@ -773,6 +773,13 @@ VARCACHE_PREF(
bool, true
)
// See http://dev.w3.org/html5/spec/forms.html#attr-fe-autofocus
VARCACHE_PREF(
"browser.autofocus",
browser_autofocus,
bool, true
)
PREF("browser.display.foreground_color", String, "")
PREF("browser.display.background_color", String, "")
PREF("browser.display.focus_background_color", String, "")

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

@ -309,9 +309,6 @@ pref("browser.underline_anchors", true);
pref("browser.enable_automatic_image_resizing", false);
pref("browser.enable_click_image_resizing", true);
// See http://dev.w3.org/html5/spec/forms.html#attr-fe-autofocus
pref("browser.autofocus", true);
// See http://whatwg.org/specs/web-apps/current-work/#ping
pref("browser.send_pings", false);
pref("browser.send_pings.max_per_link", 1); // limit the number of pings that are sent per link click