Bug 1380415 part 2. Remove XPCOM constraint validation APIs. r=mccr8
authorBoris Zbarsky <bzbarsky@mit.edu>
Thu, 13 Jul 2017 23:46:28 -0400
changeset 419927 a3148fb9d930e3a608605c7a26e03bda72096079
parent 419926 ada83982640a67735452fa92923e43dd7e5ad6bb
child 419928 e23b4fd5dce3a7ef94e21943ebba42af3db30f85
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1380415
milestone56.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 1380415 part 2. Remove XPCOM constraint validation APIs. r=mccr8
dom/html/HTMLButtonElement.cpp
dom/html/HTMLButtonElement.h
dom/html/HTMLFieldSetElement.cpp
dom/html/HTMLFieldSetElement.h
dom/html/HTMLInputElement.cpp
dom/html/HTMLInputElement.h
dom/html/HTMLObjectElement.cpp
dom/html/HTMLObjectElement.h
dom/html/HTMLSelectElement.cpp
dom/html/HTMLSelectElement.h
dom/html/HTMLTextAreaElement.cpp
dom/html/HTMLTextAreaElement.h
dom/html/nsIConstraintValidation.cpp
dom/html/nsIConstraintValidation.h
dom/interfaces/html/nsIDOMHTMLButtonElement.idl
dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
dom/interfaces/html/nsIDOMHTMLInputElement.idl
dom/interfaces/html/nsIDOMHTMLObjectElement.idl
dom/interfaces/html/nsIDOMHTMLSelectElement.idl
dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
dom/webidl/HTMLButtonElement.webidl
dom/webidl/HTMLFieldSetElement.webidl
dom/webidl/HTMLInputElement.webidl
dom/webidl/HTMLObjectElement.webidl
dom/webidl/HTMLOutputElement.webidl
dom/webidl/HTMLSelectElement.webidl
dom/webidl/HTMLTextAreaElement.webidl
--- a/dom/html/HTMLButtonElement.cpp
+++ b/dom/html/HTMLButtonElement.cpp
@@ -82,27 +82,22 @@ NS_IMPL_RELEASE_INHERITED(HTMLButtonElem
 
 // QueryInterface implementation for HTMLButtonElement
 NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(HTMLButtonElement)
   NS_INTERFACE_TABLE_INHERITED(HTMLButtonElement,
                                nsIDOMHTMLButtonElement,
                                nsIConstraintValidation)
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLButtonElement)
-
-NS_IMETHODIMP
+void
 HTMLButtonElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   UpdateState(true);
-
-  return NS_OK;
 }
 
 void
 HTMLButtonElement::UpdateBarredFromConstraintValidation()
 {
   SetBarredFromConstraintValidation(mType == NS_FORM_BUTTON_BUTTON ||
                                     mType == NS_FORM_BUTTON_RESET ||
                                     IsDisabled());
--- a/dom/html/HTMLButtonElement.h
+++ b/dom/html/HTMLButtonElement.h
@@ -158,23 +158,19 @@ public:
     SetHTMLAttr(nsGkAtoms::type, aType, aRv);
   }
   // XPCOM GetValue is fine.
   void SetValue(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::value, aValue, aRv);
   }
 
-  // nsIConstraintValidation::WillValidate is fine.
-  // nsIConstraintValidation::Validity() is fine.
-  // nsIConstraintValidation::GetValidationMessage() is fine.
-  // nsIConstraintValidation::CheckValidity() is fine.
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
-  // nsIConstraintValidation::SetCustomValidity() is fine.
+  // Override SetCustomValidity so we update our state properly when it's called
+  // via bindings.
+  void SetCustomValidity(const nsAString& aError);
 
 protected:
   virtual ~HTMLButtonElement();
 
   bool mDisabledChanged;
   bool mInInternalActivate;
   bool mInhibitStateRestoration;
 };
--- a/dom/html/HTMLFieldSetElement.cpp
+++ b/dom/html/HTMLFieldSetElement.cpp
@@ -54,19 +54,16 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLFieldSetElement)
 
 
 NS_IMPL_BOOL_ATTR(HTMLFieldSetElement, Disabled, disabled)
 NS_IMPL_STRING_ATTR(HTMLFieldSetElement, Name, name)
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION(HTMLFieldSetElement)
-
 bool
 HTMLFieldSetElement::IsDisabledForEvents(EventMessage aMessage)
 {
   return IsElementDisabledForEvents(aMessage, nullptr);
 }
 
 // nsIContent
 nsresult
