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

eric at webkit.org eric at webkit.org
Wed Apr 7 23:18:21 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit bc2910908014d3ea0c7650e3609fe73d106a6042
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Nov 2 18:09:19 2009 +0000

    2009-11-02  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
    
            Reviewed by Adam Barth.
    
            QWebView crash fix.
    
            The QWebView should not crash if the stop() method is called from
            a function triggered by the loadProgress signal.
    
            A null pointer protection was added in the ProgressTracker::incrementProgress.
    
            New autotest was created.
    
            https://bugs.webkit.org/show_bug.cgi?id=29425
    
            * loader/ProgressTracker.cpp:
            (WebCore::ProgressTracker::incrementProgress):
    2009-11-02  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
    
            Reviewed by Adam Barth.
    
            QWebView crash fix.
    
            The QWebView should not crash if the stop() method is called from
            a function triggered by the loadProgress signal.
    
            A null pointer protection was added in the ProgressTracker::incrementProgress.
    
            New autotest was created.
    
            https://bugs.webkit.org/show_bug.cgi?id=29425
    
            * tests/qwebview/tst_qwebview.cpp:
            (WebViewCrashTest::WebViewCrashTest):
            (WebViewCrashTest::loading):
            (tst_QWebView::crashTests):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50415 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 36a6641..9587db0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2009-11-02  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
+
+        Reviewed by Adam Barth.
+
+        QWebView crash fix.
+
+        The QWebView should not crash if the stop() method is called from
+        a function triggered by the loadProgress signal.
+
+        A null pointer protection was added in the ProgressTracker::incrementProgress.
+
+        New autotest was created.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29425
+
+        * loader/ProgressTracker.cpp:
+        (WebCore::ProgressTracker::incrementProgress):
+
 2009-11-02  Mikhail Naganov  <mnaganov at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/loader/ProgressTracker.cpp b/WebCore/loader/ProgressTracker.cpp
index e682b9b..6b6ce1b 100644
--- a/WebCore/loader/ProgressTracker.cpp
+++ b/WebCore/loader/ProgressTracker.cpp
@@ -176,8 +176,10 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
     // FIXME: Can this ever happen?
     if (!item)
         return;
+
+    RefPtr<Frame> frame = m_originatingProgressFrame;
     
-    m_originatingProgressFrame->loader()->client()->willChangeEstimatedProgress();
+    frame->loader()->client()->willChangeEstimatedProgress();
     
     unsigned bytesReceived = length;
     double increment, percentOfRemainingBytes;
@@ -189,7 +191,7 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
         item->estimatedLength = item->bytesReceived * 2;
     }
     
-    int numPendingOrLoadingRequests = m_originatingProgressFrame->loader()->numPendingOrLoadingRequests(true);
+    int numPendingOrLoadingRequests = frame->loader()->numPendingOrLoadingRequests(true);
     estimatedBytesForPendingRequests = progressItemDefaultEstimatedLength * numPendingOrLoadingRequests;
     remainingBytes = ((m_totalPageAndResourceBytesToLoad + estimatedBytesForPendingRequests) - m_totalBytesReceived);
     if (remainingBytes > 0)  // Prevent divide by 0.
@@ -199,8 +201,8 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
     
     // For documents that use WebCore's layout system, treat first layout as the half-way point.
     // FIXME: The hasHTMLView function is a sort of roundabout way of asking "do you use WebCore's layout system".
-    bool useClampedMaxProgress = m_originatingProgressFrame->loader()->client()->hasHTMLView()
-        && !m_originatingProgressFrame->loader()->firstLayoutDone();
+    bool useClampedMaxProgress = frame->loader()->client()->hasHTMLView()
+        && !frame->loader()->firstLayoutDone();
     double maxProgressValue = useClampedMaxProgress ? 0.5 : finalProgressValue;
     increment = (maxProgressValue - m_progressValue) * percentOfRemainingBytes;
     m_progressValue += increment;
@@ -221,14 +223,14 @@ void ProgressTracker::incrementProgress(unsigned long identifier, const char*, i
             if (m_progressValue == 1)
                 m_finalProgressChangedSent = true;
             
-            m_originatingProgressFrame->loader()->client()->postProgressEstimateChangedNotification();
+            frame->loader()->client()->postProgressEstimateChangedNotification();
 
             m_lastNotifiedProgressValue = m_progressValue;
             m_lastNotifiedProgressTime = now;
         }
     }
     
