Changeset 49077 in webkit


Ignore:
Timestamp:
Oct 4, 2009 1:01:19 PM (14 years ago)
Author:
xan@webkit.org
Message:

WebCore:

2009-10-01 Xan Lopez <xlopez@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@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):
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r49076 r49077  
     12009-10-04  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Gustavo Noronha.
     4
     5        [GTK] performs a POST when refreshing a view that was obtained with a GET
     6        https://bugs.webkit.org/show_bug.cgi?id=29761
     7
     8        New test that checks that a reload after a redirect to a page with
     9        a GET method from one with a POST method will use GET and not
     10        POST.
     11
     12        * http/tests/navigation/postredirect-reload-expected.txt: Added.
     13        * http/tests/navigation/postredirect-reload.html: Added.
     14        * http/tests/navigation/resources/postresult.pl:
     15        * http/tests/navigation/resources/reloadresult.pl: Added.
     16        * http/tests/navigation/resources/redirect-reload.html: Added.
     17        * http/tests/navigation/resources/success200.html:
     18        * http/tests/navigation/resources/testcode.js:
     19        (submitFormWithPostRedirectReload):
     20        (runRedirectReloadTest):
     21
    1222009-10-04  Xan Lopez  <xlopez@igalia.com>
    223
  • trunk/LayoutTests/http/tests/navigation/resources/postresult.pl

    r49076 r49077  
    1212$submitWithPost = $query->param('submitwithpost');
    1313$submitWithPostRedirect = $query->param('submitwithpostredirect');
     14$submitWithPostRedirectReload = $query->param('submitwithpostredirectreload');
    1415$redirectHappened = $query->param('redirectHappened');
    1516$method = $query->request_method();
     
    3637    <br>
    3738    This page was requested with an HTTP $method
     39    </body>
     40    </html>
     41HERE_DOC_END
     42
     43} elsif ($submitWithPostRedirectReload && $method eq "POST") {
     44
     45    print "Status: 303 See Other\r\n";
     46    print "Location: reloadresult.pl\r\n";
     47    print "Content-type: text/html\r\n";
     48    print "\r\n";
     49
     50    print <<HERE_DOC_END
     51    <html>
     52    <body style="font-size: 32">
     53    This page should not be seen - it is a 303 redirect to another page.
    3854    </body>
    3955    </html>
  • trunk/LayoutTests/http/tests/navigation/resources/testcode.js

    r49076 r49077  
    3737    testDoc = (window.frames.length == 0) ? document : window.frames['main'].document;
    3838    testDoc.getElementById('testform').submitwithpostredirect.click();
     39}
     40
     41// utility function to make a form post, using the postredirect idiom
     42function submitFormWithPostRedirectReload() {
     43    testDoc = (window.frames.length == 0) ? document : window.frames['main'].document;
     44    testDoc.getElementById('testform').submitwithpostredirectreload.click();
    3945}
    4046
     
    150156    layoutTestController.queueLoad(testCase);
    151157}
     158
     159// A sequence testing a reload after a redirect. The goal is to check
     160// that in a reload we use the method set by the redirect, GET,
     161// instead of the original one, POST.
     162function runRedirectReloadTest(testCase) {
     163    layoutTestController.dumpBackForwardList();
     164    layoutTestController.queueLoad(testCase);
     165    layoutTestController.queueLoadingScript("submitFormWithPostRedirectReload()");
     166    layoutTestController.queueReload();
     167}
  • trunk/WebCore/ChangeLog

    r49076 r49077  
     12009-10-04  Xan Lopez  <xlopez@igalia.com>
     2
     3        Reviewed by Gustova Noronha.
     4
     5        [GTK] performs a POST when refreshing a view that was obtained with a GET
     6        https://bugs.webkit.org/show_bug.cgi?id=29761
     7
     8        Update the HTTP method in the request stored by willSendRequest
     9        after a redirect, since it could have changed.
     10
     11        Test: http/tests/navigation/postredirect-reload.html
     12
     13        * platform/network/soup/ResourceHandleSoup.cpp:
     14        (WebCore::restartedCallback):
     15
    1162009-10-04  Xan Lopez  <xlopez@igalia.com>
    217
  • trunk/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r49076 r49077  
    199199    ResourceResponse response;
    200200    request.setURL(newURL);
     201    request.setHTTPMethod(msg->method);
    201202    fillResponseFromMessage(msg, &response);
    202203    if (d->client())
Note: See TracChangeset for help on using the changeset viewer.