--- a/dom/html/HTMLFieldSetElement.h
+++ b/dom/html/HTMLFieldSetElement.h
@@ -19,20 +19,18 @@ class EventChainPreVisitor;
 namespace dom {
 
 class HTMLFieldSetElement final : public nsGenericHTMLFormElement,
                                   public nsIDOMHTMLFieldSetElement,
                                   public nsIConstraintValidation
 {
 public:
   using nsGenericHTMLFormElement::GetForm;
-  using nsIConstraintValidation::Validity;
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
   using nsIConstraintValidation::GetValidationMessage;
+  using nsIConstraintValidation::SetCustomValidity;
 
   explicit HTMLFieldSetElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
 
   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLFieldSetElement, fieldset)
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1272,19 +1272,16 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION
                                nsITextControlElement,
                                imgINotificationObserver,
                                nsIImageLoadingContent,
                                imgIOnloadBlocker,
                                nsIDOMNSEditableElement,
                                nsIConstraintValidation)
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLInputElement)
-
 // nsIDOMNode
 
 nsresult
 HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                         bool aPreallocateArrays) const
 {
   *aResult = nullptr;
 
@@ -7118,24 +7115,22 @@ HTMLInputElement::GetStep() const
     step = std::max(step.round(), Decimal(1));
   }
 
   return step * GetStepScaleFactor();
 }
 
 // nsIConstraintValidation
 
-NS_IMETHODIMP
+void
 HTMLInputElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   UpdateState(true);
-
-  return NS_OK;
 }
 
 bool
 HTMLInputElement::IsTooLong()
 {
   if (!mValueChanged ||
       !mLastValueChangeWasInteractive) {
     return false;
@@ -7331,23 +7326,16 @@ HTMLInputElement::UpdateBarredFromConstr
 {
   SetBarredFromConstraintValidation(mType == NS_FORM_INPUT_HIDDEN ||
                                     mType == NS_FORM_INPUT_BUTTON ||
                                     mType == NS_FORM_INPUT_RESET ||
                                     HasAttr(kNameSpaceID_None, nsGkAtoms::readonly) ||
                                     IsDisabled());
 }
 
-void
-HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
-                                       ErrorResult& aRv)
-{
-  aRv = GetValidationMessage(aValidationMessage);
-}
-
 nsresult
 HTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
                                        ValidityStateType aType)
 {
   return mInputType->GetValidationMessage(aValidationMessage, aType);
 }
 
 NS_IMETHODIMP_(bool)
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -131,20 +131,16 @@ class HTMLInputElement final : public ns
                                public nsIConstraintValidation
 {
   friend class AfterSetFilesOrDirectoriesCallback;
   friend class DispatchChangeEventCallback;
   friend class ::InputType;
 
 public:
   using nsIConstraintValidation::GetValidationMessage;
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
-  using nsIConstraintValidation::WillValidate;
-  using nsIConstraintValidation::Validity;
   using nsGenericHTMLFormElementWithState::GetForm;
 
   enum class FromClone { no, yes };
 
   HTMLInputElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
                    mozilla::dom::FromParser aFromParser,
                    FromClone aFromClone = FromClone::no);
 
@@ -360,16 +356,21 @@ public:
   void     UpdateRangeOverflowValidityState();
   void     UpdateRangeUnderflowValidityState();
   void     UpdateStepMismatchValidityState();
   void     UpdateBadInputValidityState();
   void     UpdateAllValidityStates(bool aNotify);
   void     UpdateBarredFromConstraintValidation();
   nsresult GetValidationMessage(nsAString& aValidationMessage,
                                 ValidityStateType aType) override;
+
+  // Override SetCustomValidity so we update our state properly when it's called
+  // via bindings.
+  void SetCustomValidity(const nsAString& aError);
+
   /**
    * Update the value missing validity state for radio elements when they have
    * a group.
    *
    * @param aIgnoreSelf Whether the required attribute and the checked state
    * of the current radio should be ignored.
    * @note This method shouldn't be called if the radio element hasn't a group.
    */
@@ -758,20 +759,16 @@ public:
   /**
    * Returns the current step value.
    * Returns kStepAny if the current step is "any" string.
    *
    * @return the current step value.
    */
   Decimal GetStep() const;
 
