Example #1
0
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder& decoder, ResourceRequest& resourceRequest)
{
    if (kShouldSerializeWebCoreData) {
        ResourceRequest request;

        String url;
        if (!decoder.decode(url))
            return false;
        request.setURL(URL(URL(), url));

        String httpMethod;
        if (!decoder.decode(httpMethod))
            return false;
        request.setHTTPMethod(httpMethod);

        HTTPHeaderMap headers;
        if (!decoder.decode(headers))
            return false;
        request.addHTTPHeaderFields(headers);

        bool hasHTTPBody;
        if (!decoder.decode(hasHTTPBody))
            return false;
        if (hasHTTPBody) {
            String httpBody;
            if (!decoder.decode(httpBody))
                return false;
            request.setHTTPBody(FormData::create(httpBody.utf8()));
        }

        String firstPartyForCookies;
        if (!decoder.decode(firstPartyForCookies))
            return false;
        request.setFirstPartyForCookies(URL(URL(), firstPartyForCookies));

        resourceRequest = request;
    }

#if ENABLE(CACHE_PARTITIONING)
    String cachePartition;
    if (!decoder.decode(cachePartition))
        return false;
    resourceRequest.setCachePartition(cachePartition);
#endif

    return decodePlatformData(decoder, resourceRequest);
}
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest)
{
    ResourceRequest request;

    String url;
    if (!decoder->decode(url))
        return false;
    request.setURL(KURL(KURL(), url));

    String httpMethod;
    if (!decoder->decode(httpMethod))
        return false;
    request.setHTTPMethod(httpMethod);

    HTTPHeaderMap headers;
    if (!decoder->decode(headers))
        return false;
    request.addHTTPHeaderFields(headers);

    bool hasHTTPBody;
    if (!decoder->decode(hasHTTPBody))
        return false;
    if (hasHTTPBody) {
        String httpBody;
        if (!decoder->decode(httpBody))
            return false;
        request.setHTTPBody(FormData::create(httpBody.utf8()));
    }

    String firstPartyForCookies;
    if (!decoder->decode(firstPartyForCookies))
        return false;
    request.setFirstPartyForCookies(KURL(KURL(), firstPartyForCookies));

    uint32_t soupMessageFlags;
    if (!decoder->decode(soupMessageFlags))
        return false;
    request.setSoupMessageFlags(static_cast<SoupMessageFlags>(soupMessageFlags));

    resourceRequest = request;
    return true;
}
Example #3
0
bool ArgumentCoder<ResourceRequest>::decode(ArgumentDecoder* decoder, ResourceRequest& resourceRequest)
{
    if (kShouldSerializeWebCoreData) {
        ResourceRequest request;

        String url;
        if (!decoder->decode(url))
            return false;
        request.setURL(KURL(KURL(), url));

        String httpMethod;
        if (!decoder->decode(httpMethod))
            return false;
        request.setHTTPMethod(httpMethod);

        HTTPHeaderMap headers;
        if (!decoder->decode(headers))
            return false;
        request.addHTTPHeaderFields(headers);

        bool hasHTTPBody;
        if (!decoder->decode(hasHTTPBody))
            return false;
        if (hasHTTPBody) {
            String httpBody;
            if (!decoder->decode(httpBody))
                return false;
            request.setHTTPBody(FormData::create(httpBody.utf8()));
        }

        String firstPartyForCookies;
        if (!decoder->decode(firstPartyForCookies))
            return false;
        request.setFirstPartyForCookies(KURL(KURL(), firstPartyForCookies));

        resourceRequest = request;
    }

    return decodePlatformData(decoder, resourceRequest);
}