Reviewed by John Sullivan.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2006 17:35:50 +0000 (17:35 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Mar 2006 17:35:50 +0000 (17:35 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8051
          Empty forms are submitted incorrectly

        Test: fast/forms/empty-get.html

        * platform/KURL.cpp:
        (KURL::setQuery): Add a question mark for empty query strings, too.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13577 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/empty-get-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/empty-get.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/KURL.cpp

index 96184317d9b899157765f24d4096c77b30effd2c..ef9f5534076463ed073f03f2ea410537db2b02e6 100644 (file)
@@ -1,3 +1,13 @@
+2006-03-30  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by John Sullivan.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=8051
+          Empty forms are submitted incorrectly
+
+        * fast/forms/empty-get-expected.txt: Added.
+        * fast/forms/empty-get.html: Added.
+
 2006-03-29  Justin Garcia  <justin.garcia@apple.com>
 
         Reviewed by darin
diff --git a/LayoutTests/fast/forms/empty-get-expected.txt b/LayoutTests/fast/forms/empty-get-expected.txt
new file mode 100644 (file)
index 0000000..2f973c2
--- /dev/null
@@ -0,0 +1,5 @@
+Test for bug 8051: Empty forms are submitted incorrectly.
+
+Success
+
+
diff --git a/LayoutTests/fast/forms/empty-get.html b/LayoutTests/fast/forms/empty-get.html
new file mode 100644 (file)
index 0000000..bb4642c
--- /dev/null
@@ -0,0 +1,36 @@
+<html>
+<head>
+<title>Submitting forms with empty data</title>
+</head>
+<body>
+<p>Test for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=8051">bug 8051</a>:
+Empty forms are submitted incorrectly.</p>
+
+<form name="f" method="get" action="">
+<input type="submit" value="Continue"/>
+</form>
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+if (document.URL.indexOf('?') == -1) {
+
+    document.f.submit();
+
+} else {
+    
+    if (unescape(document.URL.substring(document.URL.indexOf('?')+1, document.URL.length)) == "")
+        document.write("<p>Success</p>");
+    else
+        document.write("<p>Failure</p>");
+    
+    if (window.layoutTestController)
+        layoutTestController.notifyDone();
+}
+
+</script>
+</body>
+</html>
\ No newline at end of file
index b9358891f2ab42ceaa1be2a9754c732f12b655ae..c1ac7edf53558fe496286ea80e3fd4da6ca7ab3c 100644 (file)
@@ -1,3 +1,15 @@
+2006-03-30  Alexey Proskuryakov  <ap@nypop.com>
+
+        Reviewed by John Sullivan.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8051
+          Empty forms are submitted incorrectly
+
+        Test: fast/forms/empty-get.html
+
+        * platform/KURL.cpp:
+        (KURL::setQuery): Add a question mark for empty query strings, too.
+
 2006-03-30  Dave Hyatt <hyatt@apple.com>
 
         Roll out the fix to 7102 and reopen it to get Spinneret working
index 61c664e0dd3f3638f2905c3439f2911128952b4f..610439d7e4597d83e04fae9cce2e8193ea2cfad0 100644 (file)
@@ -669,7 +669,7 @@ void KURL::setQuery(const DeprecatedString &query)
 {
     if (m_isValid) {
         DeprecatedString q;
-        if (!query.isEmpty() && query[0] != '?') {
+        if (!query.isNull() && (query.isEmpty() || query[0] != '?')) {
             q = "?" + query;
         } else {
             q = query;