[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

hausmann at webkit.org hausmann at webkit.org
Wed Apr 7 23:19:36 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 53ee4c0fd34ff864a24be9eb1ee8adf4acfa82cd
Author: hausmann at webkit.org <hausmann at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 3 14:50:55 2009 +0000

    WebCore: Extended the conversion of the WebCore ResourceRequest to the
    QNetworkRequest with a mandatory originating object argument,
    which is meant to be the QWebFrame the request belongs to.
    
    Patch by Simon Hausmann <hausmann at webkit.org> on 2009-11-03
    Reviewed by Tor Arne Vestbø.
    
    https://bugs.webkit.org/show_bug.cgi?id=29975
    
    * platform/network/qt/QNetworkReplyHandler.cpp:
    (WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
    (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
    (WebCore::QNetworkReplyHandler::start):
    * platform/network/qt/ResourceRequest.h:
    * platform/network/qt/ResourceRequestQt.cpp:
    (WebCore::ResourceRequest::toNetworkRequest):
    
    WebKit/qt: Replace the QWebPage::networkRequestStarted() signal with the originatingObject
    property set to the QWebFrame that belongs to the request.
    
    Patch by Simon Hausmann <hausmann at webkit.org> on 2009-11-03
    Reviewed by Tor Arne Vestbø.
    
    https://bugs.webkit.org/show_bug.cgi?id=29975
    
    * Api/qwebpage.h:
    * WebCoreSupport/FrameLoaderClientQt.cpp:
    (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
    (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
    (WebCore::FrameLoaderClientQt::startDownload):
    * tests/qwebpage/tst_qwebpage.cpp:
    (tst_QWebPage::loadFinished):
    (TestNetworkManager::createRequest):
    (tst_QWebPage::originatingObjectInNetworkRequests):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50454 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 758c699..6d1e0fa 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-03  Simon Hausmann  <hausmann at webkit.org>
+
+        Reviewed by Tor Arne Vestbø.
+
+        Extended the conversion of the WebCore ResourceRequest to the
+        QNetworkRequest with a mandatory originating object argument,
+        which is meant to be the QWebFrame the request belongs to.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29975
+
+        * platform/network/qt/QNetworkReplyHandler.cpp:
+        (WebCore::QNetworkReplyHandler::QNetworkReplyHandler):
+        (WebCore::QNetworkReplyHandler::sendResponseIfNeeded):
+        (WebCore::QNetworkReplyHandler::start):
+        * platform/network/qt/ResourceRequest.h:
+        * platform/network/qt/ResourceRequestQt.cpp:
+        (WebCore::ResourceRequest::toNetworkRequest):
+
 2009-11-03  Keishi Hattori  <casey.hattori at gmail.com>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
index d9653f1..bbf5525 100644
--- a/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
+++ b/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
@@ -147,7 +147,7 @@ QNetworkReplyHandler::QNetworkReplyHandler(ResourceHandle* handle, LoadMode load
     else
         m_method = QNetworkAccessManager::UnknownOperation;
 
-    m_request = r.toNetworkRequest();
+    m_request = r.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
 
     if (m_loadMode == LoadNormal)
         start();
@@ -327,10 +327,7 @@ void QNetworkReplyHandler::sendResponseIfNeeded()
 
         client->willSendRequest(m_resourceHandle, newRequest, response);
         m_redirected = true;
-        m_request = newRequest.toNetworkRequest();
-
-        ResourceHandleInternal* d = m_resourceHandle->getInternal();
-        emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request);
+        m_request = newRequest.toNetworkRequest(m_resourceHandle->getInternal()->m_frame);
         return;
     }
 
@@ -372,8 +369,6 @@ void QNetworkReplyHandler::start()
 
     QNetworkAccessManager* manager = d->m_frame->page()->networkAccessManager();
 
-    emit d->m_frame->page()->networkRequestStarted(d->m_frame, &m_request);
-
     const QUrl url = m_request.url();
     const QString scheme = url.scheme();
     // Post requests on files and data don't really make sense, but for
diff --git a/WebCore/platform/network/qt/ResourceRequest.h b/WebCore/platform/network/qt/ResourceRequest.h
index 93dacf3..60d32dd 100644
--- a/WebCore/platform/network/qt/ResourceRequest.h
+++ b/WebCore/platform/network/qt/ResourceRequest.h
@@ -31,6 +31,7 @@
 
 QT_BEGIN_NAMESPACE
 class QNetworkRequest;
+class QObject;
 QT_END_NAMESPACE
 
 namespace WebCore {
@@ -59,7 +60,7 @@ namespace WebCore {
         }
 
 #if QT_VERSION >= 0x040400
-        QNetworkRequest toNetworkRequest() const;
+        QNetworkRequest toNetworkRequest(QObject* originatingObject) const;
 #endif
 
     private:
diff --git a/WebCore/platform/network/qt/ResourceRequestQt.cpp b/WebCore/platform/network/qt/ResourceRequestQt.cpp
index c8f6ad5..c866a54 100644
--- a/WebCore/platform/network/qt/ResourceRequestQt.cpp
+++ b/WebCore/platform/network/qt/ResourceRequestQt.cpp
@@ -28,10 +28,13 @@
 
 namespace WebCore {
 
-QNetworkRequest ResourceRequest::toNetworkRequest() const
+QNetworkRequest ResourceRequest::toNetworkRequest(QObject* originatingFrame) const
 {
     QNetworkRequest request;
     request.setUrl(url());
+#if QT_VERSION >= QT_VERSION_CHECK(4, 6, 0)
+    request.setOriginatingObject(originatingFrame);
+#endif
 
     const HTTPHeaderMap &headers = httpHeaderFields();
     for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end();
diff --git a/WebKit/qt/Api/qwebpage.h b/WebKit/qt/Api/qwebpage.h
index f2bbde0..f39209c 100644
--- a/WebKit/qt/Api/qwebpage.h
+++ b/WebKit/qt/Api/qwebpage.h
@@ -347,8 +347,6 @@ Q_SIGNALS:
     void saveFrameStateRequested(QWebFrame* frame, QWebHistoryItem* item);
     void restoreFrameStateRequested(QWebFrame* frame);
 
-    void networkRequestStarted(QWebFrame* frame, QNetworkRequest* request);
-
 protected:
     virtual QWebPage *createWindow(WebWindowType type);
     virtual QObject *createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues);
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index ad17287..b64465e 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,22 @@
+2009-11-03  Simon Hausmann  <hausmann at webkit.org>
+
+        Reviewed by Tor Arne Vestbø.
+
+        Replace the QWebPage::networkRequestStarted() signal with the originatingObject
+        property set to the QWebFrame that belongs to the request.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29975
+
+        * Api/qwebpage.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction):
+        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction):
+        (WebCore::FrameLoaderClientQt::startDownload):
+        * tests/qwebpage/tst_qwebpage.cpp:
+        (tst_QWebPage::loadFinished):
+        (TestNetworkManager::createRequest):
+        (tst_QWebPage::originatingObjectInNetworkRequests):
+
 2009-11-02  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 03b1183..278dba9 100644
--- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -946,7 +946,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNewWindowAction(FramePolicyFunc
 #if QT_VERSION < 0x040400
     QWebNetworkRequest r(request);
 #else
-    QNetworkRequest r(request.toNetworkRequest());
+    QNetworkRequest r(request.toNetworkRequest(m_webFrame));
 #endif
     QWebPage* page = m_webFrame->page();
 
@@ -971,7 +971,7 @@ void FrameLoaderClientQt::dispatchDecidePolicyForNavigationAction(FramePolicyFun
 #if QT_VERSION < 0x040400
     QWebNetworkRequest r(request);
 #else
-    QNetworkRequest r(request.toNetworkRequest());
+    QNetworkRequest r(request.toNetworkRequest(m_webFrame));
 #endif
     QWebPage*page = m_webFrame->page();
 
@@ -1001,7 +1001,7 @@ void FrameLoaderClientQt::startDownload(const WebCore::ResourceRequest& request)
     if (!m_webFrame)
         return;
 
-    emit m_webFrame->page()->downloadRequested(request.toNetworkRequest());
+    emit m_webFrame->page()->downloadRequested(request.toNetworkRequest(m_webFrame));
 #endif
 }
 
diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 0cf85ee..bdc6e8e 100644
--- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -129,6 +129,8 @@ private slots:
     void screenshot_data();
     void screenshot();
 
+    void originatingObjectInNetworkRequests();
+
 private:
     QWebView* m_view;
     QWebPage* m_page;
@@ -234,7 +236,6 @@ void tst_QWebPage::loadFinished()
 {
     qRegisterMetaType<QWebFrame*>("QWebFrame*");
     qRegisterMetaType<QNetworkRequest*>("QNetworkRequest*");
-    QSignalSpy spyNetworkRequestStarted(m_page, SIGNAL(networkRequestStarted(QWebFrame*, QNetworkRequest*)));
     QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted()));
     QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
 
@@ -245,7 +246,6 @@ void tst_QWebPage::loadFinished()
 
     QTest::qWait(3000);
 
-    QVERIFY(spyNetworkRequestStarted.count() > 1);
     QVERIFY(spyLoadStarted.count() > 1);
     QVERIFY(spyLoadFinished.count() > 1);
 
@@ -346,9 +346,11 @@ public:
     TestNetworkManager(QObject* parent) : QNetworkAccessManager(parent) {}
 
     QList<QUrl> requestedUrls;
+    QList<QNetworkRequest> requests;
 
 protected:
     virtual QNetworkReply* createRequest(Operation op, const QNetworkRequest &request, QIODevice* outgoingData) {
+        requests.append(request);
         requestedUrls.append(request.url());
         return QNetworkAccessManager::createRequest(op, request, outgoingData);
     }
@@ -1609,5 +1611,25 @@ void tst_QWebPage::screenshot()
     QDir::setCurrent(QApplication::applicationDirPath());
 }
 
+void tst_QWebPage::originatingObjectInNetworkRequests()
+{
+    TestNetworkManager* networkManager = new TestNetworkManager(m_page);
+    m_page->setNetworkAccessManager(networkManager);
+    networkManager->requests.clear();
+
+    m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html,"
+                            "<head><meta http-equiv='refresh' content='1'></head>foo \">"
+                            "<frame src=\"data:text/html,bar\"></frameset>"), QUrl());
+    QVERIFY(::waitForSignal(m_view, SIGNAL(loadFinished(bool))));
+
+    QCOMPARE(networkManager->requests.count(), 2);
+
+    QList<QWebFrame*> childFrames = m_page->mainFrame()->childFrames();
+    QCOMPARE(childFrames.count(), 2);
+
+    for (int i = 0; i < 2; ++i)
+        QVERIFY(qobject_cast<QWebFrame*>(networkManager->requests.at(i).originatingObject()) == childFrames.at(i));
+}
+
 QTEST_MAIN(tst_QWebPage)
 #include "tst_qwebpage.moc"

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list