Bug 1431255 - Part I, Add dom.ua_widget.enabled pref and enable for Desktop Nightly only
This would allow us to control this feature independently of the Shadow DOM pref.
The feature is only turned on when Shadow DOM is turned on.
MozReview-Commit-ID: 4g6BJigFUZs
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -295,16 +295,17 @@ bool nsContentUtils::sIsUnprefixedFullsc
bool nsContentUtils::sTrustedFullScreenOnly = true;
bool nsContentUtils::sIsCutCopyAllowed = true;
bool nsContentUtils::sIsUpgradableDisplayContentPrefEnabled = false;
bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
bool nsContentUtils::sIsResourceTimingEnabled = false;
bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
bool nsContentUtils::sIsFormAutofillAutocompleteEnabled = false;
+bool nsContentUtils::sIsUAWidgetEnabled = false;
bool nsContentUtils::sIsShadowDOMEnabled = false;
bool nsContentUtils::sIsCustomElementsEnabled = false;
bool nsContentUtils::sSendPerformanceTimingNotifications = false;
bool nsContentUtils::sUseActivityCursor = false;
bool nsContentUtils::sAnimationsAPICoreEnabled = false;
bool nsContentUtils::sGetBoxQuadsEnabled = false;
bool nsContentUtils::sSkipCursorMoveForSameValueSet = false;
bool nsContentUtils::sRequestIdleCallbackEnabled = false;
@@ -661,16 +662,19 @@ nsContentUtils::Init()
"security.mixed_content.upgrade_display_content", false);
Preferences::AddBoolVarCache(&sIsFrameTimingPrefEnabled,
"dom.enable_frame_timing", false);
Preferences::AddBoolVarCache(&sIsFormAutofillAutocompleteEnabled,
"dom.forms.autocomplete.formautofill", false);
+ Preferences::AddBoolVarCache(&sIsUAWidgetEnabled,
+ "dom.ua_widget.enabled", false);
+
Preferences::AddBoolVarCache(&sIsShadowDOMEnabled,
"dom.webcomponents.shadowdom.enabled", false);
Preferences::AddBoolVarCache(&sIsCustomElementsEnabled,
"dom.webcomponents.customelements.enabled", false);
Preferences::AddIntVarCache(&sPrivacyMaxInnerWidth,
"privacy.window.maxInnerWidth",
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -3103,16 +3103,28 @@ public:
nsContentPolicyType& aContentPolicyType,
uint64_t* aRequestContextID);
static nsresult
CreateJSValueFromSequenceOfObject(JSContext* aCx,
const mozilla::dom::Sequence<JSObject*>& aTransfer,
JS::MutableHandle<JS::Value> aValue);
+ /**
+ * Returns whether or not UA Widget is enabled, controlled by pref
+ * dom.ua_widget.enabled.
+ *
+ * When enabled, UA Widget will replace legacy XBL when rendering JS-implemented
+ * web content widgets (videocontrols/datetimebox/etc.)
+ *
+ * It is really enabled only if Shadow DOM is also enabled.
+ */
+ static bool
+ IsUAWidgetEnabled() { return sIsShadowDOMEnabled && sIsUAWidgetEnabled; }
+
static bool
IsShadowDOMEnabled() { return sIsShadowDOMEnabled; }
/**
* Returns true if reserved key events should be prevented from being sent
* to their target. Instead, the key event should be handled by chrome only.
*/
static bool ShouldBlockReservedKeys(mozilla::WidgetKeyboardEvent* aKeyEvent);
@@ -3422,16 +3434,17 @@ private:
static bool sIsCutCopyAllowed;
static uint32_t sHandlingInputTimeout;
static bool sIsPerformanceTimingEnabled;
static bool sIsResourceTimingEnabled;
static bool sIsPerformanceNavigationTimingEnabled;
static bool sIsUpgradableDisplayContentPrefEnabled;
static bool sIsFrameTimingPrefEnabled;
static bool sIsFormAutofillAutocompleteEnabled;
+ static bool sIsUAWidgetEnabled;
static bool sIsShadowDOMEnabled;
static bool sIsCustomElementsEnabled;
static bool sSendPerformanceTimingNotifications;
static bool sUseActivityCursor;
static bool sAnimationsAPICoreEnabled;
static bool sGetBoxQuadsEnabled;
static bool sSkipCursorMoveForSameValueSet;
static bool sRequestIdleCallbackEnabled;
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -1368,16 +1368,22 @@ pref("privacy.trackingprotection.lower_n
pref("privacy.trackingprotection.lower_network_priority", false);
#endif
pref("dom.event.contextmenu.enabled", true);
pref("dom.event.clipboardevents.enabled", true);
pref("dom.event.highrestimestamp.enabled", true);
pref("dom.event.coalesce_mouse_move", true);
+#if defined(NIGHTLY_BUILD) && !defined(ANDROID)
+pref("dom.ua_widget.enabled", true);
+#else
+pref("dom.ua_widget.enabled", false);
+#endif
+
#ifdef NIGHTLY_BUILD
pref("dom.webcomponents.shadowdom.enabled", true);
pref("dom.webcomponents.customelements.enabled", true);
#else
pref("dom.webcomponents.shadowdom.enabled", false);
pref("dom.webcomponents.customelements.enabled", false);
#endif