[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:47:32 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 64a2c5347d6f52e7ccef467afcdd9cb1a6d83af2
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 19 10:44:43 2009 +0000

    2009-10-19  Girish Ramakrishnan  <girish at forwardbias.in>
    
            Reviewed by Holger Freyther.
    
            [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
    
            Fixes various sources of crashes:
            1. The PluginContainer is a child of QWebView. When the view gets deleted,
            the PluginView is not notified about the deletion of PluginContainer.
            2. QWebView destructor does not set client to 0.
            3. Sometimes pending paint events are sent after the plugin has died, so add
            a check in PluginView::setNPWindowIfNeeded.
    
            https://bugs.webkit.org/show_bug.cgi?id=30354
    
            * plugins/qt/PluginContainerQt.cpp:
            (PluginContainerQt::~PluginContainerQt):
            * plugins/qt/PluginViewQt.cpp:
            (WebCore::PluginView::setNPWindowIfNeeded):
    2009-10-19  Girish Ramakrishnan  <girish at forwardbias.in>
    
            Reviewed by Holger Freyther.
    
            [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
    
            Fixes various sources of crashes:
            1. The PluginContainer is a child of QWebView. When the view gets deleted,
            the PluginView is not notified about the deletion of PluginContainer.
            2. QWebView destructor does not set client to 0.
            3. Sometimes pending paint events are sent after the plugin has died, so add
            a check in PluginView::setNPWindowIfNeeded.
    
            https://bugs.webkit.org/show_bug.cgi?id=30354
    
            * Api/qwebview.cpp:
            (QWebView::~QWebView):
            * tests/qwebview/qwebview.pro:
            * tests/qwebview/tst_qwebview.cpp:
            (tst_QWebView::reusePage_data):
            (tst_QWebView::reusePage):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49770 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e27cc24..0e5c54c 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2009-10-19  Girish Ramakrishnan  <girish at forwardbias.in>
+
+        Reviewed by Holger Freyther.
+
+        [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
+        
+        Fixes various sources of crashes:
+        1. The PluginContainer is a child of QWebView. When the view gets deleted,
+        the PluginView is not notified about the deletion of PluginContainer.
+        2. QWebView destructor does not set client to 0.
+        3. Sometimes pending paint events are sent after the plugin has died, so add
+        a check in PluginView::setNPWindowIfNeeded.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30354
+
+        * plugins/qt/PluginContainerQt.cpp:
+        (PluginContainerQt::~PluginContainerQt):
+        * plugins/qt/PluginViewQt.cpp:
+        (WebCore::PluginView::setNPWindowIfNeeded):
+
 2009-10-19  Jakob Truelsen  <antialize at gmail.com>
 
         Reviewed by Adam Barth.
diff --git a/WebCore/plugins/qt/PluginContainerQt.cpp b/WebCore/plugins/qt/PluginContainerQt.cpp
index 59ab5bc..cb894a7 100644
--- a/WebCore/plugins/qt/PluginContainerQt.cpp
+++ b/WebCore/plugins/qt/PluginContainerQt.cpp
@@ -73,6 +73,7 @@ PluginContainerQt::PluginContainerQt(PluginView* view, QWidget* parent)
 PluginContainerQt::~PluginContainerQt()
 {
     delete m_clientWrapper;
+    m_pluginView->setPlatformPluginWidget(0);
 }
 
 void PluginContainerQt::on_clientClosed()
diff --git a/WebCore/plugins/qt/PluginViewQt.cpp b/WebCore/plugins/qt/PluginViewQt.cpp
index 5d15b66..e1473bf 100644
--- a/WebCore/plugins/qt/PluginViewQt.cpp
+++ b/WebCore/plugins/qt/PluginViewQt.cpp
@@ -462,12 +462,15 @@ void PluginView::setNPWindowIfNeeded()
     if (m_mode != NP_FULL && m_mode != NP_EMBED)
         return;
 
+    // Check if the platformPluginWidget still exists
+    if (m_isWindowed && !platformPluginWidget())
+        return;
+
     if (!m_hasPendingGeometryChange)
         return;
     m_hasPendingGeometryChange = false;
 
     if (m_isWindowed) {
-        ASSERT(platformPluginWidget());
         platformPluginWidget()->setGeometry(m_windowRect);
         // if setMask is set with an empty QRegion, no clipping will
         // be performed, so in that case we hide the plugin view
diff --git a/WebKit/qt/Api/qwebview.cpp b/WebKit/qt/Api/qwebview.cpp
index b900462..f7caa94 100644
--- a/WebKit/qt/Api/qwebview.cpp
+++ b/WebKit/qt/Api/qwebview.cpp
@@ -245,8 +245,10 @@ QWebView::QWebView(QWidget *parent)
 */
 QWebView::~QWebView()
 {
-    if (d->page)
+    if (d->page) {
         d->page->d->view = 0;
+        d->page->d->client = 0;
+    }
 
     if (d->page && d->page->parent() == this)
         delete d->page;
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index b3ab6d4..f011693 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,25 @@
+2009-10-19  Girish Ramakrishnan  <girish at forwardbias.in>
+
+        Reviewed by Holger Freyther.
+
+        [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
+        
+        Fixes various sources of crashes:
+        1. The PluginContainer is a child of QWebView. When the view gets deleted,
+        the PluginView is not notified about the deletion of PluginContainer.
+        2. QWebView destructor does not set client to 0.
+        3. Sometimes pending paint events are sent after the plugin has died, so add
+        a check in PluginView::setNPWindowIfNeeded.
+
+        https://bugs.webkit.org/show_bug.cgi?id=30354
+
+        * Api/qwebview.cpp:
+        (QWebView::~QWebView):
+        * tests/qwebview/qwebview.pro:
+        * tests/qwebview/tst_qwebview.cpp:
+        (tst_QWebView::reusePage_data):
+        (tst_QWebView::reusePage):
+
 2009-10-19  Jakob Truelsen  <antialize at gmail.com>
 
         Reviewed by Adam Barth.
diff --git a/WebKit/qt/tests/qwebview/qwebview.pro b/WebKit/qt/tests/qwebview/qwebview.pro
index d9d122c..bba7c39 100644
--- a/WebKit/qt/tests/qwebview/qwebview.pro
+++ b/WebKit/qt/tests/qwebview/qwebview.pro
@@ -4,5 +4,6 @@ include(../../../../WebKit.pri)
 SOURCES  += tst_qwebview.cpp
 QT += testlib network
 QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
+DEFINES += SRCDIR=\\\"$$PWD/\\\"
 
 symbian:TARGET.UID3 = 0xA000E53F
diff --git a/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
index 01d0e92..9204223 100644
--- a/WebKit/qt/tests/qwebview/tst_qwebview.cpp
+++ b/WebKit/qt/tests/qwebview/tst_qwebview.cpp
@@ -1,6 +1,7 @@
 /*
     Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
     Copyright (C) 2009 Torch Mobile Inc.
+    Copyright (C) 2009 Girish Ramakrishnan <girish at forwardbias.in>
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
@@ -26,6 +27,7 @@
 #include <qnetworkrequest.h>
 #include <qdiriterator.h>
 #include <qwebkitversion.h>
+#include <qwebframe.h>
 
 class tst_QWebView : public QObject
 {
@@ -42,6 +44,9 @@ private slots:
     void guessUrlFromString_data();
     void guessUrlFromString();
     void getWebKitVersion();
+
+    void reusePage_data();
+    void reusePage();
 };
 
 // This will be called before the first test function is executed.
@@ -167,6 +172,46 @@ void tst_QWebView::getWebKitVersion()
     QVERIFY(qWebKitVersion().toDouble() > 0);
 }
 
+void tst_QWebView::reusePage_data()
+{
+    QTest::addColumn<QString>("html");
+    QTest::newRow("WithoutPlugin") << "<html><body id='b'>text</body></html>";
+    QTest::newRow("WindowedPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf'></embed></body></html>");
+    QTest::newRow("WindowlessPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf' wmode=\"transparent\"></embed></body></html>");
+}
+
+void tst_QWebView::reusePage()
+{
+    QDir::setCurrent(SRCDIR);
+
+    QFETCH(QString, html);
+    QWebView* view1 = new QWebView;
+    QPointer<QWebPage> page = new QWebPage;
+    view1->setPage(page);
+    page->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+    QWebFrame* mainFrame = page->mainFrame();
+    mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath()));
+    if (html.contains("</embed>")) {
+        // some reasonable time for the PluginStream to feed test.swf to flash and start painting
+        QTest::qWait(2000);
+    }
+
+    view1->show();
+    QTest::qWait(2000);
+    delete view1;
+    QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view
+
+    QWebView *view2 = new QWebView;
+    view2->setPage(page);
+    view2->show(); // in Windowless mode, you should still be able to see the plugin here
+    QTest::qWait(2000);
+    delete view2;
+
+    delete page; // must not crash
+
+    QDir::setCurrent(QApplication::applicationDirPath());
+}
+
 QTEST_MAIN(tst_QWebView)
 #include "tst_qwebview.moc"
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list