Bug 1749663 - Get rid of dom.webcomponents.formAssociatedCustomElement.enabled pref; r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D146743
This commit is contained in:
Edgar Chen 2022-05-19 08:29:21 +00:00
parent d3f8ad3074
commit ee0a09597a
6 changed files with 25 additions and 44 deletions

View File

@ -999,24 +999,22 @@ void CustomElementRegistry::Define(
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);
if (!JS_GetProperty(aCx, constructor, "formAssociated",
&formAssociatedValue)) {
aRv.NoteJSContextException(aCx);
return;
}
// 14.11. Let formAssociatedValue be Get(constructor, "formAssociated").
// Rethrow any exceptions.
JS::Rooted<JS::Value> formAssociatedValue(aCx);
if (!JS_GetProperty(aCx, constructor, "formAssociated",
&formAssociatedValue)) {
aRv.NoteJSContextException(aCx);
return;
}
// 14.12. Set formAssociated to the result of converting
// formAssociatedValue to a boolean. Rethrow any exceptions from
// the conversion.
if (!ValueToPrimitive<bool, eDefault>(
aCx, formAssociatedValue, "formAssociated", &formAssociated)) {
aRv.NoteJSContextException(aCx);
return;
}
// 14.12. Set formAssociated to the result of converting
// formAssociatedValue to a boolean. Rethrow any exceptions from
// the conversion.
if (!ValueToPrimitive<bool, eDefault>(aCx, formAssociatedValue,
"formAssociated", &formAssociated)) {
aRv.NoteJSContextException(aCx);
return;
}
} // Unset mIsCustomDefinitionRunning

View File

@ -268,11 +268,7 @@ void HTMLElement::UpdateFormOwner(bool aBindToTree, Element* aFormIdElement) {
bool HTMLElement::IsFormAssociatedElement() const {
CustomElementData* data = GetCustomElementData();
bool isFormAssociatedCustomElement = data && data->IsFormAssociated();
MOZ_ASSERT_IF(
isFormAssociatedCustomElement,
StaticPrefs::dom_webcomponents_formAssociatedCustomElement_enabled());
return isFormAssociatedCustomElement;
return data && data->IsFormAssociated();
}
void HTMLElement::FieldSetDisabledChanged(bool aNotify) {

View File

@ -5,12 +5,6 @@
"use strict";
add_task(async function init() {
await SpecialPowers.pushPrefEnv({
set: [["dom.webcomponents.formAssociatedCustomElement.enabled", true]],
});
});
add_task(async function report_validity() {
await BrowserTestUtils.withNewTab(
{

View File

@ -13,29 +13,29 @@ interface ElementInternals {
readonly attribute ShadowRoot? shadowRoot;
// Form-associated custom elements
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
void setFormValue((File or USVString or FormData)? value,
optional (File or USVString or FormData)? state);
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
readonly attribute HTMLFormElement? form;
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
void setValidity(optional ValidityStateFlags flags = {},
optional DOMString message,
optional HTMLElement anchor);
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
readonly attribute boolean willValidate;
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
readonly attribute ValidityState validity;
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
readonly attribute DOMString validationMessage;
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
boolean checkValidity();
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
boolean reportValidity();
[Pref="dom.webcomponents.formAssociatedCustomElement.enabled", Throws]
[Throws]
readonly attribute NodeList labels;
};

View File

@ -4108,12 +4108,6 @@
value: false
mirror: always
# Is support for form-associated custom element enabled?
- name: dom.webcomponents.formAssociatedCustomElement.enabled
type: bool
value: true
mirror: always
# Is support for the Web GPU API enabled?
- name: dom.webgpu.enabled
type: RelaxedAtomicBool

View File

@ -1,2 +1 @@
prefs: [dom.webcomponents.formAssociatedCustomElement.enabled:true]
leak-threshold: [default:51200]