Emit last progress notification before calling dispatchDidFinishLoad
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 20:42:46 +0000 (20:42 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Aug 2011 20:42:46 +0000 (20:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=28851

Reviewed by Adam Barth.

Source/WebCore:

Original patch by Xan Lopez. Change FrameLoader to dispatch the notifications in
a more natural sequence.

Test: http/tests/loading/progress-finished-callback.html

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):

Source/WebKit/qt:

Add infrastructure to dump progressFinishedNotification callback in DRT.

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::dumpProgressFinishedCallback):
* WebCoreSupport/DumpRenderTreeSupportQt.h:
* WebCoreSupport/FrameLoaderClientQt.cpp:
(WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
* WebCoreSupport/FrameLoaderClientQt.h:

Tools:

Implement dumpProgressFinishedCallback() in the layoutTestController for Qt,
Chromium and GTK ports. The first two were simple changes.

Some refactoring was needed in GTK port to assure that the dumps are emitted
correctly and the processing after the page load finished is in the right place.

To detect the load finished, we use the callback for the "load-status" notifier
signal of the top loading frame. And we use the deprecated "load-finished" signal
for dumping (if enabled) the progress finished expected output.

* DumpRenderTree/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(dumpProgressFinishedCallbackCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
(LayoutTestController::dumpProgressFinishedCallback):
(LayoutTestController::setDumpProgressFinishedCallback):
* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::LayoutTestController):
(LayoutTestController::dumpProgressFinishedCallback):
(LayoutTestController::reset):
* DumpRenderTree/chromium/LayoutTestController.h:
(LayoutTestController::shouldDumpProgressFinishedCallback):
(LayoutTestController::setShouldDumpProgressFinishedCallback):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::didStopLoading):
* DumpRenderTree/gtk/DumpRenderTree.cpp:
(webViewLoadFinished):
(topLoadingFrameLoadFinished):
(webFrameLoadStatusNotified):
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::reset):
(LayoutTestController::dumpProgressFinishedCallback):
* DumpRenderTree/qt/LayoutTestControllerQt.h:

LayoutTests:

Keep track of the order expected for the progressFinishedNotification, which is
before the didFinishLoadForFrame.

* http/tests/loading/progress-finished-callback-expected.txt: Added.
* http/tests/loading/progress-finished-callback.html: Added.
* platform/mac/Skipped:
* platform/win/Skipped:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@94105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

21 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/loading/progress-finished-callback-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/loading/progress-finished-callback.html [new file with mode: 0644]
LayoutTests/platform/mac/Skipped
LayoutTests/platform/win/Skipped
Source/WebCore/ChangeLog
Source/WebCore/loader/FrameLoader.cpp
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h
Tools/ChangeLog
Tools/DumpRenderTree/LayoutTestController.cpp
Tools/DumpRenderTree/LayoutTestController.h
Tools/DumpRenderTree/chromium/LayoutTestController.cpp
Tools/DumpRenderTree/chromium/LayoutTestController.h
Tools/DumpRenderTree/chromium/WebViewHost.cpp
Tools/DumpRenderTree/gtk/DumpRenderTree.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
Tools/DumpRenderTree/qt/LayoutTestControllerQt.h

index c2d9f26..f1e6ace 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Emit last progress notification before calling dispatchDidFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=28851
+
+        Reviewed by Adam Barth.
+
+        Keep track of the order expected for the progressFinishedNotification, which is
+        before the didFinishLoadForFrame.
+
+        * http/tests/loading/progress-finished-callback-expected.txt: Added.
+        * http/tests/loading/progress-finished-callback.html: Added.
+        * platform/mac/Skipped:
+        * platform/win/Skipped:
+
 2011-08-30  Ojan Vafai  <ojan@chromium.org>
 
         CSS parsing for -webkit-flex-flow
