Bug 707448 - Cleanup nsHTMLFormElement::DoSubmitOrReset a bit; r=mounir
authorMs2ger <ms2ger@gmail.com>
Sun, 18 Dec 2011 11:06:27 +0100
changeset 84512 fa6dc855be00e3f63f31f5dce701ba9bb4a2bc95
parent 84511 f9f6f9ed788a73e0660b0e2d1eeb4ce960b5715a
child 84513 1139f29c7cdfc1ba90da6bda5b795dbbbc6f7482
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs707448
milestone11.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 707448 - Cleanup nsHTMLFormElement::DoSubmitOrReset a bit; r=mounir
content/html/content/src/nsHTMLFormElement.cpp
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -674,35 +674,38 @@ nsHTMLFormElement::DoSubmitOrReset(nsEve
   nsIDocument* doc = GetCurrentDoc();
   if (doc) {
     doc->FlushPendingNotifications(Flush_ContentAndNotify);
   }
 
   // JBK Don't get form frames anymore - bug 34297
 
   // Submit or Reset the form
-  nsresult rv = NS_OK;
   if (NS_FORM_RESET == aMessage) {
-    rv = DoReset();
+    return DoReset();
   }
-  else if (NS_FORM_SUBMIT == aMessage) {
+
+  if (NS_FORM_SUBMIT == aMessage) {
     // Don't submit if we're not in a document.
-    if (doc) {
-      rv = DoSubmit(aEvent);
+    if (!doc) {
+      return NS_OK;
     }
+    return DoSubmit(aEvent);
   }
-  return rv;
+
+  MOZ_ASSERT(false);
+  return NS_OK;
 }
 
 nsresult
 nsHTMLFormElement::DoReset()
 {
   // JBK walk the elements[] array instead of form frame controls - bug 34297
   PRUint32 numElements = GetElementCount();
-  for (PRUint32 elementX = 0; (elementX < numElements); elementX++) {
+  for (PRUint32 elementX = 0; elementX < numElements; ++elementX) {
     // Hold strong ref in case the reset does something weird
     nsCOMPtr<nsIFormControl> controlNode = GetElementAt(elementX);
     if (controlNode) {
       controlNode->Reset();
     }
   }
 
   return NS_OK;