Bug 1749663 - Get rid of dom.webcomponents.formAssociatedCustomElement.enabled pref; r=smaug
authorEdgar Chen <echen@mozilla.com>
Thu, 19 May 2022 08:29:21 +0000
changeset 618214 63df7f3252e9d7206c4b529f5e0e20f3051cb8c8
parent 618213 fec5550d39906b2a58d1a31bfcf5b3068b757a68
child 618215 4947f165b1b049e452be80f689cace188e40b90c
push id39719
push usersmolnar@mozilla.com
push dateThu, 19 May 2022 16:03:14 +0000
treeherdermozilla-central@cc776278c4ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1749663
milestone102.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1749663 - Get rid of dom.webcomponents.formAssociatedCustomElement.enabled pref; r=smaug Differential Revision: https://phabricator.services.mozilla.com/D146743
dom/base/CustomElementRegistry.cpp
dom/html/HTMLElement.cpp
dom/tests/browser/browser_form_associated_custom_elements_validity.js
dom/webidl/ElementInternals.webidl
modules/libpref/init/StaticPrefList.yaml
testing/web-platform/meta/custom-elements/__dir__.ini
--- a/dom/base/CustomElementRegistry.cpp
+++ b/dom/base/CustomElementRegistry.cpp
@@ -994,34 +994,32 @@ void CustomElementRegistry::Define(
     disableInternals = disabledFeatures.Contains(
         static_cast<nsStaticAtom*>(nsGkAtoms::internals));
 
     // 14.10. Set disableShadow to true if disabledFeaturesSequence contains
     //        "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);
-      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
 
   /**
    * 15. Let definition be a new custom element definition with name name,
    *     local name localName, constructor constructor, prototype prototype,
    *     observed attributes observedAttributes, and lifecycle callbacks
    *     lifecycleCallbacks.
--- a/dom/html/HTMLElement.cpp
+++ b/dom/html/HTMLElement.cpp
@@ -263,21 +263,17 @@ void HTMLElement::UpdateFormOwner(bool a
     args.mForm = newForm;
     nsContentUtils::EnqueueLifecycleCallback(
         ElementCallbackType::eFormAssociated, this, args);
   }
 }
 
 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) {
   // This *has* to be called *before* UpdateBarredFromConstraintValidation
   // because this function depend on our disabled state.
   nsGenericHTMLFormElement::FieldSetDisabledChanged(aNotify);
 
   UpdateBarredFromConstraintValidation();
--- a/dom/tests/browser/browser_form_associated_custom_elements_validity.js
+++ b/dom/tests/browser/browser_form_associated_custom_elements_validity.js
@@ -1,21 +1,15 @@
 /**
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 "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(
     {
       gBrowser,
       url: `data:text/html,<my-control></my-control>`,
     },
     async function(aBrowser) {
       let promisePopupShown = BrowserTestUtils.waitForEvent(
--- a/dom/webidl/ElementInternals.webidl
+++ b/dom/webidl/ElementInternals.webidl
@@ -8,39 +8,39 @@
  */
 
 [Exposed=Window]
 interface ElementInternals {
   // Shadow root access
   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;
 };
 
 partial interface ElementInternals {
   [ChromeOnly, Throws]
   readonly attribute HTMLElement? validationAnchor;
 };
 
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4103,22 +4103,16 @@
 
 # NOTE: This preference is used in unit tests. If it is removed or its default
 # value changes, please update test_sharedMap_static_prefs.js accordingly.
 - name: dom.webcomponents.shadowdom.report_usage
   type: bool
   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
   value: false
   mirror: always
 
 # Is support for HTMLInputElement.webkitEntries enabled?
 - name: dom.webkitBlink.filesystem.enabled
--- a/testing/web-platform/meta/custom-elements/__dir__.ini
+++ b/testing/web-platform/meta/custom-elements/__dir__.ini
@@ -1,2 +1,1 @@
-prefs: [dom.webcomponents.formAssociatedCustomElement.enabled:true]
 leak-threshold: [default:51200]