Changeset 58112 in webkit


Ignore:
Timestamp:
Apr 22, 2010 1:12:20 PM (14 years ago)
Author:
robert@webkit.org
Message:

[Qt] Fix createPlugin() tests in tst_qwebpage to match behaviour of Qt plugins

when PluginsEnabled is false.

2010-04-22 Robert Hogan <robert@webkit.org>

Reviewed by Simon Hausmann.

[Qt] Fix createPlugin() tests in tst_qwebpage to match behaviour of Qt plugins

when PluginsEnabled is false.

tst_qwebpage should have been updated as part of r56662.
(See https://bugs.webkit.org/show_bug.cgi?id=32196)

Updated documentation of QWebPage::createPlugin and QWebSetting::pluginsEnabled

to match the new behaviour.

  • Api/qwebpage.cpp: Update docs.
  • Api/qwebsettings.cpp: Update docs.
  • tests/qwebpage/tst_qwebpage.cpp: (createPlugin): (tst_QWebPage::createPluginWithPluginsEnabled): (tst_QWebPage::createPluginWithPluginsDisabled):
Location:
trunk/WebKit/qt
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r58038 r58112  
    18851885
    18861886/*!
    1887     This function is called whenever WebKit encounters a HTML object element with type "application/x-qt-plugin".
    1888     The \a classid, \a url, \a paramNames and \a paramValues correspond to the HTML object element attributes and
    1889     child elements to configure the embeddable object.
     1887    This function is called whenever WebKit encounters a HTML object element with type "application/x-qt-plugin". It is
     1888    called regardless of the value of QWebSettings::PluginsEnabled. The \a classid, \a url, \a paramNames and \a paramValues
     1889    correspond to the HTML object element attributes and child elements to configure the embeddable object.
    18901890*/
    18911891QObject *QWebPage::createPlugin(const QString &classid, const QUrl &url, const QStringList &paramNames, const QStringList &paramValues)
  • trunk/WebKit/qt/Api/qwebsettings.cpp

    r58072 r58112  
    299299    \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
    300300    this attribute is enabled for all pages by setting it on the
    301     \l{globalSettings()}{global settings object}.
     301    \l{globalSettings()}{global settings object}. QtWebKit will always ignore this setting
     302    \when processing Qt plugins. The decision to allow a Qt plugin is made by the client
     303    \in its reimplementation of QWebPage::createPlugin.
    302304
    303305    \section1 Web Application Support
     
    368370    \value JavaEnabled Enables or disables Java applets.
    369371        Currently Java applets are not supported.
    370     \value PluginsEnabled Enables or disables plugins in Web pages.
     372    \value PluginsEnabled Enables or disables plugins in Web pages. Qt plugins
     373        with a mimetype such as "application/x-qt-plugin" are not affected by this setting.
    371374    \value PrivateBrowsingEnabled Private browsing prevents WebKit from
    372375        recording visited pages in the history and storing web page icons.
  • trunk/WebKit/qt/ChangeLog

    r58111 r58112  
     12010-04-22  Robert Hogan  <robert@webkit.org>
     2
     3        Reviewed by Simon Hausmann.
     4
     5        [Qt] Fix createPlugin() tests in tst_qwebpage to match behaviour of Qt plugins
     6             when PluginsEnabled is false.
     7
     8        tst_qwebpage should have been updated as part of r56662.
     9        (See https://bugs.webkit.org/show_bug.cgi?id=32196)
     10
     11        Updated documentation of QWebPage::createPlugin and QWebSetting::pluginsEnabled
     12            to match the new behaviour.
     13
     14        * Api/qwebpage.cpp: Update docs.
     15        * Api/qwebsettings.cpp: Update docs.
     16        * tests/qwebpage/tst_qwebpage.cpp:
     17        (createPlugin):
     18        (tst_QWebPage::createPluginWithPluginsEnabled):
     19        (tst_QWebPage::createPluginWithPluginsDisabled):
     20
    1212010-04-22  Dave Moore  <davemoore@chromium.org>
    222
  • trunk/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r57433 r58112  
    8282    void contextMenuCrash();
    8383    void database();
    84     void createPlugin();
     84    void createPluginWithPluginsEnabled();
     85    void createPluginWithPluginsDisabled();
    8586    void destroyPlugin_data();
    8687    void destroyPlugin();
     
    520521};
    521522
    522 void tst_QWebPage::createPlugin()
    523 {
    524     QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool)));
    525 
    526     PluginPage* newPage = new PluginPage(m_view);
    527     m_view->setPage(newPage);
    528 
    529     // plugins not enabled by default, so the plugin shouldn't be loaded
    530     m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>"));
     523static void createPlugin(QWebView *view)
     524{
     525    QSignalSpy loadSpy(view, SIGNAL(loadFinished(bool)));
     526
     527    PluginPage* newPage = new PluginPage(view);
     528    view->setPage(newPage);
     529
     530    // type has to be application/x-qt-plugin
     531    view->setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='pushbutton' id='mybutton'/></body></html>"));
    531532    QTRY_COMPARE(loadSpy.count(), 1);
    532533    QCOMPARE(newPage->calls.count(), 0);
    533534
    534     m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
    535 
    536     // type has to be application/x-qt-plugin
    537     m_view->setHtml(QString("<html><body><object type='application/x-foobarbaz' classid='pushbutton' id='mybutton'/></body></html>"));
     535    view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>"));
    538536    QTRY_COMPARE(loadSpy.count(), 2);
    539     QCOMPARE(newPage->calls.count(), 0);
    540 
    541     m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>"));
    542     QTRY_COMPARE(loadSpy.count(), 3);
    543537    QCOMPARE(newPage->calls.count(), 1);
    544538    {
     
    571565             QString::fromLatin1("function clicked() {\n    [native code]\n}"));
    572566
    573     m_view->setHtml(QString("<html><body><table>"
     567    view->setHtml(QString("<html><body><table>"
    574568                            "<tr><object type='application/x-qt-plugin' classid='lineedit' id='myedit'/></tr>"
    575569                            "<tr><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></tr>"
    576570                            "</table></body></html>"), QUrl("http://foo.bar.baz"));
    577     QTRY_COMPARE(loadSpy.count(), 4);
     571    QTRY_COMPARE(loadSpy.count(), 3);
    578572    QCOMPARE(newPage->calls.count(), 2);
    579573    {
     
    607601        QVERIFY(ci.returnValue->inherits("QPushButton"));
    608602    }
    609 
     603}
     604
     605void tst_QWebPage::createPluginWithPluginsEnabled()
     606{
     607    m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
     608    createPlugin(m_view);
     609}
     610
     611void tst_QWebPage::createPluginWithPluginsDisabled()
     612{
     613    // Qt Plugins should be loaded by QtWebKit even when PluginsEnabled is
     614    // false. The client decides whether a Qt plugin is enabled or not when
     615    // it decides whether or not to instantiate it.
    610616    m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, false);
    611 
    612     m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='pushbutton' id='mybutton'/></body></html>"));
    613     QTRY_COMPARE(loadSpy.count(), 5);
    614     QCOMPARE(newPage->calls.count(), 0);
    615 }
    616 
     617    createPlugin(m_view);
     618}
    617619
    618620// Standard base class for template PluginTracerPage. In tests it is used as interface.
Note: See TracChangeset for help on using the changeset viewer.