Changeset 39231 in webkit


Ignore:
Timestamp:
Dec 12, 2008, 12:22:35 AM (16 years ago)
Author:
vestbo@webkit.org
Message:

2008-12-11 Ariya Hidayat <ariya.hidayat@trolltech.com>

Reviewed by Tor Arne Vestbø.

When the web page is navigated away, delete the instance
of the native plugin.

http://trolltech.com/developer/task-tracker/index_html?id=214946&method=entry

  • WebCoreSupport/FrameLoaderClientQt.cpp: (WebCore::):
  • tests/qwebpage/tst_qwebpage.cpp: (PluginTrackedPage::PluginTrackedPage): (PluginTrackedPage::createPlugin): (tst_QWebPage::destroyPlugin):
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/ChangeLog

    r39210 r39231  
     12008-12-11  Ariya Hidayat  <ariya.hidayat@trolltech.com>
     2
     3        Reviewed by Tor Arne Vestbø.
     4
     5        When the web page is navigated away, delete the instance
     6        of the native plugin.
     7
     8        http://trolltech.com/developer/task-tracker/index_html?id=214946&method=entry
     9
     10        * WebCoreSupport/FrameLoaderClientQt.cpp:
     11        (WebCore::):
     12        * tests/qwebpage/tst_qwebpage.cpp:
     13        (PluginTrackedPage::PluginTrackedPage):
     14        (PluginTrackedPage::createPlugin):
     15        (tst_QWebPage::destroyPlugin):
     16
    1172008-12-11  Yael Aharon  <yael.aharon@nokia.com>
    218
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r39210 r39231  
    997997public:
    998998    QtPluginWidget(QWidget* w = 0): Widget(w) {}
     999    ~QtPluginWidget()
     1000    {
     1001        if (platformWidget())
     1002            platformWidget()->deleteLater();
     1003    }
    9991004    virtual void invalidateRect(const IntRect& r)
    10001005    {
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r39210 r39231  
    9999    void database();
    100100    void createPlugin();
     101    void destroyPlugin();
    101102
    102103private:
     
    548549}
    549550
     551class PluginTrackedPage : public QWebPage
     552{
     553public:
     554
     555    int count;
     556    QPointer<QWidget> widget;
     557
     558    PluginTrackedPage(QWidget *parent = 0) : QWebPage(parent), count(0) {
     559       settings()->setAttribute(QWebSettings::PluginsEnabled, true);
     560    }
     561
     562    virtual QObject* createPlugin(const QString&, const QUrl&, const QStringList&, const QStringList&) {
     563       count++;
     564       QWidget *w = new QWidget;
     565       widget = w;
     566       return w;
     567    }
     568};
     569
     570void tst_QWebPage::destroyPlugin()
     571{
     572    PluginTrackedPage* page = new PluginTrackedPage(m_view);
     573    m_view->setPage(page);
     574
     575    // we create the plugin, so the widget should be constructed
     576    QString content("<html><body><object type=\"application/x-qt-plugin\" classid=\"QProgressBar\"></object></body></html>");
     577    m_view->setHtml(content);
     578    QVERIFY(page->widget != 0);
     579    QCOMPARE(page->count, 1);
     580
     581    // navigate away, the plugin widget should be destructed
     582    m_view->setHtml("<html><body>Hi</body></html>");
     583    QTestEventLoop::instance().enterLoop(1);
     584    QVERIFY(page->widget == 0);
     585}
     586
    550587QTEST_MAIN(tst_QWebPage)
    551588#include "tst_qwebpage.moc"
Note: See TracChangeset for help on using the changeset viewer.