Diff
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog 2016-10-27 09:24:22 UTC (rev 207964)
@@ -1,3 +1,22 @@
+2016-10-16 Carlos Garcia Campos <[email protected]>
+
+ Document request not updated after willSendRequest is called for a redirect
+ https://bugs.webkit.org/show_bug.cgi?id=163436
+
+ Reviewed by Michael Catanzaro.
+
+ The first willSendRequest happens before DocumentLoader::startLoadingMainResource(), that calls setRequest, but
+ the second one happens after DocumentLoader::redirectReceived() and then the request is never updated again.
+
+ Covered by GTK+ unit tests.
+
+ * loader/DocumentLoader.cpp:
+ (WebCore::DocumentLoader::willContinueMainResourceLoadAfterRedirect): Set the new request.
+ * loader/DocumentLoader.h:
+ * loader/SubresourceLoader.cpp:
+ (WebCore::SubresourceLoader::willSendRequestInternal): Notify the document loader when loading the main resource
+ and called for a redirection.
+
2016-10-15 Michael Catanzaro <[email protected]>
[GTK] Restore user agent quirk for Yahoo
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.cpp (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.cpp 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.cpp 2016-10-27 09:24:22 UTC (rev 207964)
@@ -1586,6 +1586,11 @@
mainReceivedError(error);
}
+void DocumentLoader::willContinueMainResourceLoadAfterRedirect(const ResourceRequest& newRequest)
+{
+ setRequest(newRequest);
+}
+
void DocumentLoader::clearMainResource()
{
if (m_mainResource && m_mainResource->hasClient(this))
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.h (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.h 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/DocumentLoader.h 2016-10-27 09:24:22 UTC (rev 207964)
@@ -213,7 +213,8 @@
void startLoadingMainResource();
WEBCORE_EXPORT void cancelMainResourceLoad(const ResourceError&);
-
+ void willContinueMainResourceLoadAfterRedirect(const ResourceRequest&);
+
// Support iconDatabase in synchronous mode.
void iconLoadDecisionAvailable();
Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/SubresourceLoader.cpp (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/SubresourceLoader.cpp 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/SubresourceLoader.cpp 2016-10-27 09:24:22 UTC (rev 207964)
@@ -226,10 +226,15 @@
return;
ResourceLoader::willSendRequestInternal(newRequest, redirectResponse);
- if (newRequest.isNull())
+ if (newRequest.isNull()) {
cancel();
+ return;
+ }
ResourceLoadObserver::sharedObserver().logSubresourceLoading(m_frame.get(), newRequest, redirectResponse);
+
+ if (m_resource->type() == CachedResource::MainResource && !redirectResponse.isNull())
+ m_documentLoader->willContinueMainResourceLoadAfterRedirect(newRequest);
}
void SubresourceLoader::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
Modified: releases/WebKitGTK/webkit-2.14/Tools/ChangeLog (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Tools/ChangeLog 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Tools/ChangeLog 2016-10-27 09:24:22 UTC (rev 207964)
@@ -1,3 +1,21 @@
+2016-10-16 Carlos Garcia Campos <[email protected]>
+
+ Document request not updated after willSendRequest is called for a redirect
+ https://bugs.webkit.org/show_bug.cgi?id=163436
+
+ Reviewed by Michael Catanzaro.
+
+ Update /webkit2/WebKitWebView/active-uri test to check the active URI also when modified by
+ WebKitPage::send-request signal in a web extension.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp:
+ (testWebViewActiveURI):
+ (serverCallback):
+ * TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp:
+ (sendRequestCallback):
+ * TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp:
+ (loadChangedCallback):
+
2016-10-13 Carlos Garcia Campos <[email protected]>
WebView and WebPage URLs not updated after URL is modified by InjectedBundlePageResourceLoadClient::willSendRequestForFrame
Modified: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp 2016-10-27 09:24:22 UTC (rev 207964)
@@ -27,6 +27,7 @@
#include "WebViewTest.h"
#include <gtk/gtk.h>
#include <libsoup/soup.h>
+#include <wtf/Vector.h>
#include <wtf/text/CString.h>
static WebKitTestBus* bus;
@@ -209,51 +210,100 @@
static void uriChanged(GObject*, GParamSpec*, ViewURITrackingTest* test)
{
- g_assert_cmpstr(test->m_activeURI.data(), !=, webkit_web_view_get_uri(test->m_webView));
- test->m_activeURI = webkit_web_view_get_uri(test->m_webView);
+ g_assert_cmpstr(test->m_currentURI.data(), !=, webkit_web_view_get_uri(test->m_webView));
+ test->m_currentURI = webkit_web_view_get_uri(test->m_webView);
}
ViewURITrackingTest()
- : m_activeURI(webkit_web_view_get_uri(m_webView))
+ : m_currentURI(webkit_web_view_get_uri(m_webView))
{
- g_assert(m_activeURI.isNull());
+ g_assert(m_currentURI.isNull());
+ m_currentURIList.grow(m_currentURIList.capacity());
g_signal_connect(m_webView, "notify::uri", G_CALLBACK(uriChanged), this);
}
+ enum State { Provisional, ProvisionalAfterRedirect, Commited, Finished };
+
+ void loadURI(const char* uri)
+ {
+ reset();
+ LoadTrackingTest::loadURI(uri);
+ }
+
void provisionalLoadStarted()
{
- checkActiveURI("/redirect");
+ m_currentURIList[Provisional] = m_currentURI;
}
void provisionalLoadReceivedServerRedirect()
{
- checkActiveURI("/normal");
+ m_currentURIList[ProvisionalAfterRedirect] = m_currentURI;
}
void loadCommitted()
{
- checkActiveURI("/normal");
+ m_currentURIList[Commited] = m_currentURI;
}
void loadFinished()
{
- checkActiveURI("/normal");
+ m_currentURIList[Finished] = m_currentURI;
LoadTrackingTest::loadFinished();
}
- CString m_activeURI;
+ void checkURIAtState(State state, const char* path)
+ {
+ if (path)
+ ASSERT_CMP_CSTRING(m_currentURIList[state], ==, kServer->getURIForPath(path));
+ else
+ g_assert(m_currentURIList[state].isNull());
+ }
private:
- void checkActiveURI(const char* uri)
+ void reset()
{
- ASSERT_CMP_CSTRING(m_activeURI, ==, kServer->getURIForPath(uri));
+ m_currentURI = CString();
+ m_currentURIList.clear();
+ m_currentURIList.grow(m_currentURIList.capacity());
}
+
+ CString m_currentURI;
+ Vector<CString, 4> m_currentURIList;
};
static void testWebViewActiveURI(ViewURITrackingTest* test, gconstpointer)
{
+ // Normal load, the URL doesn't change.
+ test->loadURI(kServer->getURIForPath("/normal1").data());
+ test->waitUntilLoadFinished();
+ test->checkURIAtState(ViewURITrackingTest::State::Provisional, "/normal1");
+ test->checkURIAtState(ViewURITrackingTest::State::ProvisionalAfterRedirect, nullptr);
+ test->checkURIAtState(ViewURITrackingTest::State::Commited, "/normal1");
+ test->checkURIAtState(ViewURITrackingTest::State::Finished, "/normal1");
+
+ // Redirect, the URL changes after the redirect.
test->loadURI(kServer->getURIForPath("/redirect").data());
test->waitUntilLoadFinished();
+ test->checkURIAtState(ViewURITrackingTest::State::Provisional, "/redirect");
+ test->checkURIAtState(ViewURITrackingTest::State::ProvisionalAfterRedirect, "/normal");
+ test->checkURIAtState(ViewURITrackingTest::State::Commited, "/normal");
+ test->checkURIAtState(ViewURITrackingTest::State::Finished, "/normal");
+
+ // Normal load, URL changed by WebKitPage::send-request.
+ test->loadURI(kServer->getURIForPath("/normal-change-request").data());
+ test->waitUntilLoadFinished();
+ test->checkURIAtState(ViewURITrackingTest::State::Provisional, "/normal-change-request");
+ test->checkURIAtState(ViewURITrackingTest::State::ProvisionalAfterRedirect, nullptr);
+ test->checkURIAtState(ViewURITrackingTest::State::Commited, "/request-changed");
+ test->checkURIAtState(ViewURITrackingTest::State::Finished, "/request-changed");
+
+ // Redirect, URL changed by WebKitPage::send-request.
+ test->loadURI(kServer->getURIForPath("/redirect-to-change-request").data());
+ test->waitUntilLoadFinished();
+ test->checkURIAtState(ViewURITrackingTest::State::Provisional, "/redirect-to-change-request");
+ test->checkURIAtState(ViewURITrackingTest::State::ProvisionalAfterRedirect, "/normal-change-request");
+ test->checkURIAtState(ViewURITrackingTest::State::Commited, "/request-changed-on-redirect");
+ test->checkURIAtState(ViewURITrackingTest::State::Finished, "/request-changed-on-redirect");
}
class ViewIsLoadingTest: public LoadTrackingTest {
@@ -484,6 +534,9 @@
else if (g_str_equal(path, "/redirect")) {
soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY);
soup_message_headers_append(message->response_headers, "Location", "/normal");
+ } else if (g_str_equal(path, "/redirect-to-change-request")) {
+ soup_message_set_status(message, SOUP_STATUS_MOVED_PERMANENTLY);
+ soup_message_headers_append(message->response_headers, "Location", "/normal-change-request");
} else if (g_str_equal(path, "/cancelled")) {
soup_message_headers_set_encoding(message->response_headers, SOUP_ENCODING_CHUNKED);
soup_message_body_append(message->response_body, SOUP_MEMORY_STATIC, responseString, strlen(responseString));
Modified: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp 2016-10-27 09:24:22 UTC (rev 207964)
@@ -166,6 +166,10 @@
SoupMessageHeaders* headers = webkit_uri_request_get_http_headers(request);
g_assert(headers);
soup_message_headers_append(headers, "DNT", "1");
+ } else if (g_str_has_suffix(requestURI, "/normal-change-request")) {
+ GUniquePtr<char> prefix(g_strndup(requestURI, strlen(requestURI) - strlen("/normal-change-request")));
+ GUniquePtr<char> newURI(g_strdup_printf("%s/request-changed%s", prefix.get(), redirectResponse ? "-on-redirect" : ""));
+ webkit_uri_request_set_uri(request, newURI.get());
} else if (g_str_has_suffix(requestURI, "/http-get-method")) {
g_assert_cmpstr(webkit_uri_request_get_http_method(request), ==, "GET");
g_assert(webkit_uri_request_get_http_method(request) == SOUP_METHOD_GET);
Modified: releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp (207963 => 207964)
--- releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp 2016-10-27 08:56:33 UTC (rev 207963)
+++ releases/WebKitGTK/webkit-2.14/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp 2016-10-27 09:24:22 UTC (rev 207964)
@@ -39,7 +39,7 @@
break;
case WEBKIT_LOAD_COMMITTED: {
g_assert(webkit_web_view_is_loading(webView));
- g_assert_cmpstr(test->m_activeURI.data(), ==, webkit_web_view_get_uri(webView));
+ test->m_activeURI = webkit_web_view_get_uri(webView);
// Check that on committed we always have a main resource with a response.
WebKitWebResource* resource = webkit_web_view_get_main_resource(webView);