diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 08ffe7873be..36396d13246 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -393,6 +393,7 @@ GK_ATOM(format, "format") GK_ATOM(formatNumber, "format-number") GK_ATOM(formenctype, "formenctype") GK_ATOM(formmethod, "formmethod") +GK_ATOM(formnovalidate, "formnovalidate") GK_ATOM(formtarget, "formtarget") GK_ATOM(frame, "frame") GK_ATOM(frameborder, "frameborder") diff --git a/content/html/content/src/nsHTMLButtonElement.cpp b/content/html/content/src/nsHTMLButtonElement.cpp index c33e4398bb3..2a78a1c550c 100644 --- a/content/html/content/src/nsHTMLButtonElement.cpp +++ b/content/html/content/src/nsHTMLButtonElement.cpp @@ -218,6 +218,7 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLButtonElement, FormEnctype, formenctype, kFormDefaultEnctype->tag) NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLButtonElement, FormMethod, formmethod, kFormDefaultMethod->tag) +NS_IMPL_BOOL_ATTR(nsHTMLButtonElement, FormNoValidate, formnovalidate) NS_IMPL_STRING_ATTR(nsHTMLButtonElement, FormTarget, formtarget) NS_IMPL_STRING_ATTR(nsHTMLButtonElement, Name, name) NS_IMPL_INT_ATTR_DEFAULT_VALUE(nsHTMLButtonElement, TabIndex, tabindex, 0) @@ -508,6 +509,9 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) // event is not handled if the window is being destroyed. if (presShell && (event.message != NS_FORM_SUBMIT || mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) || + // We know the element is a submit control, if this check is moved, + // make sure formnovalidate is used only if it's a submit control. + HasAttr(kNameSpaceID_None, nsGkAtoms::formnovalidate) || mForm->CheckValidFormSubmission())) { // TODO: removing this code and have the submit event sent by the form // see bug 592124. diff --git a/content/html/content/src/nsHTMLInputElement.cpp b/content/html/content/src/nsHTMLInputElement.cpp index 66e83c4b5b8..0564f4304ef 100644 --- a/content/html/content/src/nsHTMLInputElement.cpp +++ b/content/html/content/src/nsHTMLInputElement.cpp @@ -973,6 +973,7 @@ NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormEnctype, formenctype, kFormDefaultEnctype->tag) NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(nsHTMLInputElement, FormMethod, formmethod, kFormDefaultMethod->tag) +NS_IMPL_BOOL_ATTR(nsHTMLInputElement, FormNoValidate, formnovalidate) NS_IMPL_STRING_ATTR(nsHTMLInputElement, FormTarget, formtarget) NS_IMPL_BOOL_ATTR(nsHTMLInputElement, Multiple, multiple) NS_IMPL_NON_NEGATIVE_INT_ATTR(nsHTMLInputElement, MaxLength, maxlength) @@ -2442,6 +2443,9 @@ nsHTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor) // form, see bug 592124. if (presShell && (event.message != NS_FORM_SUBMIT || mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) || + // We know the element is a submit control, if this check is moved, + // make sure formnovalidate is used only if it's a submit control. + HasAttr(kNameSpaceID_None, nsGkAtoms::formnovalidate) || mForm->CheckValidFormSubmission())) { // Hold a strong ref while dispatching nsRefPtr form(mForm); diff --git a/content/html/content/test/Makefile.in b/content/html/content/test/Makefile.in index 25bf642f15f..a2ea2232cc5 100644 --- a/content/html/content/test/Makefile.in +++ b/content/html/content/test/Makefile.in @@ -224,6 +224,7 @@ _TEST_FILES = \ test_bug557628-1.html \ test_bug557628-2.html \ test_bug592802.html \ + test_bug589696.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/html/content/test/test_bug589696.html b/content/html/content/test/test_bug589696.html new file mode 100644 index 00000000000..fd0718a1c23 --- /dev/null +++ b/content/html/content/test/test_bug589696.html @@ -0,0 +1,163 @@ + + + + + Test for Bug 589696 + + + + + + +Mozilla Bug 589696 +

+ +
+ +
+ + + +
+
+ + + +
+ +
+ +
+ +
+ + +
+
+ + +
+
+
+
+
+ + diff --git a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl index 1a8dd107628..af7405a5563 100644 --- a/dom/interfaces/html/nsIDOMHTMLButtonElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLButtonElement.idl @@ -49,7 +49,7 @@ interface nsIDOMValidityState; -[scriptable, uuid(d76a7412-f70b-43fe-becb-d30dac13cc7b)] +[scriptable, uuid(bcae78a1-9f9b-46bf-abb5-a3fe410d97ae)] interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement { attribute boolean autofocus; @@ -58,6 +58,7 @@ interface nsIDOMHTMLButtonElement : nsIDOMHTMLElement attribute DOMString formAction; attribute DOMString formEnctype; attribute DOMString formMethod; + attribute boolean formNoValidate; attribute DOMString formTarget; attribute DOMString name; diff --git a/dom/interfaces/html/nsIDOMHTMLInputElement.idl b/dom/interfaces/html/nsIDOMHTMLInputElement.idl index 59043c8130e..3730fd7090a 100644 --- a/dom/interfaces/html/nsIDOMHTMLInputElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLInputElement.idl @@ -51,7 +51,7 @@ interface nsIDOMValidityState; * http://www.w3.org/TR/DOM-Level-2-HTML/ */ -[scriptable, uuid(2f79a4be-8143-45fc-ac42-67cd16b2322f)] +[scriptable, uuid(0805059d-f18f-4095-ae6b-0bf6df80b7b8)] interface nsIDOMHTMLInputElement : nsIDOMHTMLElement { attribute DOMString accept; @@ -66,6 +66,7 @@ interface nsIDOMHTMLInputElement : nsIDOMHTMLElement attribute DOMString formAction; attribute DOMString formEnctype; attribute DOMString formMethod; + attribute boolean formNoValidate; attribute DOMString formTarget; readonly attribute nsIDOMFileList files;