Commit cd243a2f authored by weinig@apple.com's avatar weinig@apple.com

2011-02-15 Sam Weinig <sam@webkit.org>

        Reviewed by Darin Adler.

        Crash loading fast/loader/empty-embed-src-attribute.html
        <rdar://problem/9005541>
        https://bugs.webkit.org/show_bug.cgi?id=54483

        Add the ability to encode/decode and empty ResourceRequest.

        * Shared/mac/WebCoreArgumentCodersMac.mm:
        (CoreIPC::encodeResourceRequest):
        (CoreIPC::decodeResourceRequest):
        (CoreIPC::decodeResourceResponse): Add missing false check for the
        decode step.
        * Shared/win/WebCoreArgumentCodersWin.cpp:
        (CoreIPC::encodeResourceRequest):
        (CoreIPC::decodeResourceRequest):
        (CoreIPC::decodeResourceResponse): Add missing false check for the
        decode step.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@78600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 11839856
2011-02-15 Sam Weinig <sam@webkit.org>
Reviewed by Darin Adler.
Crash loading fast/loader/empty-embed-src-attribute.html
<rdar://problem/9005541>
https://bugs.webkit.org/show_bug.cgi?id=54483
Add the ability to encode/decode and empty ResourceRequest.
* Shared/mac/WebCoreArgumentCodersMac.mm:
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
(CoreIPC::decodeResourceResponse): Add missing false check for the
decode step.
* Shared/win/WebCoreArgumentCodersWin.cpp:
(CoreIPC::encodeResourceRequest):
(CoreIPC::decodeResourceRequest):
(CoreIPC::decodeResourceResponse): Add missing false check for the
decode step.
2011-02-15 Andreas Kling <kling@webkit.org>
Unreviewed Qt build fix after r78588.
......@@ -33,12 +33,27 @@ namespace CoreIPC {
void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
{
bool requestIsPresent = resourceRequest.nsURLRequest();
encoder->encode(requestIsPresent);
if (!requestIsPresent)
return;
RetainPtr<CFDictionaryRef> dictionary(AdoptCF, WKNSURLRequestCreateSerializableRepresentation(resourceRequest.nsURLRequest(), CoreIPC::tokenNullTypeRef()));
encode(encoder, dictionary.get());
}
bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
{
bool requestIsPresent;
if (!decoder->decode(requestIsPresent))
return false;
if (!requestIsPresent) {
resourceRequest = WebCore::ResourceRequest();
return true;
}
RetainPtr<CFDictionaryRef> dictionary;
if (!decode(decoder, dictionary))
return false;
......@@ -66,7 +81,8 @@ void encodeResourceResponse(ArgumentEncoder* encoder, const WebCore::ResourceRes
bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse& resourceResponse)
{
bool responseIsPresent;
decoder->decode(responseIsPresent);
if (!decoder->decode(responseIsPresent))
return false;
if (!responseIsPresent) {
resourceResponse = WebCore::ResourceResponse();
......@@ -85,5 +101,4 @@ bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse&
return true;
}
} // namespace CoreIPC
......@@ -38,6 +38,12 @@ namespace CoreIPC {
void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequest& resourceRequest)
{
#if USE(CFNETWORK)
bool requestIsPresent = resourceResponse.cfURLRequest();
encoder->encode(requestIsPresent);
if (!requestIsPresent)
return;
RetainPtr<CFDictionaryRef> dictionary(AdoptCF, wkCFURLRequestCreateSerializableRepresentation(resourceRequest.cfURLRequest(), CoreIPC::tokenNullTypeRef()));
encode(encoder, dictionary.get());
#endif
......@@ -46,6 +52,15 @@ void encodeResourceRequest(ArgumentEncoder* encoder, const WebCore::ResourceRequ
bool decodeResourceRequest(ArgumentDecoder* decoder, WebCore::ResourceRequest& resourceRequest)
{
#if USE(CFNETWORK)
bool requestIsPresent;
if (!decoder->decode(requestIsPresent))
return false;
if (!requestIsPresent) {
resourceRequest = WebCore::ResourceRequest();
return true;
}
RetainPtr<CFDictionaryRef> dictionary;
if (!decode(decoder, dictionary))
return false;
......@@ -79,7 +94,8 @@ bool decodeResourceResponse(ArgumentDecoder* decoder, WebCore::ResourceResponse&
{
#if USE(CFNETWORK)
bool responseIsPresent;
decoder->decode(responseIsPresent);
if (!decoder->decode(responseIsPresent))
return false;
if (!responseIsPresent) {
resourceResponse = WebCore::ResourceResponse();
......
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