[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

xan at webkit.org xan at webkit.org
Thu Oct 29 20:38:45 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 7dd92c4fbca1318369e1c5a5c38d022d3e0a673d
Author: xan at webkit.org <xan at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Oct 4 17:17:30 2009 +0000

    WebCore:
    
    2009-10-04  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha.
    
            [GTK] performs a POST when refreshing a view that was obtained with a GET
            https://bugs.webkit.org/show_bug.cgi?id=29761
    
            Update the HTTP method in the request stored by willSendRequest
            after a redirect, since it could have changed.
    
            Test: http/tests/navigation/postredirect-reload.html
    
            * platform/network/soup/ResourceHandleSoup.cpp:
            (WebCore::restartedCallback):
    
    LayoutTests:
    
    2009-10-04  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by Gustavo Noronha.
    
            [GTK] performs a POST when refreshing a view that was obtained with a GET
            https://bugs.webkit.org/show_bug.cgi?id=29761
    
            New test that checks that a reload after a redirect to a page with
            a GET method from one with a POST method will use GET and not
            POST.
    
            * http/tests/navigation/postredirect-reload-expected.txt: Added.
            * http/tests/navigation/postredirect-reload.html: Added.
            * http/tests/navigation/resources/postresult.pl:
            * http/tests/navigation/resources/reloadresult.pl: Added.
            * http/tests/navigation/resources/success200.html:
            * http/tests/navigation/resources/testcode.js:
            (submitFormWithPostRedirectReload):
            (runRedirectReloadTest):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49075 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 3080a3f..6049eea 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-04  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [GTK] performs a POST when refreshing a view that was obtained with a GET
+        https://bugs.webkit.org/show_bug.cgi?id=29761
+
+        New test that checks that a reload after a redirect to a page with
+        a GET method from one with a POST method will use GET and not
+        POST.
+
+        * http/tests/navigation/postredirect-reload-expected.txt: Added.
+        * http/tests/navigation/postredirect-reload.html: Added.
+        * http/tests/navigation/resources/postresult.pl:
+        * http/tests/navigation/resources/reloadresult.pl: Added.
+        * http/tests/navigation/resources/success200.html:
+        * http/tests/navigation/resources/testcode.js:
+        (submitFormWithPostRedirectReload):
+        (runRedirectReloadTest):
+
 2009-10-03  Jakub Wieczorek  <faw217 at gmail.com>
 
         Reviewed by Simon Hausmann.
diff --git a/LayoutTests/http/tests/navigation/postredirect-reload-expected.txt b/LayoutTests/http/tests/navigation/postredirect-reload-expected.txt
new file mode 100644
index 0000000..5f14196
--- /dev/null
+++ b/LayoutTests/http/tests/navigation/postredirect-reload-expected.txt
@@ -0,0 +1,7 @@
+PASS
+
+============== Back Forward List ==============
+        http://127.0.0.1:8000/navigation/postredirect-reload.html  **nav target**
+        http://127.0.0.1:8000/navigation/resources/success200.html  **nav target**
+curr->  http://127.0.0.1:8000/navigation/resources/reloadresult.pl  **nav target**
+===============================================
diff --git a/LayoutTests/http/tests/navigation/postredirect-reload.html b/LayoutTests/http/tests/navigation/postredirect-reload.html
new file mode 100644
index 0000000..1875836
--- /dev/null
+++ b/LayoutTests/http/tests/navigation/postredirect-reload.html
@@ -0,0 +1,8 @@
+<script type="text/javascript" src="resources/testcode.js"></script>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    runRedirectReloadTest("resources/success200.html");
+</script>
+This page just kicks off a test, and should not appear in the expected test output.
+The files in the resources dir have comments about the tests.
diff --git a/LayoutTests/http/tests/navigation/resources/postresult.pl b/LayoutTests/http/tests/navigation/resources/postresult.pl
index 3aa3479..a56d673 100755
--- a/LayoutTests/http/tests/navigation/resources/postresult.pl
+++ b/LayoutTests/http/tests/navigation/resources/postresult.pl
@@ -11,6 +11,7 @@ use CGI;
 $query = new CGI;
 $submitWithPost = $query->param('submitwithpost');
 $submitWithPostRedirect = $query->param('submitwithpostredirect');
+$submitWithPostRedirectReload = $query->param('submitwithpostredirectreload');
 $redirectHappened = $query->param('redirectHappened');
 $method = $query->request_method();
 
@@ -39,6 +40,21 @@ if (($submitWithPost && $method eq "POST") || ($redirectHappened && $method eq "
     </html>
 HERE_DOC_END
 
+} elsif ($submitWithPostRedirectReload && $method eq "POST") {
+
+    print "Status: 303 See Other\r\n";
+    print "Location: reloadresult.pl\r\n";
+    print "Content-type: text/html\r\n";
+    print "\r\n";
+
+    print <<HERE_DOC_END
+    <html>
+    <body style="font-size: 32">
+    This page should not be seen - it is a 303 redirect to another page.
+    </body>
+    </html>
+HERE_DOC_END
+
 } elsif ($submitWithPostRedirect && $method eq "POST") {
 
     $urlQuery = $query->query_string;
diff --git a/LayoutTests/http/tests/navigation/resources/reloadresult.pl b/LayoutTests/http/tests/navigation/resources/reloadresult.pl
new file mode 100755
index 0000000..400c0c5
--- /dev/null
+++ b/LayoutTests/http/tests/navigation/resources/reloadresult.pl
@@ -0,0 +1,39 @@
+#!/usr/bin/perl
+# Simple script to generate a POST result.
+#
+# Depending on which button was pushed in the form, we either generate a direct
+# result page, or we use the pattern where the post returns a 303 redirect,
+# and then the resulting GET yields the true POST result.  Sites do this trick
+# to avoid having POSTS in the b/f list, so you don't run into POSTs getting
+# resubmitted by accident.
+
+use CGI;
+$query = new CGI;
+$method = $query->request_method();
+
+if ($method eq "POST") {
+
+    print "Content-type: text/html\r\n";
+    print "\r\n";
+
+    print <<HERE_DOC_END
+    <html>
+    Test failure: reloadresult.pl was called with an unexpected method ($method).
+    </body>
+    </html>
+HERE_DOC_END
+
+} elsif ($method eq "GET") {
+
+    print "Content-type: text/html\r\n";
+    print "\r\n";
+
+    print <<HERE_DOC_END
+    <html>
+    <body>
+    PASS
+    </body>
+    </html>
+HERE_DOC_END
+
+}
diff --git a/LayoutTests/http/tests/navigation/resources/success200.html b/LayoutTests/http/tests/navigation/resources/success200.html
index 6ee811a..d9aa060 100644
--- a/LayoutTests/http/tests/navigation/resources/success200.html
+++ b/LayoutTests/http/tests/navigation/resources/success200.html
@@ -18,6 +18,7 @@ be long enough that we can test saving and restoring of scroll position.
 <form id="testform" action="postresult.pl" method="post">
 <input type="submit" name="submitwithpost" value="Submit with POST"/><br>
 <input type="submit" name="submitwithpostredirect" value="Submit with POST followed by a redirect"/><br>
+<input type="submit" name="submitwithpostredirectreload" value="Submit with POST followed by a redirect + reload"/><br>
 Here are some form elements<input type="text" name="textfield1" value="Initial text before user input"/><br>
 that we can use for testing<input type="text" name="textfield2" value=""/><br>
 <input type="radio" name="radiogroup1" id="radiooption1" value="male"/> Male<br>
diff --git a/LayoutTests/http/tests/navigation/resources/testcode.js b/LayoutTests/http/tests/navigation/resources/testcode.js
index adaa1b5..d43491e 100644
--- a/LayoutTests/http/tests/navigation/resources/testcode.js
+++ b/LayoutTests/http/tests/navigation/resources/testcode.js
@@ -38,6 +38,12 @@ function submitFormWithPostRedirect() {
     testDoc.getElementById('testform').submitwithpostredirect.click();
 }
 
+// utility function to make a form post, using the postredirect idiom
+function submitFormWithPostRedirectReload() {
+    testDoc = (window.frames.length == 0) ? document : window.frames['main'].document;
+    testDoc.getElementById('testform').submitwithpostredirectreload.click();
+}
+
 // utility function to do a jump within the page to an anchor
 function jumpToAnchor() {
     testWin = (window.frames.length == 0) ? window : window.frames['main'];
@@ -149,3 +155,15 @@ function runLoadSameTest(testCase) {
     layoutTestController.queueNonLoadingScript("scrollDocDown()");
     layoutTestController.queueLoad(testCase);
 }
+
+// A sequence testing a reload after a redirect. The goal is to check
+// that in a reload we use the method set by the redirect, GET,
+// instead of the original one, POST.
+function runRedirectReloadTest(testCase) {
+    layoutTestController.dumpBackForwardList();
+    layoutTestController.queueLoad(testCase);
+    layoutTestController.queueNonLoadingScript("fillTestForm()");
+    layoutTestController.queueNonLoadingScript("scrollDocDown()");
+    layoutTestController.queueLoadingScript("submitFormWithPostRedirectReload()");
+    layoutTestController.queueReload();
+}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 55205e6..9b16167 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2009-10-04  Xan Lopez  <xlopez at igalia.com>
+
+        Reviewed by Gustova Noronha.
+
+        [GTK] performs a POST when refreshing a view that was obtained with a GET
+        https://bugs.webkit.org/show_bug.cgi?id=29761
+
+        Update the HTTP method in the request stored by willSendRequest
+        after a redirect, since it could have changed.
+
+        Test: http/tests/navigation/postredirect-reload.html
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::restartedCallback):
+
 2009-10-04  Vitaly Repeshko  <vitalyr at chromium.org>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index 0a521ef..2177bd2 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -198,6 +198,7 @@ static void restartedCallback(SoupMessage* msg, gpointer data)
     ResourceRequest request = handle->request();
     ResourceResponse response;
     request.setURL(newURL);
+    request.setHTTPMethod(msg->method);
     fillResponseFromMessage(msg, &response);
     if (d->client())
         d->client()->willSendRequest(handle, request, response);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list