Changeset 91302 in webkit


Ignore:
Timestamp:
Jul 19, 2011 2:31:17 PM (13 years ago)
Author:
caio.oliveira@openbossa.org
Message:

[Qt] Fix leak of QWebPage in errorPageExtension tests
https://bugs.webkit.org/show_bug.cgi?id=64814

Reviewed by Noam Rosenthal.

QWebView::setPage() doesn't take ownership, so the ErrorPages were leaking. So now
allocate them on the stack. This shouldn't change any behavior.

  • tests/qwebpage/tst_qwebpage.cpp:

(tst_QWebPage::errorPageExtension):
(tst_QWebPage::errorPageExtensionInIFrames):
(tst_QWebPage::errorPageExtensionInFrameset):

Location:
trunk/Source/WebKit/qt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/qt/ChangeLog

    r91193 r91302  
     12011-07-19  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        [Qt] Fix leak of QWebPage in errorPageExtension tests
     4        https://bugs.webkit.org/show_bug.cgi?id=64814
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        QWebView::setPage() doesn't take ownership, so the ErrorPages were leaking. So now
     9        allocate them on the stack. This shouldn't change any behavior.
     10
     11        * tests/qwebpage/tst_qwebpage.cpp:
     12        (tst_QWebPage::errorPageExtension):
     13        (tst_QWebPage::errorPageExtensionInIFrames):
     14        (tst_QWebPage::errorPageExtensionInFrameset):
     15
    1162011-07-18  Hui Huang  <hui.2.huang@nokia.com>
    217
  • trunk/Source/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp

    r90341 r91302  
    25122512void tst_QWebPage::errorPageExtension()
    25132513{
    2514     ErrorPage* page = new ErrorPage;
    2515     m_view->setPage(page);
     2514    ErrorPage page;
     2515    m_view->setPage(&page);
    25162516
    25172517    QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
     
    25202520    QTRY_COMPARE(spyLoadFinished.count(), 1);
    25212521
    2522     page->mainFrame()->setUrl(QUrl("http://non.existent/url"));
     2522    page.mainFrame()->setUrl(QUrl("http://non.existent/url"));
    25232523    QTRY_COMPARE(spyLoadFinished.count(), 2);
    2524     QCOMPARE(page->mainFrame()->toPlainText(), QString("error"));
    2525     QCOMPARE(page->history()->count(), 2);
    2526     QCOMPARE(page->history()->currentItem().url(), QUrl("http://non.existent/url"));
    2527     QCOMPARE(page->history()->canGoBack(), true);
    2528     QCOMPARE(page->history()->canGoForward(), false);
    2529 
    2530     page->triggerAction(QWebPage::Back);
    2531     QTRY_COMPARE(page->history()->canGoBack(), false);
    2532     QTRY_COMPARE(page->history()->canGoForward(), true);
    2533 
    2534     page->triggerAction(QWebPage::Forward);
    2535     QTRY_COMPARE(page->history()->canGoBack(), true);
    2536     QTRY_COMPARE(page->history()->canGoForward(), false);
    2537 
    2538     page->triggerAction(QWebPage::Back);
    2539     QTRY_COMPARE(page->history()->canGoBack(), false);
    2540     QTRY_COMPARE(page->history()->canGoForward(), true);
    2541     QTRY_COMPARE(page->history()->currentItem().url(), QUrl("data:text/html,foo"));
     2524    QCOMPARE(page.mainFrame()->toPlainText(), QString("error"));
     2525    QCOMPARE(page.history()->count(), 2);
     2526    QCOMPARE(page.history()->currentItem().url(), QUrl("http://non.existent/url"));
     2527    QCOMPARE(page.history()->canGoBack(), true);
     2528    QCOMPARE(page.history()->canGoForward(), false);
     2529
     2530    page.triggerAction(QWebPage::Back);
     2531    QTRY_COMPARE(page.history()->canGoBack(), false);
     2532    QTRY_COMPARE(page.history()->canGoForward(), true);
     2533
     2534    page.triggerAction(QWebPage::Forward);
     2535    QTRY_COMPARE(page.history()->canGoBack(), true);
     2536    QTRY_COMPARE(page.history()->canGoForward(), false);
     2537
     2538    page.triggerAction(QWebPage::Back);
     2539    QTRY_COMPARE(page.history()->canGoBack(), false);
     2540    QTRY_COMPARE(page.history()->canGoForward(), true);
     2541    QTRY_COMPARE(page.history()->currentItem().url(), QUrl("data:text/html,foo"));
    25422542
    25432543    m_view->setPage(0);
     
    25462546void tst_QWebPage::errorPageExtensionInIFrames()
    25472547{
    2548     ErrorPage* page = new ErrorPage;
    2549     m_view->setPage(page);
     2548    ErrorPage page;
     2549    m_view->setPage(&page);
    25502550
    25512551    m_view->page()->mainFrame()->load(QUrl(
     
    25572557    QTRY_COMPARE(spyLoadFinished.count(), 1);
    25582558
    2559     QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("error"));
     2559    QCOMPARE(page.mainFrame()->childFrames()[1]->toPlainText(), QString("error"));
    25602560
    25612561    m_view->setPage(0);
     
    25642564void tst_QWebPage::errorPageExtensionInFrameset()
    25652565{
    2566     ErrorPage* page = new ErrorPage;
    2567     m_view->setPage(page);
     2566    ErrorPage page;
     2567    m_view->setPage(&page);
    25682568
    25692569    m_view->load(QUrl("qrc:///resources/index.html"));
     
    25712571    QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool)));
    25722572    QTRY_COMPARE(spyLoadFinished.count(), 1);
    2573     QCOMPARE(page->mainFrame()->childFrames().count(), 2);
    2574     QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("error"));
     2573    QCOMPARE(page.mainFrame()->childFrames().count(), 2);
     2574    QCOMPARE(page.mainFrame()->childFrames()[1]->toPlainText(), QString("error"));
    25752575
    25762576    m_view->setPage(0);
Note: See TracChangeset for help on using the changeset viewer.