[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
diegohcg at webkit.org
diegohcg at webkit.org
Wed Dec 22 13:20:00 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 993c6cf6d11d9af0a3dc12c9dcc971ec3123d93b
Author: diegohcg at webkit.org <diegohcg at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Sep 11 07:54:15 2010 +0000
Add NetworkingContext to avoid layer violations https://bugs.webkit.org/show_bug.cgi?id=42292
Patch by Jesus Sanchez-Palencia <jesus.palencia at 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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67291 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 55dd5a0..43a1eb5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,60 @@
+2010-09-10 Jesus Sanchez-Palencia <jesus.palencia at openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ 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):
+
2010-09-10 Jer Noble <jer.noble at apple.com>
No review; build fix only.
diff --git a/WebCore/loader/FrameLoader.cpp b/WebCore/loader/FrameLoader.cpp
index 2e3ae9d..4b33fa0 100644
--- a/WebCore/loader/FrameLoader.cpp
+++ b/WebCore/loader/FrameLoader.cpp
@@ -2765,7 +2765,7 @@ unsigned long FrameLoader::loadResourceSynchronously(const ResourceRequest& requ
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
if (!documentLoader()->applicationCacheHost()->maybeLoadSynchronously(newRequest, error, response, data)) {
#endif
- ResourceHandle::loadResourceSynchronously(newRequest, storedCredentials, error, response, data, m_frame);
+ ResourceHandle::loadResourceSynchronously(networkingContext(), newRequest, storedCredentials, error, response, data);
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
documentLoader()->applicationCacheHost()->maybeLoadFallbackSynchronously(newRequest, error, response, data);
}
diff --git a/WebCore/loader/FrameLoader.h b/WebCore/loader/FrameLoader.h
index 9e8733d..40f35bd 100644
--- a/WebCore/loader/FrameLoader.h
+++ b/WebCore/loader/FrameLoader.h
@@ -329,7 +329,7 @@ public:
bool pageDismissalEventBeingDispatched() const { return m_pageDismissalEventBeingDispatched; }
- inline NetworkingContext* networkingContext() const;
+ NetworkingContext* networkingContext() const;
private:
bool canCachePageContainingThisFrame();
diff --git a/WebCore/loader/MainResourceLoader.cpp b/WebCore/loader/MainResourceLoader.cpp
index 57ad950..6a821ca 100644
--- a/WebCore/loader/MainResourceLoader.cpp
+++ b/WebCore/loader/MainResourceLoader.cpp
@@ -538,7 +538,7 @@ bool MainResourceLoader::loadNow(ResourceRequest& r)
else if (shouldLoadEmpty || frameLoader()->representationExistsForURLScheme(url.protocol()))
handleEmptyLoad(url, !shouldLoadEmpty);
else
- m_handle = ResourceHandle::create(r, this, m_frame.get(), false, true);
+ m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), r, this, false, true);
return false;
}
diff --git a/WebCore/loader/PingLoader.cpp b/WebCore/loader/PingLoader.cpp
index 268e007..372cc82 100644
--- a/WebCore/loader/PingLoader.cpp
+++ b/WebCore/loader/PingLoader.cpp
@@ -62,7 +62,7 @@ void PingLoader::loadImage(Frame* frame, const KURL& url)
PingLoader::PingLoader(Frame* frame, const ResourceRequest& request)
{
- m_handle = ResourceHandle::create(request, this, frame, false, false);
+ m_handle = ResourceHandle::create(frame->loader()->networkingContext(), request, this, false, false);
}
PingLoader::~PingLoader()
diff --git a/WebCore/loader/ResourceLoader.cpp b/WebCore/loader/ResourceLoader.cpp
index 73dacd6..e1d331e 100644
--- a/WebCore/loader/ResourceLoader.cpp
+++ b/WebCore/loader/ResourceLoader.cpp
@@ -35,6 +35,7 @@
#include "FileStreamProxy.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "InspectorTimelineAgent.h"
#include "Page.h"
#include "ProgressTracker.h"
@@ -143,7 +144,7 @@ bool ResourceLoader::load(const ResourceRequest& r)
return true;
}
- m_handle = ResourceHandle::create(clientRequest, this, m_frame.get(), m_defersLoading, m_shouldContentSniff);
+ m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), clientRequest, this, m_defersLoading, m_shouldContentSniff);
return true;
}
diff --git a/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index 3ae8d9f..92723c4 100644
--- a/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -39,6 +39,7 @@
#include "DOMWindow.h"
#include "Frame.h"
#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
#include "MainResourceLoader.h"
#include "ManifestParser.h"
#include "Page.h"
@@ -479,7 +480,7 @@ PassRefPtr<ResourceHandle> ApplicationCacheGroup::createResourceHandle(const KUR
}
}
- RefPtr<ResourceHandle> handle = ResourceHandle::create(request, this, m_frame, false, true);
+ RefPtr<ResourceHandle> handle = ResourceHandle::create(m_frame->loader()->networkingContext(), request, this, false, true);
#if ENABLE(INSPECTOR)
// Because willSendRequest only gets called during redirects, we initialize
// the identifier and the first willSendRequest here.
diff --git a/WebCore/loader/icon/IconFetcher.cpp b/WebCore/loader/icon/IconFetcher.cpp
index 1107d7b..b33122a 100644
--- a/WebCore/loader/icon/IconFetcher.cpp
+++ b/WebCore/loader/icon/IconFetcher.cpp
@@ -27,6 +27,7 @@
#include "IconFetcher.h"
#include "Frame.h"
+#include "FrameLoaderClient.h"
#include "HTMLHeadElement.h"
#include "HTMLLinkElement.h"
#include "HTMLNames.h"
@@ -173,7 +174,7 @@ void IconFetcher::loadEntry()
ASSERT(m_currentEntry < m_entries.size());
ASSERT(!m_handle);
- m_handle = ResourceHandle::create(m_entries[m_currentEntry].url(), this, m_frame, false, false);
+ m_handle = ResourceHandle::create(m_frame->loader()->networkingContext(), m_entries[m_currentEntry].url(), this, false, false);
}
void IconFetcher::loadFailed()
diff --git a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
index bcd59c6..061fa85 100644
--- a/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
+++ b/WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp
@@ -23,6 +23,7 @@
#include "Document.h"
#include "GOwnPtr.h"
#include "GRefPtr.h"
+#include "NetworkingContext.h"
#include "Noncopyable.h"
#include "NotImplemented.h"
#include "ResourceHandleClient.h"
@@ -391,14 +392,17 @@ static bool webKitWebSrcStart(WebKitWebSrc* src)
request.setTargetType(ResourceRequestBase::TargetIsMedia);
request.setAllowCookies(true);
+ NetworkingContext* context = 0;
if (priv->frame) {
Document* document = priv->frame->document();
if (document)
request.setHTTPReferrer(document->documentURI());
FrameLoader* loader = priv->frame->loader();
- if (loader)
+ if (loader) {
loader->addExtraFieldsToSubresourceRequest(request);
+ context = loader->networkingContext();
+ }
}
// Let Apple web servers know we want to access their nice movie trailers.
@@ -419,7 +423,7 @@ static bool webKitWebSrcStart(WebKitWebSrc* src)
// Needed to use DLNA streaming servers
request.setHTTPHeaderField("transferMode.dlna", "Streaming");
- priv->resourceHandle = ResourceHandle::create(request, priv->client, 0, false, false);
+ priv->resourceHandle = ResourceHandle::create(context, request, priv->client, false, false);
if (!priv->resourceHandle) {
GST_ERROR_OBJECT(src, "Failed to create ResourceHandle");
return false;
diff --git a/WebCore/platform/network/NetworkingContext.h b/WebCore/platform/network/NetworkingContext.h
old mode 100644
new mode 100755
index 31f3025..a7d40dc
--- a/WebCore/platform/network/NetworkingContext.h
+++ b/WebCore/platform/network/NetworkingContext.h
@@ -57,6 +57,7 @@ public:
#if PLATFORM(WIN)
virtual String userAgent() const = 0;
virtual String referrer() const = 0;
+ virtual ResourceError blockedError(const ResourceRequest&) const = 0;
#endif
protected:
diff --git a/WebCore/platform/network/ResourceHandle.cpp b/WebCore/platform/network/ResourceHandle.cpp
index 2da1d77..9910ac1 100644
--- a/WebCore/platform/network/ResourceHandle.cpp
+++ b/WebCore/platform/network/ResourceHandle.cpp
@@ -52,8 +52,7 @@ ResourceHandle::ResourceHandle(const ResourceRequest& request, ResourceHandleCli
}
}
-PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request, ResourceHandleClient* client,
- Frame* frame, bool defersLoading, bool shouldContentSniff)
+PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context, const ResourceRequest& request, ResourceHandleClient* client, bool defersLoading, bool shouldContentSniff)
{
#if ENABLE(BLOB)
if (request.url().protocolIs("blob")) {
@@ -68,7 +67,7 @@ PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request
if (newHandle->d->m_scheduledFailureType != NoFailure)
return newHandle.release();
- if (newHandle->start(frame))
+ if (newHandle->start(context))
return newHandle.release();
return 0;
diff --git a/WebCore/platform/network/ResourceHandle.h b/WebCore/platform/network/ResourceHandle.h
index d52076c..17d1472 100644
--- a/WebCore/platform/network/ResourceHandle.h
+++ b/WebCore/platform/network/ResourceHandle.h
@@ -29,6 +29,7 @@
#include "AuthenticationChallenge.h"
#include "AuthenticationClient.h"
#include "HTTPHeaderMap.h"
+#include "NetworkingContext.h"
#include "ThreadableLoader.h"
#include <wtf/OwnPtr.h>
@@ -109,9 +110,8 @@ private:
};
public:
- // FIXME: should not need the Frame
- static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHandleClient*, Frame*, bool defersLoading, bool shouldContentSniff);
- static void loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data, Frame* frame);
+ static PassRefPtr<ResourceHandle> create(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
+ static void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
static void prepareForURL(const KURL&);
static bool willLoadFromCache(ResourceRequest&, Frame*);
@@ -212,7 +212,7 @@ private:
void scheduleFailure(FailureType);
- bool start(Frame*);
+ bool start(NetworkingContext*);
virtual void refAuthenticationClient() { ref(); }
virtual void derefAuthenticationClient() { deref(); }
diff --git a/WebCore/platform/network/ResourceHandleInternal.h b/WebCore/platform/network/ResourceHandleInternal.h
index 24b00bf..7b6db90 100644
--- a/WebCore/platform/network/ResourceHandleInternal.h
+++ b/WebCore/platform/network/ResourceHandleInternal.h
@@ -51,7 +51,6 @@ class Frame;
#endif
#if PLATFORM(QT)
-class QWebFrame;
class QWebNetworkJob;
namespace WebCore {
class QNetworkReplyHandler;
@@ -121,11 +120,9 @@ namespace WebCore {
, m_bufferSize(0)
, m_total(0)
, m_idleHandler(0)
- , m_frame(0)
#endif
#if PLATFORM(QT)
, m_job(0)
- , m_frame(0)
#endif
#if PLATFORM(MAC)
, m_startWhenScheduled(false)
@@ -202,11 +199,11 @@ namespace WebCore {
char* m_buffer;
gsize m_bufferSize, m_total;
guint m_idleHandler;
- Frame* m_frame;
+ RefPtr<NetworkingContext> m_context;
#endif
#if PLATFORM(QT)
QNetworkReplyHandler* m_job;
- QWebFrame* m_frame;
+ RefPtr<NetworkingContext> m_context;
#endif
#if PLATFORM(MAC)
diff --git a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
old mode 100644
new mode 100755
index 209906e..763551f
--- a/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
+++ b/WebCore/platform/network/cf/ResourceHandleCFNet.cpp
@@ -432,11 +432,14 @@ void ResourceHandle::createCFURLConnection(bool shouldUseCredentialStorage, bool
d->m_connection.adoptCF(CFURLConnectionCreateWithProperties(0, request.get(), reinterpret_cast<CFURLConnectionClient*>(&client), connectionProperties.get()));
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
- // If we are no longer attached to a Page, this must be an attempted load from an
- // onUnload handler, so let's just block it.
- if (!frame->page())
+ if (!context)
+ return false;
+
+ // If NetworkingContext is invalid then we are no longer attached to a Page,
+ // this must be an attempted load from an unload handler, so let's just block it.
+ if (!context->isValid())
return false;
bool shouldUseCredentialStorage = !client() || client()->shouldUseCredentialStorage(this);
@@ -615,7 +618,7 @@ CFURLConnectionRef ResourceHandle::releaseConnectionForDownload()
return d->m_connection.releaseRef();
}
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector, Frame* frame)
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& vector)
{
LOG(Network, "ResourceHandle::loadResourceSynchronously:%s allowStoredCredentials:%u", request.url().string().utf8().data(), storedCredentials);
@@ -629,8 +632,8 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
- if (handle->d->m_scheduledFailureType != NoFailure) {
- error = frame->loader()->blockedError(request);
+ if (context && handle->d->m_scheduledFailureType != NoFailure) {
+ error = context->blockedError(request);
return;
}
diff --git a/WebCore/platform/network/curl/ResourceHandleCurl.cpp b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
index 096905d..8a322b4 100644
--- a/WebCore/platform/network/curl/ResourceHandleCurl.cpp
+++ b/WebCore/platform/network/curl/ResourceHandleCurl.cpp
@@ -103,13 +103,14 @@ ResourceHandle::~ResourceHandle()
cancel();
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
// The frame could be null if the ResourceHandle is not associated to any
// Frame, e.g. if we are downloading a file.
// If the frame is not null but the page is null this must be an attempted
- // load from an onUnload handler, so let's just block it.
- if (frame && !frame->page())
+ // load from an unload handler, so let's just block it.
+ // If both the frame and the page are not null the context is valid.
+ if (context && !context->isValid())
return false;
ResourceHandleManager::sharedInstance()->add(this);
@@ -187,7 +188,7 @@ bool ResourceHandle::loadsBlocked()
return false;
}
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame*)
+void ResourceHandle::loadResourceSynchronously(NetworkingContext*, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
WebCoreSynchronousLoader syncLoader;
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
diff --git a/WebCore/platform/network/mac/ResourceHandleMac.mm b/WebCore/platform/network/mac/ResourceHandleMac.mm
index 0af86d0..6db9350 100644
--- a/WebCore/platform/network/mac/ResourceHandleMac.mm
+++ b/WebCore/platform/network/mac/ResourceHandleMac.mm
@@ -260,17 +260,16 @@ void ResourceHandle::createNSURLConnection(id delegate, bool shouldUseCredential
#endif
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
- if (!frame)
+ if (!context)
return false;
BEGIN_BLOCK_OBJC_EXCEPTIONS;
- // If we are no longer attached to a Page, this must be an attempted load from an
- // onUnload handler, so let's just block it.
- Page* page = frame->page();
- if (!page)
+ // If NetworkingContext is invalid then we are no longer attached to a Page,
+ // this must be an attempted load from an unload event handler, so let's just block it.
+ if (!context->isValid())
return false;
#ifndef NDEBUG
@@ -293,16 +292,16 @@ bool ResourceHandle::start(Frame* frame)
firstRequest().setCachePolicy(ReloadIgnoringCacheData);
#endif
- d->m_needsSiteSpecificQuirks = frame->settings() && frame->settings()->needsSiteSpecificQuirks();
+ d->m_needsSiteSpecificQuirks = context->needsSiteSpecificQuirks();
createNSURLConnection(
d->m_proxy.get(),
shouldUseCredentialStorage,
- d->m_shouldContentSniff || frame->settings()->localFileContentSniffingEnabled());
+ d->m_shouldContentSniff || context->localFileContentSniffingEnabled());
#ifndef BUILDING_ON_TIGER
bool scheduled = false;
- if (SchedulePairHashSet* scheduledPairs = page->scheduledRunLoopPairs()) {
+ if (SchedulePairHashSet* scheduledPairs = context->scheduledRunLoopPairs()) {
SchedulePairHashSet::iterator end = scheduledPairs->end();
for (SchedulePairHashSet::iterator it = scheduledPairs->begin(); it != end; ++it) {
if (NSRunLoop *runLoop = (*it)->nsRunLoop()) {
@@ -461,7 +460,7 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame*)
#endif
}
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
LOG(Network, "ResourceHandle::loadResourceSynchronously:%@ allowStoredCredentials:%u", request.nsURLRequest(), storedCredentials);
@@ -483,15 +482,15 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, client.get(), false /*defersLoading*/, true /*shouldContentSniff*/));
- if (handle->d->m_scheduledFailureType != NoFailure) {
- error = frame->loader()->blockedError(request);
+ if (context && handle->d->m_scheduledFailureType != NoFailure) {
+ error = context->blockedError(request);
return;
}
handle->createNSURLConnection(
handle->delegate(), // A synchronous request cannot turn into a download, so there is no need to proxy the delegate.
storedCredentials == AllowStoredCredentials,
- handle->shouldContentSniff() || frame->settings()->localFileContentSniffingEnabled());
+ handle->shouldContentSniff() || (context && context->localFileContentSniffingEnabled()));
[handle->connection() scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:WebCoreSynchronousLoaderRunLoopMode];
[handle->connection() start];
@@ -507,7 +506,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
#else
UNUSED_PARAM(storedCredentials);
- UNUSED_PARAM(frame);
+ UNUSED_PARAM(context);
NSURLRequest *firstRequest = request.nsURLRequest();
// If a URL already has cookies, then we'll relax the 3rd party cookie policy and accept new cookies.
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index 915dc9a..349a27f 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -171,7 +171,11 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load
else
m_method = QNetworkAccessManager::UnknownOperation;
- m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
+ QObject* originatingObject = 0;
+ if (m_resourceHandle->getInternal()->m_context)
+ originatingObject = m_resourceHandle->getInternal()->m_context->originatingObject();
+
+ m_request = r.toNetworkRequest(originatingObject);
if (m_loadMode == LoadNormal)
start();
@@ -374,7 +378,11 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
if (!m_resourceHandle) // network error did cancel the request
return;
- m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
+ QObject* originatingObject = 0;
+ if (m_resourceHandle->getInternal()->m_context)
+ originatingObject = m_resourceHandle->getInternal()->m_context->originatingObject();
+
+ m_request = newRequest.toNetworkRequest(originatingObject);
return;
}
@@ -426,7 +434,12 @@ void QNetworkReplyHandler::start()
ResourceHandleInternal* d = m_resourceHandle->getInternal();
- QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager();
+ QNetworkAccessManager* manager = 0;
+ if (d->m_context)
+ manager = d->m_context->networkAccessManager();
+
+ if (!manager)
+ return;
const QUrl url = m_request.url();
const QString scheme = url.scheme();
diff --git a/WebCore/platform/network/qt/ResourceHandleQt.cpp b/WebCore/platform/network/qt/ResourceHandleQt.cpp
index 3548467..8a24d0f 100644
--- a/WebCore/platform/network/qt/ResourceHandleQt.cpp
+++ b/WebCore/platform/network/qt/ResourceHandleQt.cpp
@@ -33,6 +33,7 @@
#include "ChromeClientQt.h"
#include "CachedResourceLoader.h"
#include "Frame.h"
+#include "FrameNetworkingContext.h"
#include "FrameLoaderClientQt.h"
#include "NotImplemented.h"
#include "Page.h"
@@ -115,15 +116,11 @@ ResourceHandle::~ResourceHandle()
cancel();
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
- if (!frame)
- return false;
-
- Page *page = frame->page();
- // If we are no longer attached to a Page, this must be an attempted load from an
- // onUnload handler, so let's just block it.
- if (!page)
+ // If NetworkingContext is invalid then we are no longer attached to a Page,
+ // this must be an attempted load from an unload event handler, so let's just block it.
+ if (context && !context->isValid())
return false;
if (!(d->m_user.isEmpty() || d->m_pass.isEmpty())) {
@@ -135,7 +132,7 @@ bool ResourceHandle::start(Frame* frame)
d->m_firstRequest.setURL(urlWithCredentials);
}
- getInternal()->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
+ getInternal()->m_context = context;
ResourceHandleInternal *d = getInternal();
d->m_job = new QNetworkReplyHandler(this, QNetworkReplyHandler::LoadMode(d->m_defersLoading));
return true;
@@ -159,8 +156,12 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest& request, Frame* frame)
if (!frame)
return false;
- QNetworkAccessManager* manager = QWebFramePrivate::kit(frame)->page()->networkAccessManager();
- QAbstractNetworkCache* cache = manager->cache();
+ QNetworkAccessManager* manager = 0;
+ QAbstractNetworkCache* cache = 0;
+ if (frame->loader()->networkingContext()) {
+ manager = frame->loader()->networkingContext()->networkAccessManager();
+ cache = manager->cache();
+ }
if (!cache)
return false;
@@ -185,7 +186,7 @@ PassRefPtr<SharedBuffer> ResourceHandle::bufferedData()
return 0;
}
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
WebCoreSynchronousLoader syncLoader;
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
@@ -199,7 +200,7 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
urlWithCredentials.setPass(d->m_pass);
d->m_firstRequest.setURL(urlWithCredentials);
}
- d->m_frame = static_cast<FrameLoaderClientQt*>(frame->loader()->client())->webFrame();
+ d->m_context = context;
d->m_job = new QNetworkReplyHandler(handle.get(), QNetworkReplyHandler::LoadNormal);
syncLoader.waitForCompletion();
@@ -208,7 +209,6 @@ void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, S
response = syncLoader.resourceResponse();
}
-
void ResourceHandle::platformSetDefersLoading(bool defers)
{
if (d->m_job)
diff --git a/WebCore/platform/network/soup/ResourceHandleSoup.cpp b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
index dadbd22..1246c22 100644
--- a/WebCore/platform/network/soup/ResourceHandleSoup.cpp
+++ b/WebCore/platform/network/soup/ResourceHandleSoup.cpp
@@ -578,16 +578,16 @@ static bool startHttp(ResourceHandle* handle)
return true;
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
ASSERT(!d->m_msg);
-
// The frame could be null if the ResourceHandle is not associated to any
// Frame, e.g. if we are downloading a file.
// If the frame is not null but the page is null this must be an attempted
- // load from an onUnload handler, so let's just block it.
- if (frame && !frame->page())
+ // load from an unload handler, so let's just block it.
+ // If both the frame and the page are not null the context is valid.
+ if (context && !context->isValid())
return false;
KURL url = firstRequest().url();
@@ -595,7 +595,7 @@ bool ResourceHandle::start(Frame* frame)
String protocol = url.protocol();
// Used to set the authentication dialog toplevel; may be NULL
- d->m_frame = frame;
+ d->m_context = context;
if (equalIgnoringCase(protocol, "data"))
return startData(this, urlString);
@@ -655,14 +655,14 @@ bool ResourceHandle::willLoadFromCache(ResourceRequest&, Frame*)
return false;
}
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data, Frame* frame)
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials /*storedCredentials*/, ResourceError& error, ResourceResponse& response, Vector<char>& data)
{
WebCoreSynchronousLoader syncLoader(error, response, data);
// FIXME: we should use the ResourceHandle::create method here,
// but it makes us timeout in a couple of tests. See
// https://bugs.webkit.org/show_bug.cgi?id=41823
RefPtr<ResourceHandle> handle = adoptRef(new ResourceHandle(request, &syncLoader, true, false));
- handle->start(frame);
+ handle->start(context);
syncLoader.run();
}
diff --git a/WebCore/platform/network/win/ResourceHandleWin.cpp b/WebCore/platform/network/win/ResourceHandleWin.cpp
index 2af03c0..600f8ca 100644
--- a/WebCore/platform/network/win/ResourceHandleWin.cpp
+++ b/WebCore/platform/network/win/ResourceHandleWin.cpp
@@ -406,7 +406,7 @@ static void __stdcall transferJobStatusCallback(HINTERNET internetHandle,
PostMessage(transferJobWindowHandle, msg, (WPARAM) jobId, lParam);
}
-bool ResourceHandle::start(Frame* frame)
+bool ResourceHandle::start(NetworkingContext* context)
{
ref();
if (request().url().isLocalFile()) {
@@ -415,7 +415,7 @@ bool ResourceHandle::start(Frame* frame)
} else {
static HINTERNET internetHandle = 0;
if (!internetHandle) {
- String userAgentStr = frame->loader()->userAgent(request().url()) + String("", 1);
+ String userAgentStr = context->userAgent() + String("", 1);
LPCWSTR userAgent = reinterpret_cast<const WCHAR*>(userAgentStr.characters());
// leak the Internet for now
internetHandle = InternetOpen(userAgent, INTERNET_OPEN_TYPE_PRECONFIG, 0, 0, INTERNET_FLAG_ASYNC);
@@ -438,7 +438,7 @@ bool ResourceHandle::start(Frame* frame)
// For form posting, we can't use InternetOpenURL. We have to use
// InternetConnect followed by HttpSendRequest.
HINTERNET urlHandle;
- String referrer = frame->loader()->referrer();
+ String referrer = context->referrer();
if (request().httpMethod() == "POST") {
d->m_postReferrer = referrer;
String host = request().url().host();
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 5c302af..473c112 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-10 Jesus Sanchez-Palencia <jesus.palencia at openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ * src/ResourceHandle.cpp:
+ (WebCore::ResourceHandle::create):
+ (WebCore::ResourceHandle::start):
+ (WebCore::ResourceHandle::loadResourceSynchronously):
+
2010-09-10 Sam Weinig <sam at webkit.org>
Fix chromium build.
diff --git a/WebKit/chromium/src/ResourceHandle.cpp b/WebKit/chromium/src/ResourceHandle.cpp
index 88f7f39..27bfe7f 100644
--- a/WebKit/chromium/src/ResourceHandle.cpp
+++ b/WebKit/chromium/src/ResourceHandle.cpp
@@ -211,16 +211,16 @@ ResourceHandle::ResourceHandle(const ResourceRequest& request,
// FIXME: Figure out what to do with the bool params.
}
-PassRefPtr<ResourceHandle> ResourceHandle::create(const ResourceRequest& request,
+PassRefPtr<ResourceHandle> ResourceHandle::create(NetworkingContext* context,
+ const ResourceRequest& request,
ResourceHandleClient* client,
- Frame* deprecated,
bool defersLoading,
bool shouldContentSniff)
{
RefPtr<ResourceHandle> newHandle = adoptRef(new ResourceHandle(
request, client, defersLoading, shouldContentSniff));
- if (newHandle->start(deprecated))
+ if (newHandle->start(context))
return newHandle.release();
return 0;
@@ -246,7 +246,7 @@ void ResourceHandle::setDefersLoading(bool value)
d->setDefersLoading(value);
}
-bool ResourceHandle::start(Frame* deprecated)
+bool ResourceHandle::start(NetworkingContext* context)
{
d->start();
return true;
@@ -288,12 +288,12 @@ bool ResourceHandle::supportsBufferedData()
}
// static
-void ResourceHandle::loadResourceSynchronously(const ResourceRequest& request,
+void ResourceHandle::loadResourceSynchronously(NetworkingContext* context,
+ const ResourceRequest& request,
StoredCredentials storedCredentials,
ResourceError& error,
ResourceResponse& response,
- Vector<char>& data,
- Frame* deprecated)
+ Vector<char>& data)
{
OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader());
ASSERT(loader.get());
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 014f1ed..1f14d42 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,15 @@
+2010-09-10 Jesus Sanchez-Palencia <jesus.palencia at openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ * webkit/webkitdownload.cpp:
+ (webkit_download_start):
+ * webkit/webkitprivate.cpp:
+ (currentToplevelCallback):
+
2010-09-10 Sam Weinig <sam at webkit.org>
Fix GTK build.
diff --git a/WebKit/gtk/webkit/webkitdownload.cpp b/WebKit/gtk/webkit/webkitdownload.cpp
index 9bcb739..20cac2b 100644
--- a/WebKit/gtk/webkit/webkitdownload.cpp
+++ b/WebKit/gtk/webkit/webkitdownload.cpp
@@ -485,8 +485,9 @@ void webkit_download_start(WebKitDownload* download)
g_return_if_fail(priv->status == WEBKIT_DOWNLOAD_STATUS_CREATED);
g_return_if_fail(priv->timer == NULL);
+ // For GTK, when downloading a file NetworkingContext is null
if (!priv->resourceHandle)
- priv->resourceHandle = ResourceHandle::create(core(priv->networkRequest), priv->downloadClient, 0, false, false);
+ priv->resourceHandle = ResourceHandle::create(/* Null NetworkingContext */ NULL, core(priv->networkRequest), priv->downloadClient, false, false);
else {
priv->resourceHandle->setClient(priv->downloadClient);
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index 1b7f7a3..aa3d3da 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -27,6 +27,7 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameLoaderClientGtk.h"
+#include "FrameNetworkingContextGtk.h"
#include "GtkVersioning.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
@@ -205,11 +206,14 @@ static GtkWidget* currentToplevelCallback(WebKitSoupAuthDialog* feature, SoupMes
if (!d)
return NULL;
- WebCore::Frame* frame = d->m_frame;
- if (!frame)
+ WebKit::FrameNetworkingContextGtk* context = static_cast<WebKit::FrameNetworkingContextGtk*>(d->m_context.get());
+ if (!context)
+ return NULL;
+
+ if (!context->coreFrame())
return NULL;
- GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(frame->page()->chrome()->platformPageClient()));
+ GtkWidget* toplevel = gtk_widget_get_toplevel(GTK_WIDGET(context->coreFrame()->page()->chrome()->platformPageClient()));
if (gtk_widget_is_toplevel(toplevel))
return toplevel;
else
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 4b974f7..b6fcbcf 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-10 Jesus Sanchez-Palencia <jesus.palencia at openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ * WebCoreSupport/WebFrameNetworkingContext.cpp:
+ (WebFrameNetworkingContext::blockedError):
+ * WebCoreSupport/WebFrameNetworkingContext.h:
+
2010-09-10 Jer Noble <jer.noble at apple.com>
Reviewed by Simon Fraser.
diff --git a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
old mode 100644
new mode 100755
index 9fcd4b1..b87b6d9
--- a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
+++ b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
@@ -37,3 +37,8 @@ String WebFrameNetworkingContext::referrer() const
{
return frame()->loader()->referrer();
}
+
+WebCore::ResourceError WebFrameNetworkingContext::blockedError(const WebCore::ResourceRequest& request) const
+{
+ return frame()->loader()->blockedError(request);
+}
diff --git a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h
old mode 100644
new mode 100755
index 7fd55d5..a237c9a
--- a/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h
+++ b/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.h
@@ -21,6 +21,7 @@
#define WebFrameNetworkingContext_h
#include <WebCore/FrameNetworkingContext.h>
+#include <WebCore/ResourceError.h>
class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
public:
@@ -35,6 +36,7 @@ private:
virtual WTF::String userAgent() const;
virtual WTF::String referrer() const;
+ virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
WTF::String m_userAgent;
};
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index d08eec9..d70976b 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,14 @@
+2010-09-10 Jesus Sanchez-Palencia <jesus.palencia at openbossa.org>
+
+ Reviewed by Darin Adler.
+
+ Add NetworkingContext to avoid layer violations
+ https://bugs.webkit.org/show_bug.cgi?id=42292
+
+ * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.cpp:
+ * WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h:
+ (WebFrameNetworkingContext::create):
+
2010-09-10 Sam Weinig <sam at webkit.org>
Reviewed by Dan Bernstein.
diff --git a/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h b/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h
old mode 100644
new mode 100755
index 3d87292..016dcce
--- a/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h
+++ b/WebKit2/WebProcess/WebCoreSupport/win/WebFrameNetworkingContext.h
@@ -21,12 +21,14 @@
#define WebFrameNetworkingContext_h
#include <WebCore/FrameNetworkingContext.h>
+#include <WebCore/ResourceError.h>
+#include <WebCore/ResourceRequest.h>
class WebFrameNetworkingContext : public WebCore::FrameNetworkingContext {
public:
- static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame*)
+ static PassRefPtr<WebFrameNetworkingContext> create(WebCore::Frame* frame)
{
- return 0;
+ return adoptRef(new WebFrameNetworkingContext(frame));
}
private:
@@ -37,6 +39,7 @@ private:
virtual WTF::String userAgent() const;
virtual WTF::String referrer() const;
+ virtual WebCore::ResourceError blockedError(const WebCore::ResourceRequest&) const;
WTF::String m_userAgent;
};
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list