-  void GetValidationMessage(nsAString& aValidationMessage, ErrorResult& aRv);
-
-  // XPCOM GetCustomVisibility() is OK
-
   already_AddRefed<nsINodeList> GetLabels();
 
   void Select();
 
   Nullable<uint32_t> GetSelectionStart(ErrorResult& aRv);
   void SetSelectionStart(const Nullable<uint32_t>& aValue, ErrorResult& aRv);
 
   Nullable<uint32_t> GetSelectionEnd(ErrorResult& aRv);
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -110,19 +110,16 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION
                                nsIImageLoadingContent,
                                imgIOnloadBlocker,
                                nsIChannelEventSink,
                                nsIConstraintValidation)
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElement)
 
 NS_IMPL_ELEMENT_CLONE(HTMLObjectElement)
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION(HTMLObjectElement)
-
 #ifdef XP_MACOSX
 
 static nsIWidget* GetWidget(Element* aElement)
 {
   return nsContentUtils::WidgetForDocument(aElement->OwnerDoc());
 }
 
 Element* HTMLObjectElement::sLastFocused = nullptr; // Weak
--- a/dom/html/HTMLObjectElement.h
+++ b/dom/html/HTMLObjectElement.h
@@ -149,19 +149,18 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::height, aValue, aRv);
   }
   using nsObjectLoadingContent::GetContentDocument;
 
   nsPIDOMWindowOuter*
   GetContentWindow(nsIPrincipal& aSubjectPrincipal);
 
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
   using nsIConstraintValidation::GetValidationMessage;
+  using nsIConstraintValidation::SetCustomValidity;
   void GetAlign(DOMString& aValue)
   {
     GetHTMLAttr(nsGkAtoms::align, aValue);
   }
   void SetAlign(const nsAString& aValue, ErrorResult& aRv)
   {
     SetHTMLAttr(nsGkAtoms::align, aValue, aRv);
   }
--- a/dom/html/HTMLSelectElement.cpp
+++ b/dom/html/HTMLSelectElement.cpp
@@ -176,27 +176,22 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION
 NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLFormElementWithState)
 
 
 // nsIDOMHTMLSelectElement
 
 
 NS_IMPL_ELEMENT_CLONE(HTMLSelectElement)
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLSelectElement)
-
-NS_IMETHODIMP
+void
 HTMLSelectElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   UpdateState(true);
-
-  return NS_OK;
 }
 
 void
 HTMLSelectElement::GetAutocomplete(DOMString& aValue)
 {
   const nsAttrValue* attributeVal = GetParsedAttr(nsGkAtoms::autocomplete);
 
   mAutocompleteAttrState =
--- a/dom/html/HTMLSelectElement.h
+++ b/dom/html/HTMLSelectElement.h
@@ -270,23 +270,19 @@ public:
   }
   void SetSelectedIndex(int32_t aIdx, ErrorResult& aRv)
   {
     aRv = SetSelectedIndexInternal(aIdx, true);
   }
   void GetValue(DOMString& aValue);
   // Uses XPCOM SetValue.
 
-  // nsIConstraintValidation::WillValidate is fine.
-  // nsIConstraintValidation::Validity() is fine.
-  // nsIConstraintValidation::GetValidationMessage() is fine.
-  // nsIConstraintValidation::CheckValidity() is fine.
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
-  // nsIConstraintValidation::SetCustomValidity() is fine.
+  // Override SetCustomValidity so we update our state properly when it's called
+  // via bindings.
+  void SetCustomValidity(const nsAString& aError);
 
   using nsINode::Remove;
 
   // nsINode
   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
 
   // nsIContent
   virtual nsresult GetEventTargetParent(
--- a/dom/html/HTMLTextAreaElement.cpp
+++ b/dom/html/HTMLTextAreaElement.cpp
@@ -123,20 +123,16 @@ HTMLTextAreaElement::Clone(mozilla::dom:
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   it->mLastValueChangeWasInteractive = mLastValueChangeWasInteractive;
   it.forget(aResult);
   return NS_OK;
 }
 
-// nsIConstraintValidation
-NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(HTMLTextAreaElement)
-
-
 NS_IMETHODIMP
 HTMLTextAreaElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   return nsGenericHTMLFormElementWithState::GetForm(aForm);
 }
 
 
 // nsIContent
