Commit 0c0f45f1 authored by kov@webkit.org's avatar kov@webkit.org

2009-06-11 Gustavo Noronha Silva <gns@gnome.org>

        Reviewed by Xan Lopez.

        Fix crash when downloading, caused by assuming SoupMessage would
        be there. This change factors the logic required to create a
        ResourceRequest from a WebKitNetworkRequest into a core()
        function, like we have for some other classes.

        * webkit/webkitdownload.cpp:
        (webkit_download_start):
        * webkit/webkitprivate.cpp:
        (WebKit::core):
        * webkit/webkitprivate.h:
        * webkit/webkitwebframe.cpp:
        (webkit_web_frame_load_request):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44619 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 38f3b032
2009-06-11 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Xan Lopez.
Fix crash when downloading, caused by assuming SoupMessage would
be there. This change factors the logic required to create a
ResourceRequest from a WebKitNetworkRequest into a core()
function, like we have for some other classes.
* webkit/webkitdownload.cpp:
(webkit_download_start):
* webkit/webkitprivate.cpp:
(WebKit::core):
* webkit/webkitprivate.h:
* webkit/webkitwebframe.cpp:
(webkit_web_frame_load_request):
2009-06-10 Gustavo Noronha Silva <gns@gnome.org>
Reviewed by Xan Lopez.
......
......@@ -426,7 +426,7 @@ void webkit_download_start(WebKitDownload* download)
if (priv->resourceHandle)
priv->resourceHandle->setClient(priv->downloadClient);
else
priv->resourceHandle = ResourceHandle::create(ResourceRequest(webkit_network_request_get_message(priv->networkRequest)), priv->downloadClient, 0, false, false, false);
priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false, false);
priv->timer = g_timer_new();
webkit_download_open_stream_for_uri(download, priv->destinationURI);
......
......@@ -99,6 +99,16 @@ WebCore::NavigationType core(WebKitWebNavigationReason type)
return (WebCore::NavigationType)type;
}
WebCore::ResourceRequest core(WebKitNetworkRequest* request)
{
SoupMessage* soupMessage = webkit_network_request_get_message(request);
if (soupMessage)
return ResourceRequest(soupMessage);
KURL url = KURL(KURL(), String::fromUTF8(webkit_network_request_get_uri(request)));
return ResourceRequest(url);
}
} /** end namespace WebKit */
static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMessage* message, gpointer userData)
......
......@@ -74,6 +74,8 @@ namespace WebKit {
WebKitWebNavigationReason kit(WebCore::NavigationType type);
WebCore::NavigationType core(WebKitWebNavigationReason reason);
WebCore::ResourceRequest core(WebKitNetworkRequest* request);
}
typedef struct {
......
......@@ -510,14 +510,7 @@ void webkit_web_frame_load_request(WebKitWebFrame* frame, WebKitNetworkRequest*
if (!coreFrame)
return;
SoupMessage* soupMessage = webkit_network_request_get_message(request);
if (soupMessage) {
coreFrame->loader()->load(ResourceRequest(soupMessage), false);
return;
}
KURL url = KURL(KURL(), String::fromUTF8(webkit_network_request_get_uri(request)));
coreFrame->loader()->load(ResourceRequest(url), false);
coreFrame->loader()->load(core(request), false);
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment