Bug 839171 - Update formMethod reflection to have the empty string as default value (and 'get' as invalid value). r=mounir
authorSunny <indiasuny000@gmail.com>
Wed, 13 Feb 2013 10:35:35 -0500
changeset 122028 d999c65753ea3c6ea49d130f9a24f067bbe33704
parent 122027 7dd9c9b874f54d9c6d05b859f453f94680614dff
child 122029 87081ae8b6d6c8c2955b26bcf940820776ce9437
push id23054
push usermlamouri@mozilla.com
push dateFri, 15 Feb 2013 14:20:32 +0000
treeherdermozilla-inbound@d999c65753ea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmounir
bugs839171
milestone21.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 839171 - Update formMethod reflection to have the empty string as default value (and 'get' as invalid value). r=mounir
browser/devtools/debugger/test/browser_dbg_propertyview-11.js
content/html/content/src/HTMLButtonElement.cpp
content/html/content/test/Makefile.in
content/html/content/test/forms/test_button_attributes_reflection.html
content/html/content/test/test_bug585508.html
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-11.js
+++ b/browser/devtools/debugger/test/browser_dbg_propertyview-11.js
@@ -182,17 +182,17 @@ function testFrameParameters()
             "Should have the right property name for 'type' in buttonProtoNode.");
           is(buttonProtoNode.get("type").target.querySelector(".value")
              .getAttribute("value"), '"submit"',
             "'type' in buttonProtoNode should have the right value.");
           is(buttonProtoNode.get("formMethod").target.querySelector(".name")
              .getAttribute("value"), "formMethod",
             "Should have the right property name for 'formMethod' in buttonProtoNode.");
           is(buttonProtoNode.get("formMethod").target.querySelector(".value")
-             .getAttribute("value"), '"get"',
+             .getAttribute("value"), '""',
             "'formMethod' in buttonProtoNode should have the right value.");
 
           is(documentProtoNode.get("baseURI").target.querySelector(".name")
              .getAttribute("value"), "baseURI",
             "Should have the right property name for 'baseURI' in documentProtoNode.");
           is(documentProtoNode.get("baseURI").target.querySelector(".value")
              .getAttribute("value"), '"' + TAB_URL + '"',
             "'baseURI' in documentProtoNode should have the right value.");
@@ -238,17 +238,17 @@ function testFrameParameters()
               "Should have the right property name for 'type' in buttonAsProtoProtoProtoNode.");
             is(buttonAsProtoProtoProtoNode.get("type").target.querySelector(".value")
                .getAttribute("value"), '"submit"',
               "'type' in buttonAsProtoProtoProtoNode should have the right value.");
             is(buttonAsProtoProtoProtoNode.get("formMethod").target.querySelector(".name")
                .getAttribute("value"), "formMethod",
               "Should have the right property name for 'formMethod' in buttonAsProtoProtoProtoNode.");
             is(buttonAsProtoProtoProtoNode.get("formMethod").target.querySelector(".value")
-               .getAttribute("value"), '"get"',
+               .getAttribute("value"), '""',
               "'formMethod' in buttonAsProtoProtoProtoNode should have the right value.");
 
             resumeAndFinish();
           }, 100);
         }, 100);
       }, 100);
     }}, 0);
   }, false);
--- a/content/html/content/src/HTMLButtonElement.cpp
+++ b/content/html/content/src/HTMLButtonElement.cpp
@@ -114,20 +114,20 @@ NS_IMETHODIMP
 HTMLButtonElement::GetForm(nsIDOMHTMLFormElement** aForm)
 {
   return nsGenericHTMLFormElement::GetForm(aForm);
 }
 
 NS_IMPL_BOOL_ATTR(HTMLButtonElement, Autofocus, autofocus)
 NS_IMPL_BOOL_ATTR(HTMLButtonElement, Disabled, disabled)
 NS_IMPL_ACTION_ATTR(HTMLButtonElement, FormAction, formaction)
-NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, FormEnctype, formenctype,
-                                kFormDefaultEnctype->tag)
-NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, FormMethod, formmethod,
-                                kFormDefaultMethod->tag)
+NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormEnctype, formenctype,
+                                                 "", kFormDefaultEnctype->tag)
+NS_IMPL_ENUM_ATTR_DEFAULT_MISSING_INVALID_VALUES(HTMLButtonElement, FormMethod, formmethod,
+                                                 "", kFormDefaultMethod->tag)
 NS_IMPL_BOOL_ATTR(HTMLButtonElement, FormNoValidate, formnovalidate)
 NS_IMPL_STRING_ATTR(HTMLButtonElement, FormTarget, formtarget)
 NS_IMPL_STRING_ATTR(HTMLButtonElement, Name, name)
 NS_IMPL_STRING_ATTR(HTMLButtonElement, Value, value)
 NS_IMPL_ENUM_ATTR_DEFAULT_VALUE(HTMLButtonElement, Type, type,
                                 kButtonDefaultType->tag)
 
 int32_t
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -154,17 +154,16 @@ MOCHITEST_FILES = \
 		test_bug564001.html \
 		test_bug566046.html \
 		test_bug567938-1.html \
 		test_bug567938-2.html \
 		test_bug567938-3.html \
 		test_bug567938-4.html \
 		test_bug569955.html \
 		test_bug573969.html \
-		test_bug585508.html \
 		test_bug561640.html \
 		test_bug566064.html \
 		test_bug582412-1.html \
 		test_bug582412-2.html \
 		test_bug558788-1.html \
 		test_bug558788-2.html \
 		test_bug561634.html \
 		test_bug590353-1.html \
--- a/content/html/content/test/forms/test_button_attributes_reflection.html
+++ b/content/html/content/test/forms/test_button_attributes_reflection.html
@@ -35,37 +35,33 @@ reflectLimitedEnumerated({
   element: document.createElement("button"),
   attribute: "formEnctype",
   validValues: [
     "application/x-www-form-urlencoded",
     "multipart/form-data",
     "text/plain",
   ],
   invalidValues: [ "text/html", "", "tulip" ],
-// TODO (Bug 839171):
-//  defaultValue: {
-//    invalid: "application/x-www-form-urlencoded",
-//    missing: "",
-//  }
-  defaultValue: "application/x-www-form-urlencoded",
+  defaultValue: {
+    invalid: "application/x-www-form-urlencoded",
+    missing: "",
+  }
 });
 
 // .formMethod
 reflectLimitedEnumerated({
   element: document.createElement("button"),
   attribute: "formMethod",
   validValues: [ "get", "post" ],
   invalidValues: [ "put", "", "tulip" ],
   unsupportedValues: [ "dialog" ],
-// TODO (Bug 839171):
-//  defaultValue: {
-//    invalid: "get",
-//    missing: "",
-//  }
-  defaultValue: "get",
+  defaultValue: {
+    invalid: "get",
+    missing: "",
+  }
 });
 
 // .formNoValidate
 reflectBoolean({
   element: document.createElement("button"),
   attribute: "formNoValidate",
 });
 
deleted file mode 100644
--- a/content/html/content/test/test_bug585508.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=585508
--->
-<head>
-  <title>Test for Bug 585508</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=585508">Mozilla Bug 585508</a>
-<p id="display"></p>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 585508 **/
-
-var enctypeTestData = [
-  // Default value.
-  [ "application/x-www-form-urlencoded" ],
-  // Valid values.
-  [ "application/x-www-form-urlencoded", "multipart/form-data", "text/plain" ],
-  // Invalid values.
-  [ "", " ", "foo", "multipart/foo" ]
-];
-
-var methodTestData = [
-  // Default value.
-  [ "get" ],
-  // Valid values.
-  [ "get", "post" ],
-  // Invalid values.
-  [ "", " ", "foo" ],
-];
-
-function checkAttribute(form, attrName, idlName, data)
-{
-  is(form.getAttribute(attrName), null,
-     "By default " + attrName + " content attribute should be null");
-  is(form[idlName], data[0][0],
-     "By default " + idlName + " IDL attribute should be equal to " +
-     data[0][0]);
-
-  // Valid values.
-  for (i in data[1]) {
-    form.setAttribute(attrName, data[1][i]);
-    is(form.getAttribute(attrName), data[1][i],
-       "getAttribute should return the content attribute");
-    is(form[idlName], data[1][i], "When getting, " + idlName + " IDL attribute " +
-       "should be equal to the content attribute if the value is known");
-  }
-
-  // Invalid values.
-  for (i in data[2]) {
-    form.setAttribute(attrName, data[2][i]);
-    is(form.getAttribute(attrName), data[2][i],
-       "getAttribute should return the content attribute");
-    is(form[idlName], data[0][0], "When getting, " + idlName + " IDL attribute " +
-       "should return the default value if the content attribute value isn't known");
-  }
-}
-
-var button = document.createElement('button');
-
-checkAttribute(button, 'formenctype', 'formEnctype', enctypeTestData);
-checkAttribute(button, 'formmethod', 'formMethod', methodTestData);
-
-</script>
-</pre>
-</body>
-</html>