summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-07-23 16:14:01 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2009-07-23 16:14:01 +0200
commitfdaed851ce71fc474a7959d8fc30b50465a98d0d (patch)
treee6fc5f217c43d0e18e9e1baa65aed3e152ec56c3 /src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
parentc29d1cc49998ef895df9dcbccafe1b6d6d8e7efc (diff)
Updated WebKit from /home/shausman/src/webkit/trunk to origin/qtwebkit-4.5 ( 1535d41a668e5f74f44ff3aa1313a84d5718d2d7 )
Changes in WebKit since the last update: ++ b/WebCore/ChangeLog 2009-07-23 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Holger Freyther. Fix crashes with the QObject bindings after garbage collection. There is one QtInstance per wrapped QObject, and that QtInstance keeps references to cached JSObjects for slots. When those objects get deleted due to GC, then they becoming dangling pointers. When a cached member dies, it is now removed from the QtInstance's cache. As we cannot track the lifetime of the children, we have to remove them from QtInstance alltogether. They are not cached and were only used for mark(), but we _want_ them to be subject to gc. * bridge/qt/qt_instance.cpp: (JSC::Bindings::QtInstance::~QtInstance): Minor coding style cleanup, use qDeleteAll(). (JSC::Bindings::QtInstance::removeCachedMethod): New function, to clean m_methods and m_defaultMethod. (JSC::Bindings::QtInstance::mark): Avoid marking already marked objects. (JSC::Bindings::QtField::valueFromInstance): Don't save children for marking. * bridge/qt/qt_instance.h: Declare removeCachedMethod. * bridge/qt/qt_runtime.cpp: (JSC::Bindings::QtRuntimeMethod::~QtRuntimeMethod): Call removeCachedMethod with this on the instance. 2009-05-04 Jakub Wieczorek <faw217@gmail.com> Reviewed by Simon Hausmann. As Qtish implementation of MIMETypeRegistry::getMIMETypeForExtension() returns the application/octet-stream mimetype when it can't associate extension with any mimetype, it can happen that the application/octet-stream mimetype will hit the list of supported image formats. For instance, it is possible when QImageReader or QImageWriter support an extension that is not in the extensions map. Make sure that this mimetype is not treated as displayable image type. * platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypes): (WebCore::initializeSupportedImageMIMETypesForEncoding): ++ b/WebKit/qt/ChangeLog 2009-07-23 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Holger Freyther. Added a testcase to verify that cached methods in the QOBject bindings remain alife even after garbage collection. * tests/qwebpage/tst_qwebpage.cpp: (tst_QWebPage::protectBindingsRuntimeObjectsFromCollector):
Diffstat (limited to 'src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp')
-rw-r--r--src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
index 620aa31a60..c3ed54cc1b 100644
--- a/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp
@@ -107,6 +107,7 @@ private slots:
void textEditing();
void requestCache();
+ void protectBindingsRuntimeObjectsFromCollector();
private:
@@ -1037,5 +1038,29 @@ void tst_QWebPage::requestCache()
(int)QNetworkRequest::PreferCache);
}
+void QWEBKIT_EXPORT qt_drt_garbageCollector_collect();
+
+void tst_QWebPage::protectBindingsRuntimeObjectsFromCollector()
+{
+ QSignalSpy loadSpy(m_view, SIGNAL(loadFinished(bool)));
+
+ PluginPage* newPage = new PluginPage(m_view);
+ m_view->setPage(newPage);
+
+ m_view->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+
+ m_view->setHtml(QString("<html><body><object type='application/x-qt-plugin' classid='lineedit' id='mylineedit'/></body></html>"));
+ QTRY_COMPARE(loadSpy.count(), 1);
+
+ newPage->mainFrame()->evaluateJavaScript("function testme(text) { var lineedit = document.getElementById('mylineedit'); lineedit.setText(text); lineedit.selectAll(); }");
+
+ newPage->mainFrame()->evaluateJavaScript("testme('foo')");
+
+ qt_drt_garbageCollector_collect();
+
+ // don't crash!
+ newPage->mainFrame()->evaluateJavaScript("testme('bar')");
+}
+
QTEST_MAIN(tst_QWebPage)
#include "tst_qwebpage.moc"