diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-04 13:07:48 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:15 -0500 |
commit | 859fbc139a4c6793ac6ce9112c676ffb1ab8c927 (patch) | |
tree | b34c66d9760857629dc28030d6376535fd65c1f3 /dom/base | |
parent | d8109fa9a0aae6ee09eca1d6b5cfab285af318f9 (diff) | |
download | UXP-859fbc139a4c6793ac6ce9112c676ffb1ab8c927.tar UXP-859fbc139a4c6793ac6ce9112c676ffb1ab8c927.tar.gz UXP-859fbc139a4c6793ac6ce9112c676ffb1ab8c927.tar.lz UXP-859fbc139a4c6793ac6ce9112c676ffb1ab8c927.tar.xz UXP-859fbc139a4c6793ac6ce9112c676ffb1ab8c927.zip |
Bug 1341898 - Make nsDocument::IsWebComponentsEnabled use a cached bool pref;
Note: Minus IPC bit.
Tag UXP Issue #1344
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/CustomElementRegistry.cpp | 2 | ||||
-rw-r--r-- | dom/base/nsContentUtils.cpp | 6 | ||||
-rw-r--r-- | dom/base/nsContentUtils.h | 4 | ||||
-rw-r--r-- | dom/base/nsDocument.cpp | 4 |
4 files changed, 12 insertions, 4 deletions
diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp index c3d25465e..1743779f0 100644 --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -172,7 +172,7 @@ NS_INTERFACE_MAP_END CustomElementRegistry::IsCustomElementEnabled(JSContext* aCx, JSObject* aObject) { return Preferences::GetBool("dom.webcomponents.customelements.enabled") || - Preferences::GetBool("dom.webcomponents.enabled"); + nsContentUtils::IsWebComponentsEnabled(); } /* static */ void diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 800f40fa1..dd6835e57 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -284,6 +284,7 @@ bool nsContentUtils::sIsResourceTimingEnabled = false; bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false; bool nsContentUtils::sIsUserTimingLoggingEnabled = false; bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false; +bool nsContentUtils::sIsWebComponentsEnabled = false; bool nsContentUtils::sEncodeDecodeURLHash = false; bool nsContentUtils::sGettersDecodeURLHash = false; bool nsContentUtils::sPrivacyResistFingerprinting = false; @@ -584,6 +585,9 @@ nsContentUtils::Init() Preferences::AddBoolVarCache(&sIsExperimentalAutocompleteEnabled, "dom.forms.autocomplete.experimental", false); + Preferences::AddBoolVarCache(&sIsWebComponentsEnabled, + "dom.webcomponents.enabled", false); + Preferences::AddBoolVarCache(&sEncodeDecodeURLHash, "dom.url.encode_decode_hash", false); @@ -9834,4 +9838,4 @@ nsContentUtils::IsLocalRefURL(const nsString& aString) } return false; -}
\ No newline at end of file +} diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 606d67de9..80f26c2b0 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2743,6 +2743,9 @@ public: static bool IsLocalRefURL(const nsString& aString); + static bool + IsWebComponentsEnabled() { return sIsWebComponentsEnabled; } + private: static bool InitializeEventTable(); @@ -2850,6 +2853,7 @@ private: static bool sIsUserTimingLoggingEnabled; static bool sIsFrameTimingPrefEnabled; static bool sIsExperimentalAutocompleteEnabled; + static bool sIsWebComponentsEnabled; static bool sEncodeDecodeURLHash; static bool sGettersDecodeURLHash; static bool sPrivacyResistFingerprinting; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index dc12d8fb1..fa40c41ac 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -5710,7 +5710,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject) { JS::Rooted<JSObject*> obj(aCx, aObject); - if (Preferences::GetBool("dom.webcomponents.enabled")) { + if (nsContentUtils::IsWebComponentsEnabled()) { return true; } @@ -5726,7 +5726,7 @@ nsDocument::IsWebComponentsEnabled(JSContext* aCx, JSObject* aObject) bool nsDocument::IsWebComponentsEnabled(dom::NodeInfo* aNodeInfo) { - if (Preferences::GetBool("dom.webcomponents.enabled")) { + if (nsContentUtils::IsWebComponentsEnabled()) { return true; } |