@@ -1153,26 +1149,22 @@ bool
 HTMLTextAreaElement::IsValueEmpty() const
 {
   nsAutoString value;
   GetValueInternal(value, true);
 
   return value.IsEmpty();
 }
 
-// nsIConstraintValidation
-
-NS_IMETHODIMP
+void
 HTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
 {
   nsIConstraintValidation::SetCustomValidity(aError);
 
   UpdateState(true);
-
-  return NS_OK;
 }
 
 bool
 HTMLTextAreaElement::IsTooLong()
 {
   if (!mValueChanged ||
       !mLastValueChangeWasInteractive ||
       !HasAttr(kNameSpaceID_None, nsGkAtoms::maxlength)) {
--- a/dom/html/HTMLTextAreaElement.h
+++ b/dom/html/HTMLTextAreaElement.h
@@ -281,23 +281,21 @@ public:
   {
     SetHTMLAttr(nsGkAtoms::wrap, aWrap, aError);
   }
   // XPCOM GetType is fine
   // XPCOM GetDefaultValue is fine
   void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError);
   // XPCOM GetValue/SetValue are fine
   uint32_t GetTextLength();
-  // nsIConstraintValidation::WillValidate is fine.
-  // nsIConstraintValidation::Validity() is fine.
-  // nsIConstraintValidation::GetValidationMessage() is fine.
-  // nsIConstraintValidation::CheckValidity() is fine.
-  using nsIConstraintValidation::CheckValidity;
-  using nsIConstraintValidation::ReportValidity;
-  // nsIConstraintValidation::SetCustomValidity() is fine.
+
+  // Override SetCustomValidity so we update our state properly when it's called
+  // via bindings.
+  void SetCustomValidity(const nsAString& aError);
+
   // XPCOM Select is fine
   Nullable<uint32_t> GetSelectionStart(ErrorResult& aError);
   void SetSelectionStart(const Nullable<uint32_t>& aSelectionStart, ErrorResult& aError);
   Nullable<uint32_t> GetSelectionEnd(ErrorResult& aError);
   void SetSelectionEnd(const Nullable<uint32_t>& aSelectionEnd, ErrorResult& aError);
   void GetSelectionDirection(nsAString& aDirection, ErrorResult& aError);
   void SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError);
   void SetSelectionRange(uint32_t aSelectionStart, uint32_t aSelectionEnd, const Optional<nsAString>& aDirecton, ErrorResult& aError);
--- a/dom/html/nsIConstraintValidation.cpp
+++ b/dom/html/nsIConstraintValidation.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIConstraintValidation.h"
 
 #include "nsAString.h"
 #include "nsGenericHTMLElement.h"
+#include "mozilla/ErrorResult.h"
 #include "mozilla/dom/HTMLFormElement.h"
 #include "mozilla/dom/HTMLFieldSetElement.h"
 #include "mozilla/dom/HTMLInputElement.h"
 #include "mozilla/dom/ValidityState.h"
 #include "nsIFormControl.h"
 #include "nsContentUtils.h"
 
 #include "nsIFormSubmitObserver.h"
@@ -49,18 +50,19 @@ nsIConstraintValidation::GetValidity(nsI
 {
   NS_ENSURE_ARG_POINTER(aValidity);
 
   NS_ADDREF(*aValidity = Validity());
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
+void
+nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage,
+                                              ErrorResult& aError)
 {
   aValidationMessage.Truncate();
 
   if (IsCandidateForConstraintValidation() && !IsValid()) {
     nsCOMPtr<nsIContent> content = do_QueryInterface(this);
     NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
 
     nsAutoString authorMessage;
@@ -92,23 +94,22 @@ nsIConstraintValidation::GetValidationMe
     } else if (GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW)) {
       GetValidationMessage(aValidationMessage, VALIDITY_STATE_RANGE_UNDERFLOW);
     } else if (GetValidityState(VALIDITY_STATE_STEP_MISMATCH)) {
       GetValidationMessage(aValidationMessage, VALIDITY_STATE_STEP_MISMATCH);
     } else if (GetValidityState(VALIDITY_STATE_BAD_INPUT)) {
       GetValidationMessage(aValidationMessage, VALIDITY_STATE_BAD_INPUT);
     } else {
       // There should not be other validity states.
-      return NS_ERROR_UNEXPECTED;
+      aError.Throw(NS_ERROR_UNEXPECTED);
+      return;
     }
   } else {
     aValidationMessage.Truncate();
   }
