Bug 32441 - [GTK] Fails fast/parser/xhtml-close-while-parsing.xhtml
Summary: [GTK] Fails fast/parser/xhtml-close-while-parsing.xhtml
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: Gtk
Depends on:
Blocks:
 
Reported: 2009-12-11 11:07 PST by Gustavo Noronha (kov)
Modified: 2011-02-08 12:31 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.