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,6 +916,7 @@ 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,
@ -925,7 +926,6 @@ void CustomElementRegistry::Define(
* disabledFeaturesIterable to a sequence<DOMString>.
* Rethrow any exceptions from the conversion.
*/
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled()) {
if (!JSObjectToAtomArray(aCx, constructor, u"disabledFeatures"_ns,
disabledFeatures, aRv)) {
return;
@ -940,7 +940,9 @@ void CustomElementRegistry::Define(
// "shadow".
disableShadow = disabledFeatures.Contains(
static_cast<nsStaticAtom*>(nsGkAtoms::shadow));
}
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled()) {
// 14.11. Let formAssociatedValue be Get(constructor, "formAssociated").
// Rethrow any exceptions.
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
// element or has is value.
CustomElementData* ceData = GetCustomElementData();
if (StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled() &&
ceData) {
if (CustomElementData* ceData = GetCustomElementData()) {
CustomElementDefinition* definition = ceData->GetCustomElementDefinition();
// If the definition is null, the element possible hasn't yet upgraded.
// Fallback to use LookupCustomElementDefinition to find its definition.

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

@ -3704,6 +3704,12 @@
value: false
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?
- name: dom.webcomponents.formAssociatedCustomElement.enabled
type: bool

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

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