Diff
Modified: trunk/Source/WebCore/ChangeLog (207387 => 207388)
--- trunk/Source/WebCore/ChangeLog 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Source/WebCore/ChangeLog 2016-10-16 08:35:18 UTC (rev 207388)
@@ -1,3 +1,22 @@
+2016-10-16 Carlos Garcia Campos <cgar...@igalia.com>
+
+ 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 Said Abou-Hallawa <sabouhall...@apple.com>
Delete the animated image catchup code
Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (207387 => 207388)
--- trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp 2016-10-16 08:35:18 UTC (rev 207388)
@@ -1629,6 +1629,11 @@
mainReceivedError(error);
}
+void DocumentLoader::willContinueMainResourceLoadAfterRedirect(const ResourceRequest& newRequest)
+{
+ setRequest(newRequest);
+}
+
void DocumentLoader::clearMainResource()
{
if (m_mainResource && m_mainResource->hasClient(*this))
Modified: trunk/Source/WebCore/loader/DocumentLoader.h (207387 => 207388)
--- trunk/Source/WebCore/loader/DocumentLoader.h 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Source/WebCore/loader/DocumentLoader.h 2016-10-16 08:35:18 UTC (rev 207388)
@@ -213,7 +213,8 @@
void startLoadingMainResource();
WEBCORE_EXPORT void cancelMainResourceLoad(const ResourceError&);
-
+ void willContinueMainResourceLoadAfterRedirect(const ResourceRequest&);
+
// Support iconDatabase in synchronous mode.
void iconLoadDecisionAvailable();
Modified: trunk/Source/WebCore/loader/SubresourceLoader.cpp (207387 => 207388)
--- trunk/Source/WebCore/loader/SubresourceLoader.cpp 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Source/WebCore/loader/SubresourceLoader.cpp 2016-10-16 08:35:18 UTC (rev 207388)
@@ -229,8 +229,13 @@
return;
ResourceLoader::willSendRequestInternal(newRequest, redirectResponse);
- if (newRequest.isNull())
+ if (newRequest.isNull()) {
cancel();
+ return;
+ }
+
+ if (m_resource->type() == CachedResource::MainResource && !redirectResponse.isNull())
+ m_documentLoader->willContinueMainResourceLoadAfterRedirect(newRequest);
}
void SubresourceLoader::didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent)
Modified: trunk/Tools/ChangeLog (207387 => 207388)
--- trunk/Tools/ChangeLog 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Tools/ChangeLog 2016-10-16 08:35:18 UTC (rev 207388)
@@ -1,3 +1,21 @@
+2016-10-16 Carlos Garcia Campos <cgar...@igalia.com>
+
+ 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-15 Dan Bernstein <m...@apple.com>
REGRESSION (r191699): Contextual menu in Mail compose view doesn’t include any of the standard submenus
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp (207387 => 207388)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestLoaderClient.cpp 2016-10-16 08:35:18 UTC (rev 207388)
@@ -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: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp (207387 => 207388)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/WebExtensionTest.cpp 2016-10-16 08:35:18 UTC (rev 207388)
@@ -154,6 +154,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: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp (207387 => 207388)
--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp 2016-10-16 01:44:18 UTC (rev 207387)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/LoadTrackingTest.cpp 2016-10-16 08:35:18 UTC (rev 207388)
@@ -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);