Bug 1723396 - Ship Custom Elements disabledFeatures; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D121491
This commit is contained in:
Edgar Chen 2021-08-03 15:53:46 +00:00
Родитель 2c6fa34fb9
Коммит f7e947ba90
4 изменённых файлов: 19 добавлений и 14 удалений

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

@ -916,16 +916,16 @@ void CustomElementRegistry::Define(
} }
} }
/** if (StaticPrefs::dom_webcomponents_disabledFeatures_enabled()) {
* 14.6. Let disabledFeatures be an empty sequence<DOMString>. /**
* 14.7. Let disabledFeaturesIterable be Get(constructor, * 14.6. Let disabledFeatures be an empty sequence<DOMString>.
* "disabledFeatures"). Rethrow any exceptions. * 14.7. Let disabledFeaturesIterable be Get(constructor,
* 14.8. If disabledFeaturesIterable is not undefined, then set * "disabledFeatures"). Rethrow any exceptions.
* disabledFeatures to the result of converting * 14.8. If disabledFeaturesIterable is not undefined, then set
* disabledFeaturesIterable to a sequence<DOMString>. * disabledFeatures to the result of converting
* Rethrow any exceptions from the conversion. * disabledFeaturesIterable to a sequence<DOMString>.
*/ * Rethrow any exceptions from the conversion.
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled()) { */
if (!JSObjectToAtomArray(aCx, constructor, u"disabledFeatures"_ns, if (!JSObjectToAtomArray(aCx, constructor, u"disabledFeatures"_ns,
disabledFeatures, aRv)) { disabledFeatures, aRv)) {
return; return;
@ -940,7 +940,9 @@ void CustomElementRegistry::Define(
// "shadow". // "shadow".
disableShadow = disabledFeatures.Contains( disableShadow = disabledFeatures.Contains(
static_cast<nsStaticAtom*>(nsGkAtoms::shadow)); static_cast<nsStaticAtom*>(nsGkAtoms::shadow));
}
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled()) {
// 14.11. Let formAssociatedValue be Get(constructor, "formAssociated"). // 14.11. Let formAssociatedValue be Get(constructor, "formAssociated").
// Rethrow any exceptions. // Rethrow any exceptions.
JS::Rooted<JS::Value> formAssociatedValue(aCx); JS::Rooted<JS::Value> formAssociatedValue(aCx);

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

@ -1139,9 +1139,7 @@ bool Element::CanAttachShadowDOM() const {
*/ */
// It will always have CustomElementData when the element is a valid custom // It will always have CustomElementData when the element is a valid custom
// element or has is value. // element or has is value.
CustomElementData* ceData = GetCustomElementData(); if (CustomElementData* ceData = GetCustomElementData()) {
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled() &&
ceData) {
CustomElementDefinition* definition = ceData->GetCustomElementDefinition(); CustomElementDefinition* definition = ceData->GetCustomElementDefinition();
// If the definition is null, the element possible hasn't yet upgraded. // If the definition is null, the element possible hasn't yet upgraded.
// Fallback to use LookupCustomElementDefinition to find its definition. // Fallback to use LookupCustomElementDefinition to find its definition.

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

@ -3704,6 +3704,12 @@
value: false value: false
mirror: always mirror: always
# Is support for custom element disabledFeatures enabled?
- name: dom.webcomponents.disabledFeatures.enabled
type: bool
value: true
mirror: always
# Is support for form-associated custom element enabled? # Is support for form-associated custom element enabled?
- name: dom.webcomponents.formAssociatedCustomElement.enabled - name: dom.webcomponents.formAssociatedCustomElement.enabled
type: bool type: bool

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

@ -1 +0,0 @@
prefs: [dom.webcomponents.formAssociatedCustomElement.enabled:true]