-
-  return NS_OK;
 }
 
 bool
 nsIConstraintValidation::CheckValidity()
 {
   if (!IsCandidateForConstraintValidation() || IsValid()) {
     return true;
   }
--- a/dom/html/nsIConstraintValidation.h
+++ b/dom/html/nsIConstraintValidation.h
@@ -8,16 +8,17 @@
 #define nsIConstraintValidition_h___
 
 #include "nsISupports.h"
 #include "nsString.h"
 
 class nsIDOMValidityState;
 
 namespace mozilla {
+class ErrorResult;
 namespace dom {
 class ValidityState;
 } // namespace dom
 } // namespace mozilla
 
 #define NS_ICONSTRAINTVALIDATION_IID \
 { 0x983829da, 0x1aaf, 0x449c, \
  { 0xa3, 0x06, 0x85, 0xd4, 0xf0, 0x31, 0x1c, 0xf6 } }
@@ -42,17 +43,18 @@ public:
   virtual ~nsIConstraintValidation();
 
   bool IsValid() const { return mValidityBitField == 0; }
 
   bool IsCandidateForConstraintValidation() const {
            return !mBarredFromConstraintValidation;
          }
 
-  NS_IMETHOD GetValidationMessage(nsAString& aValidationMessage);
+  void GetValidationMessage(nsAString& aValidationMessage,
+                            mozilla::ErrorResult& aError);
 
   enum ValidityStateType
   {
     VALIDITY_STATE_VALUE_MISSING    = 0x1 <<  0,
     VALIDITY_STATE_TYPE_MISMATCH    = 0x1 <<  1,
     VALIDITY_STATE_PATTERN_MISMATCH = 0x1 <<  2,
     VALIDITY_STATE_TOO_LONG         = 0x1 <<  3,
     VALIDITY_STATE_TOO_SHORT        = 0x1 <<  4,
@@ -115,64 +117,13 @@ private:
   bool                          mBarredFromConstraintValidation;
 
   /**
    * The string representing the custom error.
    */
   nsString                      mCustomValidity;
 };
 
-/**
- * Use these macro for class inheriting from nsIConstraintValidation to forward
- * functions to nsIConstraintValidation.
- */
-#define NS_FORWARD_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY           \
-  NS_IMETHOD GetValidity(nsIDOMValidityState** aValidity) {                   \
-    return nsIConstraintValidation::GetValidity(aValidity);                   \
-  }                                                                           \
-  NS_IMETHOD GetWillValidate(bool* aWillValidate) {                           \
-    *aWillValidate = WillValidate();                                          \
-    return NS_OK;                                                             \
-  }                                                                           \
-  NS_IMETHOD GetValidationMessage(nsAString& aValidationMessage) {            \
-    return nsIConstraintValidation::GetValidationMessage(aValidationMessage); \
-  }                                                                           \
-  using nsIConstraintValidation::CheckValidity;                               \
-  NS_IMETHOD CheckValidity(bool* aValidity) {                                 \
-    return nsIConstraintValidation::CheckValidity(aValidity);                 \
-  }
-
-#define NS_FORWARD_NSICONSTRAINTVALIDATION                                    \
-  NS_FORWARD_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY                 \
-  NS_IMETHOD SetCustomValidity(const nsAString& aError) {                     \
-    nsIConstraintValidation::SetCustomValidity(aError);                       \
-    return NS_OK;                                                             \
-  }
-
-
-/* Use these macro when class declares functions from nsIConstraintValidation */
-#define NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from)       \
-  NS_IMETHODIMP _from::GetValidity(nsIDOMValidityState** aValidity) {         \
-    return nsIConstraintValidation::GetValidity(aValidity);                   \
-  }                                                                           \
-  NS_IMETHODIMP _from::GetWillValidate(bool* aWillValidate) {                 \
-    *aWillValidate = WillValidate();                                          \
-    return NS_OK;                                                             \
-  }                                                                           \
-  NS_IMETHODIMP _from::GetValidationMessage(nsAString& aValidationMessage) {  \
-    return nsIConstraintValidation::GetValidationMessage(aValidationMessage); \
-  }                                                                           \
-  NS_IMETHODIMP _from::CheckValidity(bool* aValidity) {                     \
-    return nsIConstraintValidation::CheckValidity(aValidity);                 \
-  }
-
-#define NS_IMPL_NSICONSTRAINTVALIDATION(_from)                                \
-  NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from)             \
-  NS_IMETHODIMP _from::SetCustomValidity(const nsAString& aError) {           \
-    nsIConstraintValidation::SetCustomValidity(aError);                       \
-    return NS_OK;                                                             \
-  }
-
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIConstraintValidation,
                               NS_ICONSTRAINTVALIDATION_IID)
 
 #endif // nsIConstraintValidation_h___
 
