Commit b5f26d5d authored by aroben@apple.com's avatar aroben@apple.com

Fix an assertion on launch in KURL::KURL

        All URL strings passed in to the WebKit API need to be passed to
        MarshallingHelpers::BSTRToKURL so that they may be properly parsed.

        Reviewed by Alexey Proskuryakov.

        * MarshallingHelpers.cpp:
        (MarshallingHelpers::BSTRToKURL): Changed to use the two-argument
        constructor for KURL so that the strings will be parsed rather than
        assumed to be in the correct encoding/form.

        * WebResource.cpp:
        (WebResource::initWithData):
        * WebURLResponse.cpp:
        (WebURLResponse::initWithURL):
        * WebView.cpp:
        (WebView::userAgentForURL):
        (WebView::copyURL):
        Changed to use MarshallingHelpers::BSTRToKURL instead of trying to do
        the work manually.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40248 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 238ba7cd
2009-01-26 Adam Roben <aroben@apple.com>
Fix an assertion on launch in KURL::KURL
All URL strings passed in to the WebKit API need to be passed to
MarshallingHelpers::BSTRToKURL so that they may be properly parsed.
Reviewed by Alexey Proskuryakov.
* MarshallingHelpers.cpp:
(MarshallingHelpers::BSTRToKURL): Changed to use the two-argument
constructor for KURL so that the strings will be parsed rather than
assumed to be in the correct encoding/form.
* WebResource.cpp:
(WebResource::initWithData):
* WebURLResponse.cpp:
(WebURLResponse::initWithURL):
* WebView.cpp:
(WebView::userAgentForURL):
(WebView::copyURL):
Changed to use MarshallingHelpers::BSTRToKURL instead of trying to do
the work manually.
2009-01-25 Darin Adler <darin@apple.com>
Try to fix Windows build.
......
......@@ -42,7 +42,7 @@ CFDictionaryValueCallBacks MarshallingHelpers::kIUnknownDictionaryValueCallBacks
KURL MarshallingHelpers::BSTRToKURL(BSTR urlStr)
{
return KURL(String(urlStr, SysStringLen(urlStr)));
return KURL(KURL(), String(urlStr, SysStringLen(urlStr)));
}
BSTR MarshallingHelpers::KURLToBSTR(const KURL& url)
......
......@@ -27,6 +27,7 @@
#include "WebKitDLL.h"
#include "WebResource.h"
#include "MarshallingHelpers.h"
#include "MemoryStream.h"
#pragma warning(push, 0)
......@@ -105,7 +106,7 @@ HRESULT STDMETHODCALLTYPE WebResource::initWithData(
/* [in] */ BSTR frameName)
{
m_data = data;
m_url = KURL(String(url));
m_url = MarshallingHelpers::BSTRToKURL(url);
m_mimeType = String(mimeType);
m_textEncodingName = String(textEncodingName);
m_frameName = String(frameName);
......
......@@ -296,7 +296,7 @@ HRESULT STDMETHODCALLTYPE WebURLResponse::initWithURL(
/* [in] */ int expectedContentLength,
/* [in] */ BSTR textEncodingName)
{
m_response = ResourceResponse(KURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String());
m_response = ResourceResponse(MarshallingHelpers::BSTRToKURL(url), String(mimeType), expectedContentLength, String(textEncodingName), String());
return S_OK;
}
......
......@@ -29,6 +29,7 @@
#include "CFDictionaryPropertyBag.h"
#include "DOMCoreClasses.h"
#include "MarshallingHelpers.h"
#include "WebDatabaseManager.h"
#include "WebDocumentLoader.h"
#include "WebEditorClient.h"
......@@ -2577,8 +2578,7 @@ HRESULT STDMETHODCALLTYPE WebView::userAgentForURL(
/* [in] */ BSTR url,
/* [retval][out] */ BSTR* userAgent)
{
String urlStr(url, SysStringLen(url));
String userAgentString = this->userAgentForKURL(KURL(urlStr));
String userAgentString = userAgentForKURL(MarshallingHelpers::BSTRToKURL(url));
*userAgent = SysAllocStringLen(userAgentString.characters(), userAgentString.length());
if (!*userAgent && userAgentString.length())
return E_OUTOFMEMORY;
......@@ -3806,8 +3806,7 @@ HRESULT STDMETHODCALLTYPE WebView::paste(
HRESULT STDMETHODCALLTYPE WebView::copyURL(
/* [in] */ BSTR url)
{
String temp(url, SysStringLen(url));
m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(KURL(temp), "");
m_page->focusController()->focusedOrMainFrame()->editor()->copyURL(MarshallingHelpers::BSTRToKURL(url), "");
return S_OK;
}
......
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