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

Gustavo Noronha Silva gustavo.noronha at collabora.co.uk
Wed Oct 7 06:26:42 UTC 2009


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

    WebCore:
    
    2009-10-01  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by NOBODY (OOPS!).
    
            [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-01  Xan Lopez  <xlopez at igalia.com>
    
            Reviewed by NOBODY (OOPS!).
    
            [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/redirect-reload.html: 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@49077 268f45cc-cd09-0410-ab3c-d52691b4dbfc

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..ca3a2d0
--- /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/redirect-reload.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..de67adc
--- /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/redirect-reload.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/redirect-reload.html b/LayoutTests/http/tests/navigation/resources/redirect-reload.html
new file mode 100644
index 0000000..55efeb2
--- /dev/null
+++ b/LayoutTests/http/tests/navigation/resources/redirect-reload.html
@@ -0,0 +1,8 @@
+<html>
+<script type="text/javascript" src="testcode.js"></script>
+<body>
+<form id="testform" action="postresult.pl" method="post">
+<input type="submit" name="submitwithpostredirectreload" value="Submit with POST followed by a redirect + reload"/><br>
+</form>
+</body>
+</html>
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/testcode.js b/LayoutTests/http/tests/navigation/resources/testcode.js
index adaa1b5..99b5302 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,13 @@ 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.queueLoadingScript("submitFormWithPostRedirectReload()");
+    layoutTestController.queueReload();
+}
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