Changeset 49770 in webkit


Ignore:
Timestamp:
Oct 19, 2009 3:44:43 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-10-19 Girish Ramakrishnan <Girish Ramakrishnan>

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 Ramakrishnan>

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):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r49769 r49770  
     12009-10-19  Girish Ramakrishnan  <girish@forwardbias.in>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
     6       
     7        Fixes various sources of crashes:
     8        1. The PluginContainer is a child of QWebView. When the view gets deleted,
     9        the PluginView is not notified about the deletion of PluginContainer.
     10        2. QWebView destructor does not set client to 0.
     11        3. Sometimes pending paint events are sent after the plugin has died, so add
     12        a check in PluginView::setNPWindowIfNeeded.
     13
     14        https://bugs.webkit.org/show_bug.cgi?id=30354
     15
     16        * plugins/qt/PluginContainerQt.cpp:
     17        (PluginContainerQt::~PluginContainerQt):
     18        * plugins/qt/PluginViewQt.cpp:
     19        (WebCore::PluginView::setNPWindowIfNeeded):
     20
    1212009-10-19  Jakob Truelsen  <antialize@gmail.com>
    222
  • trunk/WebCore/plugins/qt/PluginContainerQt.cpp

    r44381 r49770  
    7474{
    7575    delete m_clientWrapper;
     76    m_pluginView->setPlatformPluginWidget(0);
    7677}
    7778
  • trunk/WebCore/plugins/qt/PluginViewQt.cpp

    r49502 r49770  
    463463        return;
    464464
     465    // Check if the platformPluginWidget still exists
     466    if (m_isWindowed && !platformPluginWidget())
     467        return;
     468
    465469    if (!m_hasPendingGeometryChange)
    466470        return;
     
    468472
    469473    if (m_isWindowed) {
    470         ASSERT(platformPluginWidget());
    471474        platformPluginWidget()->setGeometry(m_windowRect);
    472475        // if setMask is set with an empty QRegion, no clipping will
  • trunk/WebKit/qt/Api/qwebview.cpp

    r49502 r49770  
    246246QWebView::~QWebView()
    247247{
    248     if (d->page)
     248    if (d->page) {
    249249        d->page->d->view = 0;
     250        d->page->d->client = 0;
     251    }
    250252
    251253    if (d->page && d->page->parent() == this)
  • trunk/WebKit/qt/ChangeLog

    r49769 r49770  
     12009-10-19  Girish Ramakrishnan  <girish@forwardbias.in>
     2
     3        Reviewed by Holger Freyther.
     4
     5        [Qt] Windowed Plugins: Fix crash when QWebPage is deleted after QWebView.
     6       
     7        Fixes various sources of crashes:
     8        1. The PluginContainer is a child of QWebView. When the view gets deleted,
     9        the PluginView is not notified about the deletion of PluginContainer.
     10        2. QWebView destructor does not set client to 0.
     11        3. Sometimes pending paint events are sent after the plugin has died, so add
     12        a check in PluginView::setNPWindowIfNeeded.
     13
     14        https://bugs.webkit.org/show_bug.cgi?id=30354
     15
     16        * Api/qwebview.cpp:
     17        (QWebView::~QWebView):
     18        * tests/qwebview/qwebview.pro:
     19        * tests/qwebview/tst_qwebview.cpp:
     20        (tst_QWebView::reusePage_data):
     21        (tst_QWebView::reusePage):
     22
    1232009-10-19  Jakob Truelsen  <antialize@gmail.com>
    224
  • trunk/WebKit/qt/tests/qwebview/qwebview.pro

    r48528 r49770  
    55QT += testlib network
    66QMAKE_RPATHDIR = $$OUTPUT_DIR/lib $$QMAKE_RPATHDIR
     7DEFINES += SRCDIR=\\\"$$PWD/\\\"
    78
    89symbian:TARGET.UID3 = 0xA000E53F
  • trunk/WebKit/qt/tests/qwebview/tst_qwebview.cpp

    r46485 r49770  
    22    Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
    33    Copyright (C) 2009 Torch Mobile Inc.
     4    Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in>
    45
    56    This library is free software; you can redistribute it and/or
     
    2728#include <qdiriterator.h>
    2829#include <qwebkitversion.h>
     30#include <qwebframe.h>
    2931
    3032class tst_QWebView : public QObject
     
    4345    void guessUrlFromString();
    4446    void getWebKitVersion();
     47
     48    void reusePage_data();
     49    void reusePage();
    4550};
    4651
     
    168173}
    169174
     175void tst_QWebView::reusePage_data()
     176{
     177    QTest::addColumn<QString>("html");
     178    QTest::newRow("WithoutPlugin") << "<html><body id='b'>text</body></html>";
     179    QTest::newRow("WindowedPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf'></embed></body></html>");
     180    QTest::newRow("WindowlessPlugin") << QString("<html><body id='b'>text<embed src='resources/test.swf' wmode=\"transparent\"></embed></body></html>");
     181}
     182
     183void tst_QWebView::reusePage()
     184{
     185    QDir::setCurrent(SRCDIR);
     186
     187    QFETCH(QString, html);
     188    QWebView* view1 = new QWebView;
     189    QPointer<QWebPage> page = new QWebPage;
     190    view1->setPage(page);
     191    page->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
     192    QWebFrame* mainFrame = page->mainFrame();
     193    mainFrame->setHtml(html, QUrl::fromLocalFile(QDir::currentPath()));
     194    if (html.contains("</embed>")) {
     195        // some reasonable time for the PluginStream to feed test.swf to flash and start painting
     196        QTest::qWait(2000);
     197    }
     198
     199    view1->show();
     200    QTest::qWait(2000);
     201    delete view1;
     202    QVERIFY(page != 0); // deleting view must not have deleted the page, since it's not a child of view
     203
     204    QWebView *view2 = new QWebView;
     205    view2->setPage(page);
     206    view2->show(); // in Windowless mode, you should still be able to see the plugin here
     207    QTest::qWait(2000);
     208    delete view2;
     209
     210    delete page; // must not crash
     211
     212    QDir::setCurrent(QApplication::applicationDirPath());
     213}
     214
    170215QTEST_MAIN(tst_QWebView)
    171216#include "tst_qwebview.moc"
Note: See TracChangeset for help on using the changeset viewer.