Changeset 67291 in webkit


Ignore:
Timestamp:
Sep 11, 2010 12:54:15 AM (14 years ago)
Author:
diegohcg@webkit.org
Message:

Add NetworkingContext to avoid layer violations https://bugs.webkit.org/show_bug.cgi?id=42292

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2010-09-10
Reviewed by Darin Adler.

WebCore:

Activate NetworkingContext:

Since the ResourceHandle::create, ResourceHandle::start and
ResourceHandle::loadResourceSynchronously API's were modified,
having their Frame* parameter substituted by a NetworkingContext*,
all implementations of them were also modified.
This patch also modifies all functions that were calling the above
ones.

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::loadResourceSynchronously):

  • loader/FrameLoader.h:
  • loader/MainResourceLoader.cpp:

(WebCore::MainResourceLoader::loadNow):

  • loader/PingLoader.cpp:

(WebCore::PingLoader::PingLoader):

  • loader/ResourceLoader.cpp:

(WebCore::ResourceLoader::load):

  • loader/appcache/ApplicationCacheGroup.cpp:

(WebCore::ApplicationCacheGroup::createResourceHandle):

  • loader/icon/IconFetcher.cpp:

(WebCore::IconFetcher::loadEntry):

  • platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:

(webKitWebSrcStart):

  • platform/network/ResourceHandle.cpp:

(WebCore::ResourceHandle::create):

  • platform/network/ResourceHandle.h:
  • platform/network/ResourceHandleInternal.h:

(WebCore::ResourceHandleInternal::ResourceHandleInternal):

  • platform/network/cf/ResourceHandleCFNet.cpp:

(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):

  • platform/network/curl/ResourceHandleCurl.cpp:

(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):

  • platform/network/mac/ResourceHandleMac.mm:

(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):

  • platform/network/qt/QNetworkReplyHandler.cpp:

(WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
(WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
(WebCore::QNetworkReplyHandler::start):

  • platform/network/qt/ResourceHandleQt.cpp:

(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::willLoadFromCache):
(WebCore::ResourceHandle::loadResourceSynchronously):

  • platform/network/soup/ResourceHandleSoup.cpp:
  • platform/network/win/ResourceHandleWin.cpp:

(WebCore::ResourceHandle::start):

WebKit/chromium:

  • src/ResourceHandle.cpp:

(WebCore::ResourceHandle::create):
(WebCore::ResourceHandle::start):
(WebCore::ResourceHandle::loadResourceSynchronously):

WebKit/gtk:

  • webkit/webkitdownload.cpp:

(webkit_download_start):

  • webkit/webkitprivate.cpp:

(currentToplevelCallback):

WebKit/win:

  • WebCoreSupport/WebFrameNetworkingContext.cpp:

(WebFrameNetworkingContext::blockedError):

  • WebCoreSupport/WebFrameNetworkingContext.h:

WebKit2:

  • WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp:
  • WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h:

(WebFrameNetworkingContext::create):

Location:
trunk
Files:
30 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r67288 r67291  
     12010-09-10  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add NetworkingContext to avoid layer violations
     6        https://bugs.webkit.org/show_bug.cgi?id=42292
     7
     8        Activate NetworkingContext:
     9
     10        Since the ResourceHandle::create, ResourceHandle::start and
     11        ResourceHandle::loadResourceSynchronously API's were modified,
     12        having their Frame* parameter substituted by a NetworkingContext*,
     13        all implementations of them were also modified.
     14        This patch also modifies all functions that were calling the above
     15        ones.
     16
     17        * loader/FrameLoader.cpp:
     18        (WebCore::FrameLoader::loadResourceSynchronously):
     19        * loader/FrameLoader.h:
     20        * loader/MainResourceLoader.cpp:
     21        (WebCore::MainResourceLoader::loadNow):
     22        * loader/PingLoader.cpp:
     23        (WebCore::PingLoader::PingLoader):
     24        * loader/ResourceLoader.cpp:
     25        (WebCore::ResourceLoader::load):
     26        * loader/appcache/ApplicationCacheGroup.cpp:
     27        (WebCore::ApplicationCacheGroup::createResourceHandle):
     28        * loader/icon/IconFetcher.cpp:
     29        (WebCore::IconFetcher::loadEntry):
     30        * platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp:
     31        (webKitWebSrcStart):
     32        * platform/network/ResourceHandle.cpp:
     33        (WebCore::ResourceHandle::create):
     34        * platform/network/ResourceHandle.h:
     35        * platform/network/ResourceHandleInternal.h:
     36        (WebCore::ResourceHandleInternal::ResourceHandleInternal):
     37        * platform/network/cf/ResourceHandleCFNet.cpp:
     38        (WebCore::ResourceHandle::start):
     39        (WebCore::ResourceHandle::loadResourceSynchronously):
     40        * platform/network/curl/ResourceHandleCurl.cpp:
     41        (WebCore::ResourceHandle::start):
     42        (WebCore::ResourceHandle::loadResourceSynchronously):
     43        * platform/network/mac/ResourceHandleMac.mm:
     44        (WebCore::ResourceHandle::start):
     45        (WebCore::ResourceHandle::loadResourceSynchronously):
     46        * platform/network/qt/QNetworkReplyHandler.cpp:
     47        (WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
     48        (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
     49        (WebCore::QNetworkReplyHandler::start):
     50        * platform/network/qt/ResourceHandleQt.cpp:
     51        (WebCore::ResourceHandle::start):
     52        (WebCore::ResourceHandle::willLoadFromCache):
     53        (WebCore::ResourceHandle::loadResourceSynchronously):
     54        * platform/network/soup/ResourceHandleSoup.cpp:
     55        * platform/network/win/ResourceHandleWin.cpp:
     56        (WebCore::ResourceHandle::start):
     57
    1582010-09-10  Jer Noble  <jer.noble@apple.com>
    259
  • trunk/WebCore/loader/FrameLoader.cpp

    r67253 r67291  
    27662766        if (!documentLoader()->applicationCacheHost()->maybeLoadSynchronously(newRequest, error, response, data)) {
    27672767#endif
    2768             ResourceHandle::loadResourceSynchronously(newRequest, storedCredentials, error, response, data, m_frame);
     2768            ResourceHandle::loadResourceSynchronously(networkingContext(), newRequest, storedCredentials, error, response, data);
    27692769#if ENABLE(OFFLINE_WEB_APPLICATIONS)
    27702770            documentLoader()->applicationCacheHost()->maybeLoadFallbackSynchronously(newRequest, error, response, data);
  • trunk/WebCore/loader/FrameLoader.h

    r67224 r67291  
    330330    bool pageDismissalEventBeingDispatched() const { return m_pageDismissalEventBeingDispatched; }
    331331
    332     inline NetworkingContext* networkingContext() const;
     332    NetworkingContext* networkingContext() const;
    333333
    334334private:
  • trunk/WebCore/loader/MainResourceLoader.cpp

    r67224 r67291  
    539539        handleEmptyLoad(url, !shouldLoadEmpty);
    540540    else
    541         m_handle = ResourceHandle::create(r, this, m_frame.get(), false, true);
     541        m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, this, false, true);
    542542
    543543    return false;
  • trunk/WebCore/loader/PingLoader.cpp

    r66815 r67291  
    6363PingLoader::PingLoader(Frame* frame, const ResourceRequest& request)
    6464{
    65     m_handle = ResourceHandle::create(request, this, frame, false, false);
     65    m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false);
    6666}
    6767
  • trunk/WebCore/loader/ResourceLoader.cpp

    r66674 r67291  
    3636#include "Frame.h"
    3737#include "FrameLoader.h"
     38#include "FrameLoaderClient.h"
    3839#include "InspectorTimelineAgent.h"
    3940#include "Page.h"
     
    144145    }
    145146   
    146     m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading, m_shouldContentSniff);
     147    m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), clientRequest, this, m_defersLoading, m_shouldContentSniff);
    147148
    148149    return true;
  • trunk/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r64613 r67291  
    4040#include "Frame.h"
    4141#include "FrameLoader.h"
     42#include "FrameLoaderClient.h"
    4243#include "MainResourceLoader.h"
    4344#include "ManifestParser.h"
     
    480481    }
    481482
    482     RefPtr<ResourceHandle> handle = ResourceHandle::create(request, this, m_frame, false, true);
     483    RefPtr<ResourceHandle> handle = ResourceHandle::create(m_frame->loader()->networkingContext(), request, this, false, true);
    483484#if ENABLE(INSPECTOR)
    484485    // Because willSendRequest only gets called during redirects, we initialize
  • trunk/WebCore/loader/icon/IconFetcher.cpp

    r65468 r67291  
    2828
    2929#include "Frame.h"
     30#include "FrameLoaderClient.h"
    3031#include "HTMLHeadElement.h"
    3132#include "HTMLLinkElement.h"
     
    174175    ASSERT(!m_handle);
    175176   
    176     m_handle = ResourceHandle::create(m_entries[m_currentEntry].url(), this, m_frame, false, false);
     177    m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), m_entries[m_currentEntry].url(), this, false, false);
    177178}
    178179   
  • trunk/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp

    r66887 r67291  
    2424#include "GOwnPtr.h"
    2525#include "GRefPtr.h"
     26#include "NetworkingContext.h"
    2627#include "Noncopyable.h"
    2728#include "NotImplemented.h"
     
    392393    request.setAllowCookies(true);
    393394
     395    NetworkingContext* context = 0;
    394396    if (priv->frame) {
    395397        Document* document = priv->frame->document();
     
    398400
    399401        FrameLoader* loader = priv->frame->loader();
    400         if (loader)
     402        if (loader) {
    401403            loader->addExtraFieldsToSubresourceRequest(request);
     404            context = loader->networkingContext();
     405        }
    402406    }
    403407
     
    420424    request.setHTTPHeaderField("transferMode.dlna", "Streaming");
    421425
    422     priv->resourceHandle = ResourceHandle::create(request, priv->client, 0, false, false);
     426    priv->resourceHandle = ResourceHandle::create(context, request, priv->client, false, false);
    423427    if (!priv->resourceHandle) {
    424428        GST_ERROR_OBJECT(src, "Failed to create ResourceHandle");
  • trunk/WebCore/platform/network/NetworkingContext.h

    • Property svn:executable set to *
    r65579 r67291  
    5858    virtual String userAgent() const = 0;
    5959    virtual String referrer() const = 0;
     60    virtual ResourceError blockedError(const ResourceRequest&) const = 0;
    6061#endif
    6162
  • trunk/WebCore/platform/network/ResourceHandle.cpp

    r65827 r67291  
    5353}
    5454
    55 PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, ResourceHandleClient* client,
    56     Frame* frame, bool defersLoading, bool shouldContentSniff)
     55PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context, const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, bool shouldContentSniff)
    5756{
    5857#if ENABLE(BLOB)
     
    6968        return newHandle.release();
    7069
    71     if (newHandle->start(frame))
     70    if (newHandle->start(context))
    7271        return newHandle.release();
    7372
  • trunk/WebCore/platform/network/ResourceHandle.h

    r65827 r67291  
    3030#include "AuthenticationClient.h"
    3131#include "HTTPHeaderMap.h"
     32#include "NetworkingContext.h"
    3233#include "ThreadableLoader.h"
    3334#include <wtf/OwnPtr.h>
     
    110111
    111112public:
    112     // FIXME: should not need the Frame
    113     static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool shouldContentSniff);
    114     static void loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data, Frame* frame);
     113    static PassRefPtr<ResourceHandle> create(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
     114    static void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
    115115
    116116    static void prepareForURL(const KURL&);
     
    213213    void scheduleFailure(FailureType);
    214214
    215     bool start(Frame*);
     215    bool start(NetworkingContext*);
    216216
    217217    virtual void refAuthenticationClient() { ref(); }
  • trunk/WebCore/platform/network/ResourceHandleInternal.h

    r65835 r67291  
    5252
    5353#if PLATFORM(QT)
    54 class QWebFrame;
    5554class QWebNetworkJob;
    5655namespace WebCore {
     
    122121            , m_total(0)
    123122            , m_idleHandler(0)
    124             , m_frame(0)
    125123#endif
    126124#if PLATFORM(QT)
    127125            , m_job(0)
    128             , m_frame(0)
    129126#endif
    130127#if PLATFORM(MAC)
     
    203200        gsize m_bufferSize, m_total;
    204201        guint m_idleHandler;
    205         Frame* m_frame;
     202        RefPtr<NetworkingContext> m_context;
    206203#endif
    207204#if PLATFORM(QT)
    208205        QNetworkReplyHandler* m_job;
    209         QWebFrame* m_frame;
     206        RefPtr<NetworkingContext> m_context;
    210207#endif
    211208
  • trunk/WebCore/platform/network/cf/ResourceHandleCFNet.cpp

    • Property svn:executable set to *
    r66963 r67291  
    433433}
    434434
    435 bool ResourceHandle::start(Frame* frame)
    436 {
    437     // If we are no longer attached to a Page, this must be an attempted load from an
    438     // onUnload handler, so let's just block it.
    439     if (!frame->page())
     435bool ResourceHandle::start(NetworkingContext* context)
     436{
     437    if (!context)
     438        return false;
     439
     440    // If NetworkingContext is invalid then we are no longer attached to a Page,
     441    // this must be an attempted load from an unload handler, so let's just block it.
     442    if (!context->isValid())
    440443        return false;
    441444
     
    616619}
    617620
    618 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector, Frame* frame)
     621void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector)
    619622{
    620623    LOG(Network, "ResourceHandle::loadResourceSynchronously:%s allowStoredCredentials:%u", request.url().string().utf8().data(), storedCredentials);
     
    630633    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
    631634
    632     if (handle->d->m_scheduledFailureType != NoFailure) {
    633         error = frame->loader()->blockedError(request);
     635    if (context && handle->d->m_scheduledFailureType != NoFailure) {
     636        error = context->blockedError(request);
    634637        return;
    635638    }
  • trunk/WebCore/platform/network/curl/ResourceHandleCurl.cpp

    r66963 r67291  
    104104}
    105105
    106 bool ResourceHandle::start(Frame* frame)
     106bool ResourceHandle::start(NetworkingContext* context)
    107107{
    108108    // The frame could be null if the ResourceHandle is not associated to any
    109109    // Frame, e.g. if we are downloading a file.
    110110    // If the frame is not null but the page is null this must be an attempted
    111     // load from an onUnload handler, so let's just block it.
    112     if (frame && !frame->page())
     111    // load from an unload handler, so let's just block it.
     112    // If both the frame and the page are not null the context is valid.
     113    if (context && !context->isValid())
    113114        return false;
    114115
     
    188189}
    189190
    190 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame*)
     191void ResourceHandle::loadResourceSynchronously(NetworkingContext*, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
    191192{
    192193    WebCoreSynchronousLoader syncLoader;
  • trunk/WebCore/platform/network/mac/ResourceHandleMac.mm

    r66963 r67291  
    261261}
    262262
    263 bool ResourceHandle::start(Frame* frame)
    264 {
    265     if (!frame)
     263bool ResourceHandle::start(NetworkingContext* context)
     264{
     265    if (!context)
    266266        return false;
    267267
    268268    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    269269
    270     // If we are no longer attached to a Page, this must be an attempted load from an
    271     // onUnload handler, so let's just block it.
    272     Page* page = frame->page();
    273     if (!page)
     270    // If NetworkingContext is invalid then we are no longer attached to a Page,
     271    // this must be an attempted load from an unload event handler, so let's just block it.
     272    if (!context->isValid())
    274273        return false;
    275274
     
    294293#endif
    295294
    296     d->m_needsSiteSpecificQuirks = frame->settings() && frame->settings()->needsSiteSpecificQuirks();
     295    d->m_needsSiteSpecificQuirks = context->needsSiteSpecificQuirks();
    297296
    298297    createNSURLConnection(
    299298        d->m_proxy.get(),
    300299        shouldUseCredentialStorage,
    301         d->m_shouldContentSniff || frame->settings()->localFileContentSniffingEnabled());
     300        d->m_shouldContentSniff || context->localFileContentSniffingEnabled());
    302301
    303302#ifndef BUILDING_ON_TIGER
    304303    bool scheduled = false;
    305     if (SchedulePairHashSet* scheduledPairs = page->scheduledRunLoopPairs()) {
     304    if (SchedulePairHashSet* scheduledPairs = context->scheduledRunLoopPairs()) {
    306305        SchedulePairHashSet::iterator end = scheduledPairs->end();
    307306        for (SchedulePairHashSet::iterator it = scheduledPairs->begin(); it != end; ++it) {
     
    462461}
    463462
    464 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
     463void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
    465464{
    466465    LOG(Network, "ResourceHandle::loadResourceSynchronously:%@ allowStoredCredentials:%u", request.nsURLRequest(), storedCredentials);
     
    484483    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
    485484
    486     if (handle->d->m_scheduledFailureType != NoFailure) {
    487         error = frame->loader()->blockedError(request);
     485    if (context && handle->d->m_scheduledFailureType != NoFailure) {
     486        error = context->blockedError(request);
    488487        return;
    489488    }
     
    492491        handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
    493492        storedCredentials == AllowStoredCredentials,
    494         handle->shouldContentSniff() || frame->settings()->localFileContentSniffingEnabled());
     493        handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()));
    495494
    496495    [handle->connection() scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:WebCoreSynchronousLoaderRunLoopMode];
     
    508507#else
    509508    UNUSED_PARAM(storedCredentials);
    510     UNUSED_PARAM(frame);
     509    UNUSED_PARAM(context);
    511510    NSURLRequest *firstRequest = request.nsURLRequest();
    512511
  • trunk/WebCore/platform/network/qt/QNetworkReplyHandler.cpp

    r65021 r67291  
    172172        m_method = QNetworkAccessManager::UnknownOperation;
    173173
    174     m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
     174    QObject* originatingObject = 0;
     175    if (m_resourceHandle->getInternal()->m_context)
     176        originatingObject = m_resourceHandle->getInternal()->m_context->originatingObject();
     177
     178    m_request = r.toNetworkRequest(originatingObject);
    175179
    176180    if (m_loadMode == LoadNormal)
     
    375379            return;
    376380
    377         m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
     381        QObject* originatingObject = 0;
     382        if (m_resourceHandle->getInternal()->m_context)
     383            originatingObject = m_resourceHandle->getInternal()->m_context->originatingObject();
     384
     385        m_request = newRequest.toNetworkRequest(originatingObject);
    378386        return;
    379387    }
     
    427435    ResourceHandleInternal* d = m_resourceHandle->getInternal();
    428436
    429     QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager();
     437    QNetworkAccessManager* manager = 0;
     438    if (d->m_context)
     439        manager = d->m_context->networkAccessManager();
     440
     441    if (!manager)
     442        return;
    430443
    431444    const QUrl url = m_request.url();
  • trunk/WebCore/platform/network/qt/ResourceHandleQt.cpp

    r66963 r67291  
    3434#include "CachedResourceLoader.h"
    3535#include "Frame.h"
     36#include "FrameNetworkingContext.h"
    3637#include "FrameLoaderClientQt.h"
    3738#include "NotImplemented.h"
     
    116117}
    117118
    118 bool ResourceHandle::start(Frame* frame)
    119 {
    120     if (!frame)
    121         return false;
    122 
    123     Page *page = frame->page();
    124     // If we are no longer attached to a Page, this must be an attempted load from an
    125     // onUnload handler, so let's just block it.
    126     if (!page)
     119bool ResourceHandle::start(NetworkingContext* context)
     120{
     121    // If NetworkingContext is invalid then we are no longer attached to a Page,
     122    // this must be an attempted load from an unload event handler, so let's just block it.
     123    if (context && !context->isValid())
    127124        return false;
    128125
     
    136133    }
    137134
    138     getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
     135    getInternal()->m_context = context;
    139136    ResourceHandleInternal *d = getInternal();
    140137    d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::LoadMode(d->m_defersLoading));
     
    160157        return false;
    161158
    162     QNetworkAccessManager* manager = QWebFramePrivate::kit(frame)->page()->networkAccessManager();
    163     QAbstractNetworkCache* cache = manager->cache();
     159    QNetworkAccessManager* manager = 0;
     160    QAbstractNetworkCache* cache = 0;
     161    if (frame->loader()->networkingContext()) {
     162        manager = frame->loader()->networkingContext()->networkAccessManager();
     163        cache = manager->cache();
     164    }
    164165
    165166    if (!cache)
     
    186187}
    187188
    188 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
     189void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
    189190{
    190191    WebCoreSynchronousLoader syncLoader;
     
    200201        d->m_firstRequest.setURL(urlWithCredentials);
    201202    }
    202     d->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
     203    d->m_context = context;
    203204    d->m_job = new QNetworkReplyHandler(handle.get(), QNetworkReplyHandler::LoadNormal);
    204205
     
    209210}
    210211
    211  
    212212void ResourceHandle::platformSetDefersLoading(bool defers)
    213213{
  • trunk/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r66963 r67291  
    579579}
    580580
    581 bool ResourceHandle::start(Frame* frame)
     581bool ResourceHandle::start(NetworkingContext* context)
    582582{
    583583    ASSERT(!d->m_msg);
    584 
    585584
    586585    // The frame could be null if the ResourceHandle is not associated to any
    587586    // Frame, e.g. if we are downloading a file.
    588587    // If the frame is not null but the page is null this must be an attempted
    589     // load from an onUnload handler, so let's just block it.
    590     if (frame && !frame->page())
     588    // load from an unload handler, so let's just block it.
     589    // If both the frame and the page are not null the context is valid.
     590    if (context && !context->isValid())
    591591        return false;
    592592
     
    596596
    597597    // Used to set the authentication dialog toplevel; may be NULL
    598     d->m_frame = frame;
     598    d->m_context = context;
    599599
    600600    if (equalIgnoringCase(protocol, "data"))
     
    656656}
    657657
    658 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
     658void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
    659659{
    660660    WebCoreSynchronousLoader syncLoader(error, response, data);
     
    663663    // https://bugs.webkit.org/show_bug.cgi?id=41823
    664664    RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
    665     handle->start(frame);
     665    handle->start(context);
    666666
    667667    syncLoader.run();
  • trunk/WebCore/platform/network/win/ResourceHandleWin.cpp

    r66963 r67291  
    407407}
    408408
    409 bool ResourceHandle::start(Frame* frame)
     409bool ResourceHandle::start(NetworkingContext* context)
    410410{
    411411    ref();
     
    416416        static HINTERNET internetHandle = 0;
    417417        if (!internetHandle) {
    418             String userAgentStr = frame->loader()->userAgent(request().url()) + String("", 1);
     418            String userAgentStr = context->userAgent() + String("", 1);
    419419            LPCWSTR userAgent = reinterpret_cast<const WCHAR*>(userAgentStr.characters());
    420420            // leak the Internet for now
     
    439439        // InternetConnect followed by HttpSendRequest.
    440440        HINTERNET urlHandle;
    441         String referrer = frame->loader()->referrer();
     441        String referrer = context->referrer();
    442442        if (request().httpMethod() == "POST") {
    443443            d->m_postReferrer = referrer;
  • trunk/WebKit/chromium/ChangeLog

    r67283 r67291  
     12010-09-10  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add NetworkingContext to avoid layer violations
     6        https://bugs.webkit.org/show_bug.cgi?id=42292
     7
     8        * src/ResourceHandle.cpp:
     9        (WebCore::ResourceHandle::create):
     10        (WebCore::ResourceHandle::start):
     11        (WebCore::ResourceHandle::loadResourceSynchronously):
     12
    1132010-09-10  Sam Weinig  <sam@webkit.org>
    214
  • trunk/WebKit/chromium/src/ResourceHandle.cpp

    r63770 r67291  
    212212}
    213213
    214 PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request,
     214PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context,
     215                                                  const ResourceRequest& request,
    215216                                                  ResourceHandleClient* client,
    216                                                   Frame* deprecated,
    217217                                                  bool defersLoading,
    218218                                                  bool shouldContentSniff)
     
    221221        request, client, defersLoading, shouldContentSniff));
    222222
    223     if (newHandle->start(deprecated))
     223    if (newHandle->start(context))
    224224        return newHandle.release();
    225225
     
    247247}
    248248
    249 bool ResourceHandle::start(Frame* deprecated)
     249bool ResourceHandle::start(NetworkingContext* context)
    250250{
    251251    d->start();
     
    289289
    290290// static
    291 void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
     291void ResourceHandle::loadResourceSynchronously(NetworkingContext* context,
     292                                               const ResourceRequest& request,
    292293                                               StoredCredentials storedCredentials,
    293294                                               ResourceError& error,
    294295                                               ResourceResponse& response,
    295                                                Vector<char>& data,
    296                                                Frame* deprecated)
     296                                               Vector<char>& data)
    297297{
    298298    OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader());
  • trunk/WebKit/gtk/ChangeLog

    r67275 r67291  
     12010-09-10  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add NetworkingContext to avoid layer violations
     6        https://bugs.webkit.org/show_bug.cgi?id=42292
     7
     8        * webkit/webkitdownload.cpp:
     9        (webkit_download_start):
     10        * webkit/webkitprivate.cpp:
     11        (currentToplevelCallback):
     12
    1132010-09-10  Sam Weinig  <sam@webkit.org>
    214
  • trunk/WebKit/gtk/webkit/webkitdownload.cpp

    r66024 r67291  
    486486    g_return_if_fail(priv->timer == NULL);
    487487
     488    // For GTK, when downloading a file NetworkingContext is null
    488489    if (!priv->resourceHandle)
    489         priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false);
     490        priv->resourceHandle = ResourceHandle::create(/* Null NetworkingContext */ NULL, core(priv->networkRequest), priv->downloadClient, false, false);
    490491    else {
    491492        priv->resourceHandle->setClient(priv->downloadClient);
  • trunk/WebKit/gtk/webkit/webkitprivate.cpp

    r65899 r67291  
    2828#include "FrameLoader.h"
    2929#include "FrameLoaderClientGtk.h"
     30#include "FrameNetworkingContextGtk.h"
    3031#include "GtkVersioning.h"
    3132#include "HTMLMediaElement.h"
     
    206207        return NULL;
    207208
    208     WebCore::Frame* frame = d->m_frame;
    209     if (!frame)
    210         return NULL;
    211 
    212     GtkWidget* toplevel =  gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient()));
     209    WebKit::FrameNetworkingContextGtk* context = static_cast<WebKit::FrameNetworkingContextGtk*>(d->m_context.get());
     210    if (!context)
     211        return NULL;
     212
     213    if (!context->coreFrame())
     214        return NULL;
     215
     216    GtkWidget* toplevel =  gtk_widget_get_toplevel(GTK_WIDGET(context->coreFrame()->page()->chrome()->platformPageClient()));
    213217    if (gtk_widget_is_toplevel(toplevel))
    214218        return toplevel;
  • trunk/WebKit/win/ChangeLog

    r67285 r67291  
     12010-09-10  Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add NetworkingContext to avoid layer violations
     6        https://bugs.webkit.org/show_bug.cgi?id=42292
     7
     8        * WebCoreSupport/WebFrameNetworkingContext.cpp:
     9        (WebFrameNetworkingContext::blockedError):
     10        * WebCoreSupport/WebFrameNetworkingContext.h:
     11
    1122010-09-10  Jer Noble  <jer.noble@apple.com>
    213
  • trunk/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp

    • Property svn:executable set to *
    r66794 r67291  
    3838    return frame()->loader()->referrer();
    3939}
     40
     41WebCore::ResourceError WebFrameNetworkingContext::blockedError(const WebCore::ResourceRequest& request) const
     42{
     43    return frame()->loader()->blockedError(request);
     44}
  • trunk/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h

    • Property svn:executable set to *
    r65579 r67291  
    2222
    2323#include <WebCore/FrameNetworkingContext.h>
     24#include <WebCore/ResourceError.h>
    2425
    2526class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
     
    3637    virtual WTF::String userAgent() const;
    3738    virtual WTF::String referrer() const;
     39    virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
    3840
    3941    WTF::String m_userAgent;
  • trunk/WebKit2/ChangeLog

    r67287 r67291  
     12010-09-10  Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add NetworkingContext to avoid layer violations
     6        https://bugs.webkit.org/show_bug.cgi?id=42292
     7
     8        * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp:
     9        * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h:
     10        (WebFrameNetworkingContext::create):
     11
    1122010-09-10  Sam Weinig  <sam@webkit.org>
    213
  • trunk/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h

    • Property svn:executable set to *
    r66794 r67291  
    2222
    2323#include <WebCore/FrameNetworkingContext.h>
     24#include <WebCore/ResourceError.h>
     25#include <WebCore/ResourceRequest.h>
    2426
    2527class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
    2628public:
    27     static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame*)
     29    static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame)
    2830    {
    29         return 0;
     31        return adoptRef(new WebFrameNetworkingContext(frame));
    3032    }
    3133
     
    3840    virtual WTF::String userAgent() const;
    3941    virtual WTF::String referrer() const;
     42    virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
    4043
    4144    WTF::String m_userAgent;
Note: See TracChangeset for help on using the changeset viewer.