- Revision
- 185553
- Author
- [email protected]
- Date
- 2015-06-15 09:36:24 -0700 (Mon, 15 Jun 2015)
Log Message
[SOUP] Custom URI schemes don't work for requests containing a fragment identifier
https://bugs.webkit.org/show_bug.cgi?id=145969
Reviewed by Sergio Villar Senin.
Source/WebCore:
For URIs like foo:bar#baz, what the custom protocol manager
receives in the UI process is foo:bar, so the user can't handle fragments.
* platform/network/soup/ResourceRequestSoup.cpp:
(WebCore::ResourceRequest::updateSoupRequest): If the SoupRequest
is a WebKitSoupRequestGeneric, call
webkitSoupRequestGenericSetRequest with the ResourceRequest.
* platform/network/soup/WebKitSoupRequestGeneric.cpp:
(webkitSoupRequestGenericSetRequest):
(webkitSoupRequestGenericGetRequest):
* platform/network/soup/WebKitSoupRequestGeneric.h:
Source/WebKit2:
Use the WebKitSoupRequestGeneric request instead of creating a new one
from the SoupRequest URI, since that is the network one and doesn't
contain the fragment identifier part.
* Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp:
(WebKit::CustomProtocolManagerImpl::start):
Tools:
Add a test case to the custom URI schemes unit test.
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
(testWebContextURIScheme):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185552 => 185553)
--- trunk/Source/WebCore/ChangeLog 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebCore/ChangeLog 2015-06-15 16:36:24 UTC (rev 185553)
@@ -1,5 +1,24 @@
2015-06-15 Carlos Garcia Campos <[email protected]>
+ [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
+ https://bugs.webkit.org/show_bug.cgi?id=145969
+
+ Reviewed by Sergio Villar Senin.
+
+ For URIs like foo:bar#baz, what the custom protocol manager
+ receives in the UI process is foo:bar, so the user can't handle fragments.
+
+ * platform/network/soup/ResourceRequestSoup.cpp:
+ (WebCore::ResourceRequest::updateSoupRequest): If the SoupRequest
+ is a WebKitSoupRequestGeneric, call
+ webkitSoupRequestGenericSetRequest with the ResourceRequest.
+ * platform/network/soup/WebKitSoupRequestGeneric.cpp:
+ (webkitSoupRequestGenericSetRequest):
+ (webkitSoupRequestGenericGetRequest):
+ * platform/network/soup/WebKitSoupRequestGeneric.h:
+
+2015-06-15 Carlos Garcia Campos <[email protected]>
+
[SOUP] Move WebKitSoupRequestGeneric to platform layer
https://bugs.webkit.org/show_bug.cgi?id=145968
Modified: trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp (185552 => 185553)
--- trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp 2015-06-15 16:36:24 UTC (rev 185553)
@@ -26,6 +26,7 @@
#include "GUniquePtrSoup.h"
#include "HTTPParsers.h"
#include "MIMETypeRegistry.h"
+#include "WebKitSoupRequestGeneric.h"
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -128,6 +129,9 @@
uint64_t* initiatingPageIDPtr = static_cast<uint64_t*>(fastMalloc(sizeof(uint64_t)));
*initiatingPageIDPtr = m_initiatingPageID;
g_object_set_data_full(G_OBJECT(soupRequest), g_intern_static_string(gSoupRequestInitiatingPageIDKey), initiatingPageIDPtr, fastFree);
+
+ if (WEBKIT_IS_SOUP_REQUEST_GENERIC(soupRequest))
+ webkitSoupRequestGenericSetRequest(WEBKIT_SOUP_REQUEST_GENERIC(soupRequest), *this);
}
void ResourceRequest::updateFromSoupRequest(SoupRequest* soupRequest)
Modified: trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.cpp (185552 => 185553)
--- trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.cpp 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.cpp 2015-06-15 16:36:24 UTC (rev 185553)
@@ -20,6 +20,7 @@
#include "config.h"
#include "WebKitSoupRequestGeneric.h"
+#include "ResourceRequest.h"
#include <wtf/text/CString.h>
using namespace WebCore;
@@ -29,6 +30,7 @@
struct _WebKitSoupRequestGenericPrivate {
CString mimeType;
goffset contentLength;
+ ResourceRequest resourceRequest;
};
static void webkitSoupRequestGenericFinalize(GObject* object)
@@ -92,3 +94,13 @@
{
request->priv->mimeType = mimeType;
}
+
+void webkitSoupRequestGenericSetRequest(WebKitSoupRequestGeneric* request, const ResourceRequest& resourceRequest)
+{
+ request->priv->resourceRequest = resourceRequest;
+}
+
+const ResourceRequest& webkitSoupRequestGenericGetRequest(WebKitSoupRequestGeneric* request)
+{
+ return request->priv->resourceRequest;
+}
Modified: trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h (185552 => 185553)
--- trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h 2015-06-15 16:36:24 UTC (rev 185553)
@@ -26,6 +26,10 @@
G_BEGIN_DECLS
+namespace WebCore {
+class ResourceRequest;
+}
+
#define WEBKIT_TYPE_SOUP_REQUEST_GENERIC (webkit_soup_request_generic_get_type())
#define WEBKIT_SOUP_REQUEST_GENERIC(object) (G_TYPE_CHECK_INSTANCE_CAST((object), WEBKIT_TYPE_SOUP_REQUEST_GENERIC, WebKitSoupRequestGeneric))
#define WEBKIT_IS_SOUP_REQUEST_GENERIC(object) (G_TYPE_CHECK_INSTANCE_TYPE((object), WEBKIT_TYPE_SOUP_REQUEST_GENERIC))
@@ -53,6 +57,8 @@
void webkitSoupRequestGenericSetContentLength(WebKitSoupRequestGeneric*, goffset contentLength);
void webkitSoupRequestGenericSetContentType(WebKitSoupRequestGeneric*, const char* mimeType);
+void webkitSoupRequestGenericSetRequest(WebKitSoupRequestGeneric*, const WebCore::ResourceRequest&);
+const WebCore::ResourceRequest& webkitSoupRequestGenericGetRequest(WebKitSoupRequestGeneric*);
G_END_DECLS
Modified: trunk/Source/WebKit2/ChangeLog (185552 => 185553)
--- trunk/Source/WebKit2/ChangeLog 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-15 16:36:24 UTC (rev 185553)
@@ -1,3 +1,17 @@
+2015-06-15 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
+ https://bugs.webkit.org/show_bug.cgi?id=145969
+
+ Reviewed by Sergio Villar Senin.
+
+ Use the WebKitSoupRequestGeneric request instead of creating a new one
+ from the SoupRequest URI, since that is the network one and doesn't
+ contain the fragment identifier part.
+
+ * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp:
+ (WebKit::CustomProtocolManagerImpl::start):
+
2015-06-15 Hyungwook Lee <[email protected]>
[EFL] Make send/receive messages to communicate the Web and UI Processes using Injected Bundle.
Modified: trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp (185552 => 185553)
--- trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp 2015-06-15 16:36:24 UTC (rev 185553)
@@ -190,8 +190,7 @@
WebKitSoupRequestGeneric* request = WEBKIT_SOUP_REQUEST_GENERIC(g_task_get_source_object(task));
m_customProtocolMap.set(customProtocolID, std::make_unique<WebSoupRequestAsyncData>(task, request));
- WebCore::ResourceRequest resourceRequest(SOUP_REQUEST(request));
- m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, resourceRequest), 0);
+ m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, webkitSoupRequestGenericGetRequest(request)), 0);
}
GInputStream* CustomProtocolManagerImpl::finish(GTask* task, GError** error)
Modified: trunk/Tools/ChangeLog (185552 => 185553)
--- trunk/Tools/ChangeLog 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Tools/ChangeLog 2015-06-15 16:36:24 UTC (rev 185553)
@@ -1,3 +1,15 @@
+2015-06-15 Carlos Garcia Campos <[email protected]>
+
+ [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
+ https://bugs.webkit.org/show_bug.cgi?id=145969
+
+ Reviewed by Sergio Villar Senin.
+
+ Add a test case to the custom URI schemes unit test.
+
+ * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
+ (testWebContextURIScheme):
+
2015-06-15 Csaba Osztrogonác <[email protected]>
[GTK] Fix deprecated-register warning in the generated WebKitMarshal.cpp
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (185552 => 185553)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2015-06-15 15:43:43 UTC (rev 185552)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp 2015-06-15 16:36:24 UTC (rev 185553)
@@ -214,6 +214,16 @@
g_assert_cmpint(mainResourceDataSize, ==, strlen(echoHTML.get()));
g_assert(!strncmp(mainResourceData, echoHTML.get(), mainResourceDataSize));
+ test->loadURI("echo:with#fragment");
+ test->waitUntilLoadFinished();
+ g_assert_cmpstr(webkit_uri_scheme_request_get_path(test->m_uriSchemeRequest.get()), ==, "with");
+ g_assert_cmpstr(webkit_uri_scheme_request_get_uri(test->m_uriSchemeRequest.get()), ==, "echo:with#fragment");
+ echoHTML.reset(g_strdup_printf(kEchoHTMLFormat, webkit_uri_scheme_request_get_path(test->m_uriSchemeRequest.get())));
+ mainResourceDataSize = 0;
+ mainResourceData = test->mainResourceData(mainResourceDataSize);
+ g_assert_cmpint(mainResourceDataSize, ==, strlen(echoHTML.get()));
+ g_assert(!strncmp(mainResourceData, echoHTML.get(), mainResourceDataSize));
+
test->registerURISchemeHandler("nomime", kBarHTML, -1, 0);
test->m_loadEvents.clear();
test->loadURI("nomime:foo-bar");