--- a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl
@@ -28,18 +28,10 @@ interface nsIDOMHTMLButtonElement : nsIS
            attribute DOMString             formEnctype;
            attribute DOMString             formMethod;
            attribute boolean               formNoValidate;
            attribute DOMString             formTarget;
 
            attribute DOMString             name;
            attribute DOMString             type;
            attribute DOMString             value;
-
-  // The following lines are part of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean             willValidate;
-  readonly attribute nsIDOMValidityState validity;
-  readonly attribute DOMString           validationMessage;
-  boolean checkValidity();
-  void setCustomValidity(in DOMString error);
 };
 
--- a/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLFieldSetElement.idl
@@ -23,17 +23,9 @@ interface nsIDOMHTMLFieldSetElement : ns
 {
            attribute boolean                disabled;
   readonly attribute nsIDOMHTMLFormElement  form;
            attribute DOMString              name;
 
   readonly attribute DOMString              type;
 
   readonly attribute nsIDOMHTMLCollection   elements;
-
-  // The following lines are parte of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean               willValidate;
-  readonly attribute nsIDOMValidityState   validity;
-  readonly attribute DOMString             validationMessage;
-  boolean checkValidity();
-  void setCustomValidity(in DOMString error);
 };
--- a/dom/interfaces/html/nsIDOMHTMLInputElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl
@@ -31,18 +31,10 @@ interface nsIDOMHTMLInputElement : nsISu
            attribute boolean               indeterminate;
 
   readonly attribute nsIDOMHTMLElement     list;
 
            attribute DOMString             name;
 
            attribute boolean               readOnly;
 
-  // The following lines are part of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean             willValidate;
-  readonly attribute nsIDOMValidityState validity;
-  readonly attribute DOMString           validationMessage;
-  boolean checkValidity();
-  void setCustomValidity(in DOMString error);
-
   readonly attribute nsIControllers        controllers;	
 };
--- a/dom/interfaces/html/nsIDOMHTMLObjectElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLObjectElement.idl
@@ -35,17 +35,9 @@ interface nsIDOMHTMLObjectElement : nsIS
            attribute DOMString             name;
            attribute DOMString             standby;
            attribute DOMString             type;
            attribute DOMString             useMap;
            attribute long                  vspace;
            attribute DOMString             width;
   // Introduced in DOM Level 2:
   readonly attribute nsIDOMDocument        contentDocument;
-
-  // The following lines are parte of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean               willValidate;
-  readonly attribute nsIDOMValidityState   validity;
-  readonly attribute DOMString             validationMessage;
-  boolean  checkValidity();
-  void     setCustomValidity(in DOMString error);
 };
--- a/dom/interfaces/html/nsIDOMHTMLSelectElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLSelectElement.idl
@@ -43,18 +43,10 @@ interface nsIDOMHTMLSelectElement : nsIS
                                 [optional] in nsIVariant before)
                                                      raises(DOMException);   
   void                      remove(in long index);
 
   readonly attribute nsIDOMHTMLCollection  selectedOptions;
            attribute long                  selectedIndex;
            attribute DOMString             value;
 
-  // The following lines are part of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean             willValidate;
-  readonly attribute nsIDOMValidityState validity;
-  readonly attribute DOMString           validationMessage;
-  boolean checkValidity();
-  void setCustomValidity(in DOMString error);
-
   attribute boolean                      required;
 };
--- a/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
+++ b/dom/interfaces/html/nsIDOMHTMLTextAreaElement.idl
@@ -40,23 +40,15 @@ interface nsIDOMHTMLTextAreaElement : ns
   [Null(Stringify)]
            attribute DOMString             wrap;
 
   readonly attribute DOMString             type;
            attribute DOMString             defaultValue;
            attribute DOMString             value;
   readonly attribute long                  textLength;
 
