Changeset 161176 in webkit
- Timestamp:
- Dec 31, 2013 12:28:17 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r161167 r161176 1 2013-12-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] willSendRequest doesn't work after a redirect 4 https://bugs.webkit.org/show_bug.cgi?id=126290 5 6 Reviewed by Martin Robinson. 7 8 The problem is that we are creating the new soup request for the 9 redirect before calling ResourceHandleClient::willSendRequest() so 10 that any change made to the request by the client is ignored. 11 12 * platform/network/soup/ResourceHandleSoup.cpp: 13 (WebCore::doRedirect): Create the new soup request and soup 14 message for the redirect after calling willSendRequest() on the 15 client. 16 1 17 2013-12-30 Andreas Kling <akling@apple.com> 2 18 -
trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp
r161109 r161176 503 503 applyAuthenticationToRequest(handle, newRequest, true); 504 504 505 cleanupSoupRequestOperation(handle);506 if (!createSoupRequestAndMessageForHandle(handle, newRequest, true)) {507 d->client()->cannotShowURL(handle);508 return;509 }510 511 505 // If we sent credentials with this request's URL, we don't want the response to carry them to 512 506 // the WebKit layer. They were only placed in the URL for the benefit of libsoup. … … 517 511 else 518 512 d->client()->willSendRequest(handle, newRequest, d->m_response); 513 514 cleanupSoupRequestOperation(handle); 515 516 // willSendRequest might cancel the load. 517 if (handle->cancelledOrClientless()) 518 return; 519 520 if (!createSoupRequestAndMessageForHandle(handle, newRequest, true)) { 521 d->client()->cannotShowURL(handle); 522 return; 523 } 524 519 525 handle->sendPendingRequest(); 520 526 } -
trunk/Source/WebKit2/ChangeLog
r161173 r161176 1 2013-12-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [SOUP] willSendRequest doesn't work after a redirect 4 https://bugs.webkit.org/show_bug.cgi?id=126290 5 6 Reviewed by Martin Robinson. 7 8 Add test cases to test send-request signal in case of 9 redirection. 10 11 * UIProcess/API/gtk/tests/TestResources.cpp: 12 (testWebResourceSendRequest): 13 (serverCallback): 14 1 15 2013-12-30 Commit Queue <commit-queue@webkit.org> 2 16 -
trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestResources.cpp
r160965 r161176 569 569 return; 570 570 571 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, m_expectedNewResourceURI.data()); 571 if (redirectResponse) 572 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, m_expectedNewResourceURIAfterRedirection.data()); 573 else 574 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, m_expectedNewResourceURI.data()); 572 575 g_assert_cmpstr(webkit_uri_request_get_uri(request), ==, webkit_web_resource_get_uri(resource)); 573 576 … … 596 599 } 597 600 601 void setExpectedNewResourceURIAfterRedirection(const CString& uri) 602 { 603 m_expectedNewResourceURIAfterRedirection = uri; 604 } 605 598 606 CString m_expectedNewResourceURI; 599 607 CString m_expectedCancelledResourceURI; 608 CString m_expectedNewResourceURIAfterRedirection; 600 609 }; 601 610 … … 626 635 g_assert_cmpint(events[1], ==, SingleResourceLoadTest::Failed); 627 636 g_assert_cmpint(events[2], ==, SingleResourceLoadTest::Finished); 637 events.clear(); 638 639 // URI changed after a redirect. 640 test->setExpectedNewResourceURI(kServer->getURIForPath("/redirected.js")); 641 test->setExpectedNewResourceURIAfterRedirection(kServer->getURIForPath("/javascript.js")); 642 test->loadURI(kServer->getURIForPath("redirected-javascript.html").data()); 643 test->waitUntilResourceLoadFinished(); 644 g_assert(test->m_resource); 645 646 g_assert_cmpint(events.size(), ==, 6); 647 g_assert_cmpint(events[0], ==, SingleResourceLoadTest::Started); 648 g_assert_cmpint(events[1], ==, SingleResourceLoadTest::SentRequest); 649 g_assert_cmpint(events[2], ==, SingleResourceLoadTest::Redirected); 650 g_assert_cmpint(events[3], ==, SingleResourceLoadTest::ReceivedResponse); 651 g_assert_cmpint(events[4], ==, SingleResourceLoadTest::ReceivedData); 652 g_assert_cmpint(events[5], ==, SingleResourceLoadTest::Finished); 653 events.clear(); 654 655 // Cancel after a redirect. 656 test->setExpectedNewResourceURI(kServer->getURIForPath("/redirected-to-cancel.js")); 657 test->setExpectedCancelledResourceURI(kServer->getURIForPath("/redirected-to-cancel.js")); 658 test->loadURI(kServer->getURIForPath("/redirected-to-cancel.html").data()); 659 test->waitUntilResourceLoadFinished(); 660 g_assert(test->m_resource); 661 662 g_assert_cmpint(events.size(), ==, 4); 663 g_assert_cmpint(events[0], ==, SingleResourceLoadTest::Started); 664 g_assert_cmpint(events[1], ==, SingleResourceLoadTest::SentRequest); 665 g_assert_cmpint(events[2], ==, SingleResourceLoadTest::Failed); 666 g_assert_cmpint(events[3], ==, SingleResourceLoadTest::Finished); 628 667 events.clear(); 629 668 } … … 689 728 static const char* resourceToCancelHTML = "<html><head><script language='javascript' src='cancel-this.js'></script></head><body></body></html>"; 690 729 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, resourceToCancelHTML, strlen(resourceToCancelHTML)); 730 } else if (g_str_equal(path, "/redirected-javascript.html")) { 731 static const char* javascriptRelativeHTML = "<html><head><script language='javascript' src='/redirected.js'></script></head><body></body></html>"; 732 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, javascriptRelativeHTML, strlen(javascriptRelativeHTML)); 733 } else if (g_str_equal(path, "/redirected-to-cancel.html")) { 734 static const char* javascriptRelativeHTML = "<html><head><script language='javascript' src='/redirected-to-cancel.js'></script></head><body></body></html>"; 735 soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, javascriptRelativeHTML, strlen(javascriptRelativeHTML)); 691 736 } else if (g_str_equal(path, "/blank.ico")) { 692 737 GOwnPtr<char> filePath(g_build_filename(Test::getWebKit1TestResoucesDir().data(), path, NULL)); … … 708 753 soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY); 709 754 soup_message_headers_append(message->response_headers, "Location", "/simple-style.css"); 755 } else if (g_str_equal(path, "/redirected.js")) { 756 soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY); 757 soup_message_headers_append(message->response_headers, "Location", "/remove-this/javascript.js"); 758 } else if (g_str_equal(path, "/redirected-to-cancel.js")) { 759 soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY); 760 soup_message_headers_append(message->response_headers, "Location", "/cancel-this.js"); 710 761 } else if (g_str_equal(path, "/invalid.css")) 711 762 soup_message_set_status(message, SOUP_STATUS_CANT_CONNECT);
Note: See TracChangeset
for help on using the changeset viewer.