⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 185553 in webkit


Ignore:
Timestamp:
Jun 15, 2015, 9:36:24 AM (11 years ago)
Author:
Carlos Garcia Campos
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):

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185551 r185553  
     12015-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
     4        https://bugs.webkit.org/show_bug.cgi?id=145969
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        For URIs like foo:bar#baz, what the custom protocol manager
     9        receives in the UI process is foo:bar, so the user can't handle fragments.
     10
     11        * platform/network/soup/ResourceRequestSoup.cpp:
     12        (WebCore::ResourceRequest::updateSoupRequest): If the SoupRequest
     13        is a WebKitSoupRequestGeneric, call
     14        webkitSoupRequestGenericSetRequest with the ResourceRequest.
     15        * platform/network/soup/WebKitSoupRequestGeneric.cpp:
     16        (webkitSoupRequestGenericSetRequest):
     17        (webkitSoupRequestGenericGetRequest):
     18        * platform/network/soup/WebKitSoupRequestGeneric.h:
     19
    1202015-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
    221
  • trunk/Source/WebCore/platform/network/soup/ResourceRequestSoup.cpp

    r176930 r185553  
    2727#include "HTTPParsers.h"
    2828#include "MIMETypeRegistry.h"
     29#include "WebKitSoupRequestGeneric.h"
    2930#include <wtf/text/CString.h>
    3031#include <wtf/text/WTFString.h>
     
    129130    *initiatingPageIDPtr = m_initiatingPageID;
    130131    g_object_set_data_full(G_OBJECT(soupRequest), g_intern_static_string(gSoupRequestInitiatingPageIDKey), initiatingPageIDPtr, fastFree);
     132
     133    if (WEBKIT_IS_SOUP_REQUEST_GENERIC(soupRequest))
     134        webkitSoupRequestGenericSetRequest(WEBKIT_SOUP_REQUEST_GENERIC(soupRequest), *this);
    131135}
    132136
  • trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.cpp

    r185551 r185553  
    2121#include "WebKitSoupRequestGeneric.h"
    2222
     23#include "ResourceRequest.h"
    2324#include <wtf/text/CString.h>
    2425
     
    3031    CString mimeType;
    3132    goffset contentLength;
     33    ResourceRequest resourceRequest;
    3234};
    3335
     
    9395    request->priv->mimeType = mimeType;
    9496}
     97
     98void webkitSoupRequestGenericSetRequest(WebKitSoupRequestGeneric* request, const ResourceRequest& resourceRequest)
     99{
     100    request->priv->resourceRequest = resourceRequest;
     101}
     102
     103const ResourceRequest& webkitSoupRequestGenericGetRequest(WebKitSoupRequestGeneric* request)
     104{
     105    return request->priv->resourceRequest;
     106}
  • trunk/Source/WebCore/platform/network/soup/WebKitSoupRequestGeneric.h

    r185551 r185553  
    2727G_BEGIN_DECLS
    2828
     29namespace WebCore {
     30class ResourceRequest;
     31}
     32
    2933#define WEBKIT_TYPE_SOUP_REQUEST_GENERIC            (webkit_soup_request_generic_get_type())
    3034#define WEBKIT_SOUP_REQUEST_GENERIC(object)         (G_TYPE_CHECK_INSTANCE_CAST((object), WEBKIT_TYPE_SOUP_REQUEST_GENERIC, WebKitSoupRequestGeneric))
     
    5458void webkitSoupRequestGenericSetContentLength(WebKitSoupRequestGeneric*, goffset contentLength);
    5559void webkitSoupRequestGenericSetContentType(WebKitSoupRequestGeneric*, const char* mimeType);
     60void webkitSoupRequestGenericSetRequest(WebKitSoupRequestGeneric*, const WebCore::ResourceRequest&);
     61const WebCore::ResourceRequest& webkitSoupRequestGenericGetRequest(WebKitSoupRequestGeneric*);
    5662
    5763G_END_DECLS
  • trunk/Source/WebKit2/ChangeLog

    r185552 r185553  
     12015-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
     4        https://bugs.webkit.org/show_bug.cgi?id=145969
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Use the WebKitSoupRequestGeneric request instead of creating a new one
     9        from the SoupRequest URI, since that is the network one and doesn't
     10        contain the fragment identifier part.
     11
     12        * Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp:
     13        (WebKit::CustomProtocolManagerImpl::start):
     14
    1152015-06-15  Hyungwook Lee  <hyungwook.lee@navercorp.com>
    216
  • trunk/Source/WebKit2/Shared/Network/CustomProtocols/soup/CustomProtocolManagerImpl.cpp

    r185551 r185553  
    191191    m_customProtocolMap.set(customProtocolID, std::make_unique<WebSoupRequestAsyncData>(task, request));
    192192
    193     WebCore::ResourceRequest resourceRequest(SOUP_REQUEST(request));
    194     m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, resourceRequest), 0);
     193    m_childProcess->send(Messages::CustomProtocolManagerProxy::StartLoading(customProtocolID, webkitSoupRequestGenericGetRequest(request)), 0);
    195194}
    196195
  • trunk/Tools/ChangeLog

    r185550 r185553  
     12015-06-15  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [SOUP] Custom URI schemes don't work for requests containing a fragment identifier
     4        https://bugs.webkit.org/show_bug.cgi?id=145969
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Add a test case to the custom URI schemes unit test.
     9
     10        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
     11        (testWebContextURIScheme):
     12
    1132015-06-15  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp

    r185502 r185553  
    215215    g_assert(!strncmp(mainResourceData, echoHTML.get(), mainResourceDataSize));
    216216
     217    test->loadURI("echo:with#fragment");
     218    test->waitUntilLoadFinished();
     219    g_assert_cmpstr(webkit_uri_scheme_request_get_path(test->m_uriSchemeRequest.get()), ==, "with");
     220    g_assert_cmpstr(webkit_uri_scheme_request_get_uri(test->m_uriSchemeRequest.get()), ==, "echo:with#fragment");
     221    echoHTML.reset(g_strdup_printf(kEchoHTMLFormat, webkit_uri_scheme_request_get_path(test->m_uriSchemeRequest.get())));
     222    mainResourceDataSize = 0;
     223    mainResourceData = test->mainResourceData(mainResourceDataSize);
     224    g_assert_cmpint(mainResourceDataSize, ==, strlen(echoHTML.get()));
     225    g_assert(!strncmp(mainResourceData, echoHTML.get(), mainResourceDataSize));
     226
    217227    test->registerURISchemeHandler("nomime", kBarHTML, -1, 0);
    218228    test->m_loadEvents.clear();
Note: See TracChangeset for help on using the changeset viewer.