-  // The following lines are part of the constraint validation API, see:
-  // http://www.whatwg.org/specs/web-apps/current-work/#the-constraint-validation-api
-  readonly attribute boolean               willValidate;
-  readonly attribute nsIDOMValidityState   validity;
-  readonly attribute DOMString             validationMessage;
-  boolean checkValidity();
-  void setCustomValidity(in DOMString error);
-
   void select();
 
   // Mozilla extensions
   // Please make sure to update the HTMLTextAreaElement Web IDL interface to
   // mirror the list of Mozilla extensions here when changing it.
   readonly attribute nsIControllers   controllers;
 };
--- a/dom/webidl/HTMLButtonElement.webidl
+++ b/dom/webidl/HTMLButtonElement.webidl
@@ -33,15 +33,16 @@ interface HTMLButtonElement : HTMLElemen
            attribute DOMString name;
   [CEReactions, SetterThrows, Pure]
            attribute DOMString type;
   [CEReactions, SetterThrows, Pure]
            attribute DOMString value;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 
   readonly attribute NodeList labels;
 };
--- a/dom/webidl/HTMLFieldSetElement.webidl
+++ b/dom/webidl/HTMLFieldSetElement.webidl
@@ -20,15 +20,16 @@ interface HTMLFieldSetElement : HTMLElem
            attribute DOMString name;
 
   readonly attribute DOMString type;
 
   readonly attribute HTMLCollection elements;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
 
   boolean checkValidity();
   boolean reportValidity();
 
   void setCustomValidity(DOMString error);
 };
--- a/dom/webidl/HTMLInputElement.webidl
+++ b/dom/webidl/HTMLInputElement.webidl
@@ -102,17 +102,17 @@ interface HTMLInputElement : HTMLElement
   void stepUp(optional long n = 1);
   [Throws]
   void stepDown(optional long n = 1);
 
   [Pure]
   readonly attribute boolean willValidate;
   [Pure]
   readonly attribute ValidityState validity;
-  [GetterThrows]
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 
   readonly attribute NodeList? labels;
 
   void select();
--- a/dom/webidl/HTMLObjectElement.webidl
+++ b/dom/webidl/HTMLObjectElement.webidl
@@ -35,16 +35,17 @@ interface HTMLObjectElement : HTMLElemen
   [NeedsSubjectPrincipal]
   readonly attribute Document? contentDocument;
   // Not pure: can trigger about:blank instantiation
   [NeedsSubjectPrincipal]
   readonly attribute WindowProxy? contentWindow;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 };
 
 // http://www.whatwg.org/specs/web-apps/current-work/#HTMLObjectElement-partial
 partial interface HTMLObjectElement {
--- a/dom/webidl/HTMLOutputElement.webidl
+++ b/dom/webidl/HTMLOutputElement.webidl
@@ -24,15 +24,16 @@ interface HTMLOutputElement : HTMLElemen
   readonly attribute DOMString type;
   [CEReactions, SetterThrows, Pure]
            attribute DOMString defaultValue;
   [CEReactions, SetterThrows, Pure]
            attribute DOMString value;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 
   readonly attribute NodeList labels;
 };
--- a/dom/webidl/HTMLSelectElement.webidl
+++ b/dom/webidl/HTMLSelectElement.webidl
@@ -45,16 +45,17 @@ interface HTMLSelectElement : HTMLElemen
   readonly attribute HTMLCollection selectedOptions;
   [SetterThrows, Pure]
            attribute long selectedIndex;
   [Pure]
            attribute DOMString value;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 
   readonly attribute NodeList labels;
 
   // https://www.w3.org/Bugs/Public/show_bug.cgi?id=20720
--- a/dom/webidl/HTMLTextAreaElement.webidl
+++ b/dom/webidl/HTMLTextAreaElement.webidl
@@ -48,16 +48,17 @@ interface HTMLTextAreaElement : HTMLElem
   readonly attribute DOMString type;
   [CEReactions, SetterThrows, Pure]
            attribute DOMString defaultValue;
   [CEReactions, TreatNullAs=EmptyString] attribute DOMString value;
   readonly attribute unsigned long textLength;
 
   readonly attribute boolean willValidate;
   readonly attribute ValidityState validity;
+  [Throws]
   readonly attribute DOMString validationMessage;
   boolean checkValidity();
   boolean reportValidity();
   void setCustomValidity(DOMString error);
 
   readonly attribute NodeList labels;
 
   void select();