-    m_originatingProgressFrame->loader()->client()->didChangeEstimatedProgress();
+    frame->loader()->client()->didChangeEstimatedProgress();
 }
 
 void ProgressTracker::completeProgress(unsigned long identifier)
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index 801f438..ad17287 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,23 @@
+2009-11-02  Jedrzej Nowacki  <jedrzej.nowacki at nokia.com>
+
+        Reviewed by Adam Barth.
+
+        QWebView crash fix.
+
+        The QWebView should not crash if the stop() method is called from
+        a function triggered by the loadProgress signal.
+
+        A null pointer protection was added in the ProgressTracker::incrementProgress.
+
+        New autotest was created.
+
+        https://bugs.webkit.org/show_bug.cgi?id=29425
+
+        * tests/qwebview/tst_qwebview.cpp:
+        (WebViewCrashTest::WebViewCrashTest):
+        (WebViewCrashTest::loading):
+        (tst_QWebView::crashTests):
+
 2009-11-01  Laszlo Gombos  <laszlo.1.gombos at nokia.com>
 
         Reviewed by Eric Seidel.
diff --git a/WebKit/qt/tests/qwebpage/frametest/frame_a.html b/WebKit/qt/tests/qwebview/data/frame_a.html
similarity index 100%
copy from WebKit/qt/tests/qwebpage/frametest/frame_a.html
copy to WebKit/qt/tests/qwebview/data/frame_a.html
diff --git a/WebKit/qt/tests/qwebpage/frametest/index.html b/WebKit/qt/tests/qwebview/data/index.html
similarity index 100%
copy from WebKit/qt/tests/qwebpage/frametest/index.html
copy to WebKit/qt/tests/qwebview/data/index.html
diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro
index e67bb7a..735537b 100644
--- a/WebKit/qt/tests/qwebview/qwebview.pro
+++ b/WebKit/qt/tests/qwebview/qwebview.pro
@@ -4,6 +4,7 @@ include(../../../../WebKit.pri)
 SOURCES  += tst_qwebview.cpp
 QT += testlib network
 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+RESOURCES  += tst_qwebview.qrc
 DEFINES += SRCDIR=\\\"$$PWD/\\\"
 
 symbian {
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index fda979e..27daf38 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -20,6 +20,7 @@
 */
 
 #include <qtest.h>
+#include "../util.h"
 
 #include <qpainter.h>
 #include <qwebview.h>
@@ -45,6 +46,8 @@ private slots:
 
     void reusePage_data();
     void reusePage();
+
+    void crashTests();
 };
 
 // This will be called before the first test function is executed.
@@ -148,6 +151,46 @@ void tst_QWebView::reusePage()
     QDir::setCurrent(QApplication::applicationDirPath());
 }
 
+// Class used in crashTests
+class WebViewCrashTest : public QObject {
+    Q_OBJECT
+    QWebView* m_view;
+public:
+    bool m_executed;
+
+
+    WebViewCrashTest(QWebView* view)
+      : m_view(view)
+      , m_executed(false)
+    {
+        view->connect(view, SIGNAL(loadProgress(int)), this, SLOT(loading(int)));
+    }
+
+private slots:
+    void loading(int progress)
+    {
+        if (progress >= 20 && progress < 90) {
+            QVERIFY(!m_executed);
+            m_view->stop();
+            m_executed = true;
+        }
+    }
+};
+
+
+// Should not crash.
+void tst_QWebView::crashTests()
+{
+    // Test if loading can be stopped in loadProgress handler without crash.
+    // Test page should have frames.
+    QWebView view;
+    WebViewCrashTest tester(&view);
+    QUrl url("qrc:///data/index.html");
+    view.load(url);
+    QTRY_VERIFY(tester.m_executed); // If fail it means that the test wasn't executed.
+}
+
+
 QTEST_MAIN(tst_QWebView)
 #include "tst_qwebview.moc"
 
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.qrc b/WebKit/qt/tests/qwebview/tst_qwebview.qrc
new file mode 100644
index 0000000..ede34a9
--- /dev/null
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.qrc
@@ -0,0 +1,7 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>data/index.html</file>
+    <file>data/frame_a.html</file>
+</qresource>
+</RCC>
+

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list