diff --git a/LayoutTests/http/tests/loading/progress-finished-callback-expected.txt b/LayoutTests/http/tests/loading/progress-finished-callback-expected.txt
new file mode 100644 (file)
index 0000000..71ceefb
--- /dev/null
@@ -0,0 +1,7 @@
+main frame - didStartProvisionalLoadForFrame
+main frame - didCommitLoadForFrame
+main frame - didFinishDocumentLoadForFrame
+main frame - didHandleOnloadEventsForFrame
+postProgressFinishedNotification
+main frame - didFinishLoadForFrame
+This is a test of progress finished callback ordering in relation to frame loader callbacks. It is only useful inside the regression test tool.
diff --git a/LayoutTests/http/tests/loading/progress-finished-callback.html b/LayoutTests/http/tests/loading/progress-finished-callback.html
new file mode 100644 (file)
index 0000000..7cf0b7e
--- /dev/null
@@ -0,0 +1,7 @@
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.dumpProgressFinishedCallback();
+}
+</script>
+This is a test of progress finished callback ordering in relation to frame loader callbacks. It is only useful inside the regression test tool.
index 26692ed..ef7303e 100644 (file)
@@ -412,3 +412,6 @@ fast/harness/sample-fail-mismatch-reftest.html
 # https://bugs.webkit.org/show_bug.cgi?id=66783
 # Makes subsequent test crash
 fast/loader/document-destruction-within-unload.html
+
+# https://bugs.webkit.org/show_bug.cgi?id=66772
+http/tests/loading/progress-finished-callback.html
index 778cd35..b849622 100644 (file)
@@ -1401,3 +1401,6 @@ editing/selection/caret-at-bidi-boundary.html
 
 # Need DRT change: https://bugs.webkit.org/show_bug.cgi?id=66620
 editing/spelling/spelling-insert-html.html
+
+# https://bugs.webkit.org/show_bug.cgi?id=66773
+http/tests/loading/progress-finished-callback.html
index b0cfcc8..ef03fb9 100644 (file)
@@ -1,3 +1,18 @@
+2011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Emit last progress notification before calling dispatchDidFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=28851
+
+        Reviewed by Adam Barth.
+
+        Original patch by Xan Lopez. Change FrameLoader to dispatch the notifications in
+        a more natural sequence.
+
+        Test: http/tests/loading/progress-finished-callback.html
+
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+
 2011-08-30  Ojan Vafai  <ojan@chromium.org>
 
         CSS parsing for -webkit-flex-flow
index 4f0f1f3..19b1e8c 100644 (file)
@@ -2292,14 +2292,15 @@ void FrameLoader::checkLoadCompleteForThisFrame()
             if (m_stateMachine.creatingInitialEmptyDocument() || !m_stateMachine.committedFirstRealDocumentLoad())
                 return;
 
+            if (Page* page = m_frame->page())
+                page->progress()->progressCompleted(m_frame);
+
             const ResourceError& error = dl->mainDocumentError();
             if (!error.isNull())
                 m_client->dispatchDidFailLoad(error);
             else
                 m_client->dispatchDidFinishLoad();
 
-            if (Page* page = m_frame->page())
-                page->progress()->progressCompleted(m_frame);
             return;
         }
         
index a4979bb..d32c42e 100644 (file)
@@ -1,3 +1,19 @@
+2011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Emit last progress notification before calling dispatchDidFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=28851
+
+        Reviewed by Adam Barth.
+
+        Add infrastructure to dump progressFinishedNotification callback in DRT.
+
+        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
+        (DumpRenderTreeSupportQt::dumpProgressFinishedCallback):
+        * WebCoreSupport/DumpRenderTreeSupportQt.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2011-08-30  Kaustubh Atrawalkar  <kaustubh@motorola.com>
 
         The unused ScrollView* argument can and should be removed from
index af86e22..f4a1596 100644 (file)
@@ -681,6 +681,11 @@ void DumpRenderTreeSupportQt::dumpFrameLoader(bool b)
     FrameLoaderClientQt::dumpFrameLoaderCallbacks = b;
 }
 
