Bug 32441

Summary: [GTK] Fails fast/parser/xhtml-close-while-parsing.xhtml
Product: WebKit Reporter: Gustavo Noronha (kov) <gustavo>
Component: WebKitGTKAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: mrobinson
Priority: P2 Keywords: Gtk
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   

Description Gustavo Noronha (kov) 2009-12-11 11:07:19 PST
This test fails because, javascript stops execution when we destroy the WebView, here:

    window.close();
    if (window.layoutTestController)
        layoutTestController.notifyDone();

The notifyDone() call is never reached. If we delay the destruction of the webView with g_idle_add the test passes (see diff bellow). The problem is that, with that change, another test starts failing: fast/dom/location-new-window-no-crash.html. It fails because the webView is not destroyed when it checks for it:

testWindow.close();

if (window.layoutTestController) {
    function doneHandler()
    {
        if (testWindow.closed) {
            layoutTestController.notifyDone();
            return;
        }
        setTimeout(doneHandler, 0);
    }
    doneHandler();
}

We are either doing something wrong in our WebView destruction code, or this setTimeout-based loop is not letting the mainloop run. No clue what to do, so I'll skip the test that is failing right now.


diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index fd1e3c6..178e2af 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -694,13 +694,25 @@ static void webViewStatusBarTextChanged(WebKitWebView* vie
w, const gchar* messag
     }
 }
 
-static gboolean webViewClose(WebKitWebView* view)
+static gboolean webViewCloseReal(gpointer data)
 {
-    ASSERT(view);
+    WebKitWebView* view = static_cast<WebKitWebView*>(data);
 
     webViewList = g_slist_remove(webViewList, view);
     g_object_unref(view);
 
+    return FALSE;
+}
+
+static gboolean webViewClose(WebKitWebView* view)
+{
+    ASSERT(view);
+
+    // If we destroy the view here, the rest of the test's script has
+    // no chance to run, which may cause notifyDone() to not be
+    // called, so schedule its destruction.
+    g_idle_add(webViewCloseReal, view);
+
     return TRUE;
 }
Comment 1 Martin Robinson 2011-02-08 12:31:28 PST
I unskipped this one and it's passing now. Closing.