To test, open the Inspector and refresh this page. There should be a red
+bubble with the number "1" in it next to the main resource in the Resources
+panel. Clicking the button below should change the "1" to a "2".
+
+
diff -r 4f2f89ce4247 -r 9d347b658349 WebKit/qt/ChangeLog
--- a/WebKit/qt/ChangeLog Fri Sep 17 09:02:29 2010 +0300
+++ b/WebKit/qt/ChangeLog Fri Sep 17 09:07:27 2010 +0300
@@ -408,6 +408,18 @@
(QWebFrame::setUrl):
(QWebFrame::load):
+2010-07-08 Sam Magnuson
+
+ Reviewed by Simon Hausmann.
+
+ [Qt] instance objects created for QObjects are somtimes GC'd
+ https://bugs.webkit.org/show_bug.cgi?id=40352
+
+ Improved the test to check for jsObjects that that are garbage collected.
+
+ * tests/qwebframe/tst_qwebframe.cpp:
+ (tst_QWebFrame::):
+
2010-07-08 Aaron Boodman
Unreviewed change to fix qt build after c62876.
diff -r 4f2f89ce4247 -r 9d347b658349 WebKit/qt/tests/qwebframe/tst_qwebframe.cpp
--- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp Fri Sep 17 09:02:29 2010 +0300
+++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp Fri Sep 17 09:07:27 2010 +0300
@@ -37,6 +37,7 @@
#include
#endif
#include "../util.h"
+#include "../WebCoreSupport/DumpRenderTreeSupportQt.h"
struct CustomType {
QString string;
@@ -570,9 +571,11 @@
void cleanup();
private slots:
+ void getSetDynamicProperty();
+ void getSetDynamicProperty_data();
+ void getSetChildren();
+ void getSetChildren_data();
void getSetStaticProperty();
- void getSetDynamicProperty();
- void getSetChildren();
void callQtInvokable();
void connectAndDisconnect();
void classEnums();
@@ -668,6 +671,10 @@
evalJS("delete retvalue; delete typevalue");
return ret;
}
+ void garbageCollectJS()
+ {
+ DumpRenderTreeSupportQt::garbageCollectorCollect();
+ }
QObject* firstChildByClassName(QObject* parent, const char* className) {
const QObjectList & children = parent->children();
foreach (QObject* child, children) {
@@ -944,6 +951,8 @@
void tst_QWebFrame::getSetDynamicProperty()
{
+ QFETCH(bool, garbageCollect);
+
// initially the object does not have the property
// In WebKit, RuntimeObjects do not inherit Object, so don't have hasOwnProperty
@@ -955,11 +964,34 @@
//QCOMPARE(evalJS("myObject.hasOwnProperty('dynamicProperty')"), sTrue);
QCOMPARE(evalJS("typeof myObject.dynamicProperty != 'undefined'"), sTrue);
QCOMPARE(evalJS("myObject.dynamicProperty == 123"), sTrue);
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(evalJS("typeof myObject.dynamicProperty != 'undefined'"), sTrue);
+ }
// property change in script should be reflected in C++
QCOMPARE(evalJS("myObject.dynamicProperty = 'foo';"
"myObject.dynamicProperty"), QLatin1String("foo"));
QCOMPARE(m_myObject->property("dynamicProperty").toString(), QLatin1String("foo"));
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(m_myObject->property("dynamicProperty").toString(), QLatin1String("foo"));
+ }
+
+ // add a dynamic property in C++ to another QObject
+ QObject* propertyObject = new QObject(m_myObject);
+ QCOMPARE(m_myObject->setProperty("dynamicObjectProperty", qVariantFromValue(propertyObject)), false);
+ QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty != 'undefined'"), sTrue);
+ evalJS("myObject.dynamicObjectProperty.jsProperty = 123");
+ QCOMPARE(evalJS("myObject.dynamicObjectProperty.jsProperty == 123"), sTrue);
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty != 'undefined'"), sTrue);
+ QCOMPARE(evalJS("myObject.dynamicObjectProperty.jsProperty == 123"), sTrue);
+ }
+ QCOMPARE(m_myObject->setProperty("dynamicObjectProperty", QVariant()), false);
+ delete propertyObject;
+ QCOMPARE(evalJS("typeof myObject.dynamicObjectProperty == 'undefined'"), sTrue);
// delete the property (XFAIL - can't delete properties)
QEXPECT_FAIL("", "can't delete properties", Continue);
@@ -970,10 +1002,21 @@
// QCOMPARE(evalJS("myObject.hasOwnProperty('dynamicProperty')"), sFalse);
QCOMPARE(evalJS("typeof myObject.dynamicProperty"), sUndefined);
*/
+
+ evalJS("myObject.dynamicProperty = undefined");
+}
+
+void tst_QWebFrame::getSetDynamicProperty_data()
+{
+ QTest::addColumn("garbageCollect");
+ QTest::newRow("with garbageCollect") << true;
+ QTest::newRow("without garbageCollect") << false;
}
void tst_QWebFrame::getSetChildren()
{
+ QFETCH(bool, garbageCollect);
+
// initially the object does not have the child
// (again, no hasOwnProperty)
@@ -985,12 +1028,27 @@
child->setObjectName("child");
// QCOMPARE(evalJS("myObject.hasOwnProperty('child')"), sTrue);
QCOMPARE(evalJS("typeof myObject.child != 'undefined'"), sTrue);
+ evalJS("myObject.child.jsProperty = 123");
+ QCOMPARE(evalJS("myObject.child.jsProperty == 123"), sTrue);
+
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(evalJS("typeof myObject.child != 'undefined'"), sTrue);
+ QCOMPARE(evalJS("myObject.child.jsProperty == 123"), sTrue);
+ }
// add a grandchild
MyQObject* grandChild = new MyQObject(child);
grandChild->setObjectName("grandChild");
// QCOMPARE(evalJS("myObject.child.hasOwnProperty('grandChild')"), sTrue);
QCOMPARE(evalJS("typeof myObject.child.grandChild != 'undefined'"), sTrue);
+ evalJS("myObject.child.grandChild.jsProperty = 123");
+ evalJS("myObject.child.grandChild.jsProperty = 123");
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(evalJS("typeof myObject.child.grandChild != 'undefined'"), sTrue);
+ QCOMPARE(evalJS("myObject.child.grandChild.jsProperty == 123"), sTrue);
+ }
// delete grandchild
delete grandChild;
@@ -1001,6 +1059,18 @@
delete child;
// QCOMPARE(evalJS("myObject.hasOwnProperty('child')"), sFalse);
QCOMPARE(evalJS("typeof myObject.child == 'undefined'"), sTrue);
+ if( garbageCollect ) {
+ garbageCollectJS();
+ QCOMPARE(evalJS("typeof myObject.child == 'undefined'"), sTrue);
+ }
+}
+
+
+void tst_QWebFrame::getSetChildren_data()
+{
+ QTest::addColumn("garbageCollect");
+ QTest::newRow("with garbageCollect") << true;
+ QTest::newRow("without garbageCollect") << false;
}
Q_DECLARE_METATYPE(QVector)
@@ -1667,7 +1737,7 @@
m_myObject->emitMySignal();
QCOMPARE(m_myObject->qtFunctionInvoked(), 20);
evalJS("myObject = null");
- evalJS("gc()");
+ garbageCollectJS();
m_myObject->resetQtFunctionInvoked();
m_myObject->emitMySignal();
QCOMPARE(m_myObject->qtFunctionInvoked(), 20);
diff -r 4f2f89ce4247 -r 9d347b658349 WebKitTools/DumpRenderTree/fonts/WebKit Layout Tests 2.ttf
Binary file WebKitTools/DumpRenderTree/fonts/WebKit Layout Tests 2.ttf has changed
diff -r 4f2f89ce4247 -r 9d347b658349 WebKitTools/DumpRenderTree/fonts/WebKit Layout Tests.ttf
Binary file WebKitTools/DumpRenderTree/fonts/WebKit Layout Tests.ttf has changed
diff -r 4f2f89ce4247 -r 9d347b658349 WebKitTools/WebKitTestRunner/fonts/WebKit Layout Tests 2.ttf
Binary file WebKitTools/WebKitTestRunner/fonts/WebKit Layout Tests 2.ttf has changed
diff -r 4f2f89ce4247 -r 9d347b658349 WebKitTools/WebKitTestRunner/fonts/WebKit Layout Tests.ttf
Binary file WebKitTools/WebKitTestRunner/fonts/WebKit Layout Tests.ttf has changed
diff -r 4f2f89ce4247 -r 9d347b658349 confml/qtwebkit.confml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/confml/qtwebkit.confml Fri Sep 17 09:07:27 2010 +0300
@@ -0,0 +1,16 @@
+
+
+
+ QT Webkit settings
+
+ To enable QT Webkit usage
+
+
+
+
+ true
+
+
+
\ No newline at end of file
diff -r 4f2f89ce4247 -r 9d347b658349 content/apps/qtwebkit.sisx
Binary file content/apps/qtwebkit.sisx has changed
diff -r 4f2f89ce4247 -r 9d347b658349 content/group/bld.inf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/content/group/bld.inf Fri Sep 17 09:07:27 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* ============================================================================
+* Name : bld.inf
+* Part of : webruntime
+* Description :
+* Version : %version: 2 %
+*
+ * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This file is part of Qt Web Runtime.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+../../confml/qtwebkit.confml CONFML_EXPORT_PATH(qtwebkit.confml,uda_content)
+../../implml/qtwebkit_copy.implml CRML_EXPORT_PATH(qtwebkit_copy.implml,uda_content)
+../../content/apps/qtwebkit.sisx CRML_EXPORT_PATH(../content/sis/,uda_content)
diff -r 4f2f89ce4247 -r 9d347b658349 implml/qtwebkit_copy.implml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/implml/qtwebkit_copy.implml Fri Sep 17 09:07:27 2010 +0300
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff -r 4f2f89ce4247 -r 9d347b658349 layers.sysdef.xml
--- a/layers.sysdef.xml Fri Sep 17 09:02:29 2010 +0300
+++ b/layers.sysdef.xml Fri Sep 17 09:07:27 2010 +0300
@@ -10,5 +10,10 @@
+
+
+
+
+
diff -r 4f2f89ce4247 -r 9d347b658349 package_definition.xml
--- a/package_definition.xml Fri Sep 17 09:02:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff -r 4f2f89ce4247 -r 9d347b658349 package_map.xml
--- a/package_map.xml Fri Sep 17 09:02:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-
diff -r 4f2f89ce4247 -r 9d347b658349 qtwebkit_stub.pkg
--- a/qtwebkit_stub.pkg Fri Sep 17 09:02:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-; Language
-&EN
-
-
-; SIS header: name, uid, version
-#{"QtWebKit"},(0x200267C2),4,7,0
-
-
-; Manual PKG pre-rules from PRO files
-; Default HW/platform dependencies
-
-; Localised Vendor name
-%{"Nokia"}
-
-; Unique Vendor name
-:"Nokia"
-
-; Dependencies of Qt libraries
-
-"" - "z:\sys\bin\qmlwebkitplugin.dll"
-;"" - "z:\resource\qt\imports\QtWebKit\qmlwebkitplugin.qtplugin"
-;"" - "z:\resource\qt\imports\QtWebKit\qmldir"
-"" - "z:\sys\bin\QtWebKit.dll"
-"" - "z:\private\10202D56\import\packages\200267C2\backup_registration.xml"