+void DumpRenderTreeSupportQt::dumpProgressFinishedCallback(bool b)
+{
+    FrameLoaderClientQt::dumpProgressFinishedCallback = b;
+}
+
 void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b)
 {
     FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = b;
index b0cff8a..5071837 100644 (file)
@@ -163,6 +163,7 @@ public:
     static QString plainText(const QVariant& rng);
 
     static void dumpFrameLoader(bool b);
+    static void dumpProgressFinishedCallback(bool);
     static void dumpUserGestureInFrameLoader(bool b);
     static void dumpResourceLoadCallbacks(bool b);
     static void dumpResourceResponseMIMETypes(bool b);
index 08b9cd0..92bdbde 100644 (file)
@@ -170,6 +170,7 @@ static QString drtDescriptionSuitableForTestResult(const RefPtr<WebCore::Node> n
 namespace WebCore {
 
 bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false;
+bool FrameLoaderClientQt::dumpProgressFinishedCallback = false;
 bool FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = false;
 bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false;
 bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false;
@@ -592,6 +593,9 @@ void FrameLoaderClientQt::postProgressEstimateChangedNotification()
 
 void FrameLoaderClientQt::postProgressFinishedNotification()
 {
+    if (dumpProgressFinishedCallback)
+        printf("postProgressFinishedNotification\n");
+
     // Send a mousemove event to:
     // (1) update the cursor to change according to whatever is underneath the mouse cursor right now;
     // (2) display the tool tip if the mouse hovers a node which has a tool tip.
index 6af852b..2244b26 100644 (file)
@@ -247,6 +247,7 @@ public:
     const KURL& lastRequestedUrl() const { return m_lastRequestedUrl; }
 
     static bool dumpFrameLoaderCallbacks;
+    static bool dumpProgressFinishedCallback;
     static bool dumpUserGestureInFrameLoaderCallbacks;
     static bool dumpResourceLoadCallbacks;
     static bool dumpResourceResponseMIMETypes;
index c64da99..e971406 100644 (file)
@@ -1,3 +1,45 @@
+2011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
+
+        Emit last progress notification before calling dispatchDidFinishLoad
+        https://bugs.webkit.org/show_bug.cgi?id=28851
+
+        Reviewed by Adam Barth.
+
+        Implement dumpProgressFinishedCallback() in the layoutTestController for Qt,
+        Chromium and GTK ports. The first two were simple changes.
+
+        Some refactoring was needed in GTK port to assure that the dumps are emitted
+        correctly and the processing after the page load finished is in the right place.
+
+        To detect the load finished, we use the callback for the "load-status" notifier
+        signal of the top loading frame. And we use the deprecated "load-finished" signal
+        for dumping (if enabled) the progress finished expected output.
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (dumpProgressFinishedCallbackCallback):
+        (LayoutTestController::staticFunctions):
+        * DumpRenderTree/LayoutTestController.h:
+        (LayoutTestController::dumpProgressFinishedCallback):
+        (LayoutTestController::setDumpProgressFinishedCallback):
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::LayoutTestController):
+        (LayoutTestController::dumpProgressFinishedCallback):
+        (LayoutTestController::reset):
+        * DumpRenderTree/chromium/LayoutTestController.h:
+        (LayoutTestController::shouldDumpProgressFinishedCallback):
+        (LayoutTestController::setShouldDumpProgressFinishedCallback):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::didStopLoading):
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (webViewLoadFinished):
+        (topLoadingFrameLoadFinished):
+        (webFrameLoadStatusNotified):
+        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
+        (LayoutTestController::reset):
+        (LayoutTestController::dumpProgressFinishedCallback):
+        * DumpRenderTree/qt/LayoutTestControllerQt.h:
+
 2011-08-30  Filip Pizlo  <fpizlo@apple.com>
 
         JavaScriptCore does not have a good mechanism for performance
index 9de075e..2e1bdb4 100644 (file)
@@ -56,6 +56,7 @@ LayoutTestController::LayoutTestController(const std::string& testPathOrURL, con
     , m_dumpDatabaseCallbacks(false)
     , m_dumpEditingCallbacks(false)
     , m_dumpFrameLoadCallbacks(false)
+    , m_dumpProgressFinishedCallback(false)
     , m_dumpUserGestureInFrameLoadCallbacks(false)
     , m_dumpHistoryDelegateCallbacks(false)
     , m_dumpResourceLoadCallbacks(false)
@@ -205,6 +206,13 @@ static JSValueRef dumpFrameLoadCallbacksCallback(JSContextRef context, JSObjectR
     return JSValueMakeUndefined(context);
 }
 
+static JSValueRef dumpProgressFinishedCallbackCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+    controller->setDumpProgressFinishedCallback(true);
+    return JSValueMakeUndefined(context);
+}
+
 static JSValueRef dumpUserGestureInFrameLoadCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
@@ -2297,6 +2305,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
         { "dumpDatabaseCallbacks", dumpDatabaseCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "dumpFrameLoadCallbacks", dumpFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+        { "dumpProgressFinishedCallback", dumpProgressFinishedCallbackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "dumpUserGestureInFrameLoadCallbacks", dumpUserGestureInFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },        
         { "dumpResourceLoadCallbacks", dumpResourceLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
         { "dumpResourceResponseMIMETypes", dumpResourceResponseMIMETypesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
index 9b76288..928cfc7 100644 (file)
@@ -181,6 +181,9 @@ public:
 
     bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
     void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; }
+
+    bool dumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
+    void setDumpProgressFinishedCallback(bool dumpProgressFinishedCallback) { m_dumpProgressFinishedCallback = dumpProgressFinishedCallback; }
     
     bool dumpUserGestureInFrameLoadCallbacks() const { return m_dumpUserGestureInFrameLoadCallbacks; }
     void setDumpUserGestureInFrameLoadCallbacks(bool dumpUserGestureInFrameLoadCallbacks) { m_dumpUserGestureInFrameLoadCallbacks = dumpUserGestureInFrameLoadCallbacks; }    
@@ -369,6 +372,7 @@ private:
     bool m_dumpDatabaseCallbacks;
     bool m_dumpEditingCallbacks;
     bool m_dumpFrameLoadCallbacks;
+    bool m_dumpProgressFinishedCallback;
     bool m_dumpUserGestureInFrameLoadCallbacks;
     bool m_dumpHistoryDelegateCallbacks;
     bool m_dumpResourceLoadCallbacks;
index ad23aab..84a5cbf 100644 (file)
@@ -102,6 +102,7 @@ LayoutTestController::LayoutTestController(TestShell* shell)
     bindMethod("dumpDatabaseCallbacks", &LayoutTestController::dumpDatabaseCallbacks);
     bindMethod("dumpEditingCallbacks", &LayoutTestController::dumpEditingCallbacks);
     bindMethod("dumpFrameLoadCallbacks", &LayoutTestController::dumpFrameLoadCallbacks);
+    bindMethod("dumpProgressFinishedCallback", &LayoutTestController::dumpProgressFinishedCallback);
     bindMethod("dumpUserGestureInFrameLoadCallbacks", &LayoutTestController::dumpUserGestureInFrameLoadCallbacks);
     bindMethod("dumpResourceLoadCallbacks", &LayoutTestController::dumpResourceLoadCallbacks);
     bindMethod("dumpResourceResponseMIMETypes", &LayoutTestController::dumpResourceResponseMIMETypes);
@@ -323,6 +324,12 @@ void LayoutTestController::dumpFrameLoadCallbacks(const CppArgumentList&, CppVar
     result->setNull();
 }
 
+void LayoutTestController::dumpProgressFinishedCallback(const CppArgumentList&, CppVariant* result)
+{
+    m_dumpProgressFinishedCallback = true;
+    result->setNull();
+}
+
 void LayoutTestController::dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant* result)
 {
     m_dumpUserGestureInFrameLoadCallbacks = true;
@@ -577,6 +584,7 @@ void LayoutTestController::reset()
     m_dumpAsAudio = false;
     m_dumpEditingCallbacks = false;
     m_dumpFrameLoadCallbacks = false;
+    m_dumpProgressFinishedCallback = false;
     m_dumpUserGestureInFrameLoadCallbacks = false;
     m_dumpResourceLoadCallbacks = false;
     m_dumpResourceResponseMIMETypes = false;
index b0e7199..65cbaa8 100644 (file)
@@ -94,6 +94,11 @@ public:
     void dumpFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
 
     // This function sets a flag that tells the test_shell to print a line of
+    // descriptive text for the progress finished callback. It takes no
+    // arguments, and ignores any that may be present.
+    void dumpProgressFinishedCallback(const CppArgumentList&, CppVariant*);
+
+    // This function sets a flag that tells the test_shell to print a line of
     // user gesture status text for some frame load callbacks. It takes no
     // arguments, and ignores any that may be present.
     void dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant*);
@@ -410,6 +415,8 @@ public:
     bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }
     bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
     void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
+    bool shouldDumpProgressFinishedCallback() { return m_dumpProgressFinishedCallback; }
+    void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
     bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
     void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
     bool shouldDumpResourceLoadCallbacks() {return m_dumpResourceLoadCallbacks; }
@@ -542,6 +549,10 @@ private:
     // load callback.
     bool m_dumpFrameLoadCallbacks;
 
+    // If true, the test_shell will output a descriptive line for the progress
+    // finished callback.
+    bool m_dumpProgressFinishedCallback;
+
     // If true, the test_shell will output a line of the user gesture status
     // text for some frame load callbacks.
     bool m_dumpUserGestureInFrameLoadCallbacks;
index 7dbecd8..b530670 100644 (file)
@@ -287,6 +287,8 @@ void WebViewHost::didStartLoading()
 
 void WebViewHost::didStopLoading()
 {
+    if (layoutTestController()->shouldDumpProgressFinishedCallback())
+        fputs("postProgressFinishedNotification\n", stdout);
     m_shell->setIsLoading(false);
 }
 
index 3b01cc8..53bdb8d 100644 (file)
@@ -777,18 +777,12 @@ static char* getFrameNameSuitableForTestResult(WebKitWebView* view, WebKitWebFra
 
 static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
 {
+    // The deprecated "load-finished" signal is triggered by postProgressFinishedNotification(),
+    // so we can use it here in the DRT to provide the correct dump.
     if (frame != topLoadingFrame)
         return;
-
-    topLoadingFrame = 0;
-    WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
-    if (gLayoutTestController->waitToDump())
-        return;
-
-    if (WorkQueue::shared()->count())
-        g_timeout_add(0, processWork, 0);
-    else
-        dump();
+    if (gLayoutTestController->dumpProgressFinishedCallback())
+        printf("postProgressFinishedNotification\n");
 }
 
 static gboolean webViewLoadError(WebKitWebView*, WebKitWebFrame*, gchar*, gpointer, gpointer)
@@ -1022,6 +1016,19 @@ static WebKitWebView* webInspectorInspectWebView(WebKitWebInspector*, gpointer d
     return WEBKIT_WEB_VIEW(webView);
 }
 
+static void topLoadingFrameLoadFinished()
+{
+    topLoadingFrame = 0;
+    WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
+    if (gLayoutTestController->waitToDump())
+        return;
+
+    if (WorkQueue::shared()->count())
+        g_timeout_add(0, processWork, 0);
+    else
+        dump();
+}
+
 static void webFrameLoadStatusNotified(WebKitWebFrame* frame, gpointer user_data)
 {
     WebKitLoadStatus loadStatus = webkit_web_frame_get_load_status(frame);
@@ -1039,13 +1046,17 @@ static void webFrameLoadStatusNotified(WebKitWebFrame* frame, gpointer user_data
                 printf("%s - didCommitLoadForFrame\n", frameName.get());
             break;
         case WEBKIT_LOAD_FINISHED:
-            if (frame != topLoadingFrame || !done)
+            if (!done)
                 printf("%s - didFinishLoadForFrame\n", frameName.get());
             break;
         default:
             break;
         }
     }
+
+    if ((loadStatus == WEBKIT_LOAD_FINISHED || loadStatus == WEBKIT_LOAD_FAILED)
+        && frame == topLoadingFrame)
+        topLoadingFrameLoadFinished();
 }
 
 static void frameCreatedCallback(WebKitWebView* webView, WebKitWebFrame* webFrame, gpointer user_data)
index 244a94a..f4615ab 100644 (file)
@@ -76,6 +76,7 @@ void LayoutTestController::reset()
 
     DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
     DumpRenderTreeSupportQt::dumpFrameLoader(false);
+    DumpRenderTreeSupportQt::dumpProgressFinishedCallback(false);
     DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(false);
     DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false);
     DumpRenderTreeSupportQt::dumpResourceResponseMIMETypes(false);
@@ -261,6 +262,11 @@ void LayoutTestController::dumpFrameLoadCallbacks()
     DumpRenderTreeSupportQt::dumpFrameLoader(true);
 }
 
+void LayoutTestController::dumpProgressFinishedCallback()
+{
+    DumpRenderTreeSupportQt::dumpProgressFinishedCallback(true);
+}
+
 void LayoutTestController::dumpUserGestureInFrameLoadCallbacks()
 {
     DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(true);
index 2053920..15fd8fc 100644 (file)
@@ -112,6 +112,7 @@ public slots:
     void handleErrorPages() { m_handleErrorPages = true; }
     void dumpEditingCallbacks();
     void dumpFrameLoadCallbacks();
+    void dumpProgressFinishedCallback();
     void dumpUserGestureInFrameLoadCallbacks();
     void dumpResourceLoadCallbacks();
     void dumpResourceResponseMIMETypes();