Bug 38316

Summary: [Qt] REGRESSION(r57638): tst_qwebframe::objectDeleted() fails
Product: WebKit Reporter: Simon Hausmann <hausmann>
Component: WebCore Misc.Assignee: Simon Hausmann <hausmann>
Status: CLOSED FIXED    
Severity: Blocker CC: bruno.schmidt
Priority: P1 Keywords: Qt
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 35784    
Description Flags
Patch vestbo: review+

Description Simon Hausmann 2010-04-29 03:11:49 PDT
After r57638 the objectDeleted() test fails:

FAIL!  : tst_QWebFrame::objectDeleted() Compared values are not the same
   Actual (type): undefined
   Expected (sError): error
   Loc: [/home/shausman/src/webkit/trunk/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp(2056)]

The test creates a QObject, accesses its properties, deletes it and tries to access it again. Accessing the properties of a deleted object should give an exception, just like in QtScript.

The following hunk from r57638 caused a slight change in behaviour, triggering the regression:

@@ -171,6 +171,8 @@ QtInstance* QtInstance::getInstance(JSObject* object)

 Class* QtInstance::getClass() const
+    if (!m_object)
+        return 0;
     if (!m_class)
         m_class = QtClass::classForObject(m_object);
     return m_class;

After that change even if m_class existed, null is returned.

QtClass itself is protected to handle null objects, so a safe solution would be to return null only if we have never created the class wrapper in the first place.
Comment 1 Simon Hausmann 2010-04-29 03:14:15 PDT
Created attachment 54687 [details]
Comment 2 Simon Hausmann 2010-04-29 03:20:58 PDT
Committed r58493: <http://trac.webkit.org/changeset/58493>
Comment 3 Simon Hausmann 2010-04-29 03:21:38 PDT
Revision r58493 cherry-picked into qtwebkit-2.0 with commit 1a40220a82197023c1b1ac6eff027be6dd3168d3