Bug 566046. 'target' IDL attribute should reflect content attribute. r=sicking
authorMounir Lamouri <mounir.lamouri@gmail.com>
Tue, 01 Jun 2010 11:43:11 +1200
changeset 42963 3a94d43c6543be04fa38bbc0695ce84ce2a62791
parent 42962 95894b2d2c52fb9e3f122e75dc53dd31c65a4ccf
child 42964 15ea57ef5d0018ff90a7ddf49623e1635ab20091
push id13548
push userrocallahan@mozilla.com
push dateTue, 01 Jun 2010 00:00:11 +0000
treeherdermozilla-central@7493eb9e9cbc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs566046
milestone1.9.3a5pre
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 566046. 'target' IDL attribute should reflect content attribute. r=sicking
content/html/content/src/nsHTMLFormElement.cpp
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -351,16 +351,17 @@ nsHTMLFormElement::SetAttr(PRInt32 aName
   return nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix, aValue,
                                        aNotify);
 }
 
 NS_IMPL_STRING_ATTR(nsHTMLFormElement, AcceptCharset, acceptcharset)
 NS_IMPL_STRING_ATTR(nsHTMLFormElement, Enctype, enctype)
 NS_IMPL_STRING_ATTR(nsHTMLFormElement, Method, method)
 NS_IMPL_STRING_ATTR(nsHTMLFormElement, Name, name)
+NS_IMPL_STRING_ATTR(nsHTMLFormElement, Target, target)
 
 NS_IMETHODIMP
 nsHTMLFormElement::GetAction(nsAString& aValue)
 {
   GetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue);
   if (aValue.IsEmpty()) {
     // Avoid resolving action="" to the base uri, bug 297761.
     return NS_OK;
@@ -370,31 +371,16 @@ nsHTMLFormElement::GetAction(nsAString& 
 
 NS_IMETHODIMP
 nsHTMLFormElement::SetAction(const nsAString& aValue)
 {
   return SetAttr(kNameSpaceID_None, nsGkAtoms::action, aValue, PR_TRUE);
 }
 
 NS_IMETHODIMP
-nsHTMLFormElement::GetTarget(nsAString& aValue)
-{
-  if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue)) {
-    GetBaseTarget(aValue);
-  }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsHTMLFormElement::SetTarget(const nsAString& aValue)
-{
-  return SetAttr(kNameSpaceID_None, nsGkAtoms::target, aValue, PR_TRUE);
-}
-
-NS_IMETHODIMP
 nsHTMLFormElement::Submit()
 {
   // Send the submit event
   nsresult rv = NS_OK;
   nsRefPtr<nsPresContext> presContext = GetPresContext();
   if (mPendingSubmission) {
     // aha, we have a pending submission that was not flushed
     // (this happens when form.submit() is called twice)
@@ -811,18 +797,19 @@ nsHTMLFormElement::SubmitSubmission(nsFo
   // there we are.
   PRBool schemeIsJavaScript = PR_FALSE;
   if (NS_SUCCEEDED(actionURI->SchemeIs("javascript", &schemeIsJavaScript)) &&
       schemeIsJavaScript) {
     mIsSubmitting = PR_FALSE;
   }
 
   nsAutoString target;
-  rv = GetTarget(target);
-  NS_ENSURE_SUBMIT_SUCCESS(rv);
+  if (!GetAttr(kNameSpaceID_None, nsGkAtoms::target, target)) {
+    GetBaseTarget(target);
+  }
 
   //
   // Notify observers of submit
   //
   PRBool cancelSubmit = PR_FALSE;
   if (mNotifiedObservers) {
     cancelSubmit = mNotifiedObserversResult;
   } else {