Changeset 94105 in webkit


Ignore:
Timestamp:
Aug 30, 2011 1:42:46 PM (13 years ago)
Author:
caio.oliveira@openbossa.org
Message:

Emit last progress notification before calling dispatchDidFinishLoad
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:
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r94104 r94105  
     12011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Emit last progress notification before calling dispatchDidFinishLoad
     4        https://bugs.webkit.org/show_bug.cgi?id=28851
     5
     6        Reviewed by Adam Barth.
     7
     8        Keep track of the order expected for the progressFinishedNotification, which is
     9        before the didFinishLoadForFrame.
     10
     11        * http/tests/loading/progress-finished-callback-expected.txt: Added.
     12        * http/tests/loading/progress-finished-callback.html: Added.
     13        * platform/mac/Skipped:
     14        * platform/win/Skipped:
     15
    1162011-08-30  Ojan Vafai  <ojan@chromium.org>
    217
  • trunk/LayoutTests/platform/mac/Skipped

    r94099 r94105  
    413413# Makes subsequent test crash
    414414fast/loader/document-destruction-within-unload.html
     415
     416# https://bugs.webkit.org/show_bug.cgi?id=66772
     417http/tests/loading/progress-finished-callback.html
  • trunk/LayoutTests/platform/win/Skipped

    r94046 r94105  
    14021402# Need DRT change: https://bugs.webkit.org/show_bug.cgi?id=66620
    14031403editing/spelling/spelling-insert-html.html
     1404
     1405# https://bugs.webkit.org/show_bug.cgi?id=66773
     1406http/tests/loading/progress-finished-callback.html
  • trunk/Source/WebCore/ChangeLog

    r94104 r94105  
     12011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Emit last progress notification before calling dispatchDidFinishLoad
     4        https://bugs.webkit.org/show_bug.cgi?id=28851
     5
     6        Reviewed by Adam Barth.
     7
     8        Original patch by Xan Lopez. Change FrameLoader to dispatch the notifications in
     9        a more natural sequence.
     10
     11        Test: http/tests/loading/progress-finished-callback.html
     12
     13        * loader/FrameLoader.cpp:
     14        (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
     15
    1162011-08-30  Ojan Vafai  <ojan@chromium.org>
    217
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r93521 r94105  
    22932293                return;
    22942294
     2295            if (Page* page = m_frame->page())
     2296                page->progress()->progressCompleted(m_frame);
     2297
    22952298            const ResourceError& error = dl->mainDocumentError();
    22962299            if (!error.isNull())
     
    22992302                m_client->dispatchDidFinishLoad();
    23002303
    2301             if (Page* page = m_frame->page())
    2302                 page->progress()->progressCompleted(m_frame);
    23032304            return;
    23042305        }
  • trunk/Source/WebKit/qt/ChangeLog

    r94080 r94105  
     12011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Emit last progress notification before calling dispatchDidFinishLoad
     4        https://bugs.webkit.org/show_bug.cgi?id=28851
     5
     6        Reviewed by Adam Barth.
     7
     8        Add infrastructure to dump progressFinishedNotification callback in DRT.
     9
     10        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     11        (DumpRenderTreeSupportQt::dumpProgressFinishedCallback):
     12        * WebCoreSupport/DumpRenderTreeSupportQt.h:
     13        * WebCoreSupport/FrameLoaderClientQt.cpp:
     14        (WebCore::FrameLoaderClientQt::postProgressFinishedNotification):
     15        * WebCoreSupport/FrameLoaderClientQt.h:
     16
    1172011-08-30  Kaustubh Atrawalkar  <kaustubh@motorola.com>
    218
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r93235 r94105  
    682682}
    683683
     684void DumpRenderTreeSupportQt::dumpProgressFinishedCallback(bool b)
     685{
     686    FrameLoaderClientQt::dumpProgressFinishedCallback = b;
     687}
     688
    684689void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b)
    685690{
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h

    r93235 r94105  
    164164
    165165    static void dumpFrameLoader(bool b);
     166    static void dumpProgressFinishedCallback(bool);
    166167    static void dumpUserGestureInFrameLoader(bool b);
    167168    static void dumpResourceLoadCallbacks(bool b);
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r93066 r94105  
    171171
    172172bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false;
     173bool FrameLoaderClientQt::dumpProgressFinishedCallback = false;
    173174bool FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = false;
    174175bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false;
     
    593594void FrameLoaderClientQt::postProgressFinishedNotification()
    594595{
     596    if (dumpProgressFinishedCallback)
     597        printf("postProgressFinishedNotification\n");
     598
    595599    // Send a mousemove event to:
    596600    // (1) update the cursor to change according to whatever is underneath the mouse cursor right now;
  • trunk/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h

    r93066 r94105  
    248248
    249249    static bool dumpFrameLoaderCallbacks;
     250    static bool dumpProgressFinishedCallback;
    250251    static bool dumpUserGestureInFrameLoaderCallbacks;
    251252    static bool dumpResourceLoadCallbacks;
  • trunk/Tools/ChangeLog

    r94103 r94105  
     12011-08-30  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>
     2
     3        Emit last progress notification before calling dispatchDidFinishLoad
     4        https://bugs.webkit.org/show_bug.cgi?id=28851
     5
     6        Reviewed by Adam Barth.
     7
     8        Implement dumpProgressFinishedCallback() in the layoutTestController for Qt,
     9        Chromium and GTK ports. The first two were simple changes.
     10
     11        Some refactoring was needed in GTK port to assure that the dumps are emitted
     12        correctly and the processing after the page load finished is in the right place.
     13
     14        To detect the load finished, we use the callback for the "load-status" notifier
     15        signal of the top loading frame. And we use the deprecated "load-finished" signal
     16        for dumping (if enabled) the progress finished expected output.
     17
     18        * DumpRenderTree/LayoutTestController.cpp:
     19        (LayoutTestController::LayoutTestController):
     20        (dumpProgressFinishedCallbackCallback):
     21        (LayoutTestController::staticFunctions):
     22        * DumpRenderTree/LayoutTestController.h:
     23        (LayoutTestController::dumpProgressFinishedCallback):
     24        (LayoutTestController::setDumpProgressFinishedCallback):
     25        * DumpRenderTree/chromium/LayoutTestController.cpp:
     26        (LayoutTestController::LayoutTestController):
     27        (LayoutTestController::dumpProgressFinishedCallback):
     28        (LayoutTestController::reset):
     29        * DumpRenderTree/chromium/LayoutTestController.h:
     30        (LayoutTestController::shouldDumpProgressFinishedCallback):
     31        (LayoutTestController::setShouldDumpProgressFinishedCallback):
     32        * DumpRenderTree/chromium/WebViewHost.cpp:
     33        (WebViewHost::didStopLoading):
     34        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     35        (webViewLoadFinished):
     36        (topLoadingFrameLoadFinished):
     37        (webFrameLoadStatusNotified):
     38        * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
     39        (LayoutTestController::reset):
     40        (LayoutTestController::dumpProgressFinishedCallback):
     41        * DumpRenderTree/qt/LayoutTestControllerQt.h:
     42
    1432011-08-30  Filip Pizlo  <fpizlo@apple.com>
    244
  • trunk/Tools/DumpRenderTree/LayoutTestController.cpp

    r93319 r94105  
    5757    , m_dumpEditingCallbacks(false)
    5858    , m_dumpFrameLoadCallbacks(false)
     59    , m_dumpProgressFinishedCallback(false)
    5960    , m_dumpUserGestureInFrameLoadCallbacks(false)
    6061    , m_dumpHistoryDelegateCallbacks(false)
     
    203204    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
    204205    controller->setDumpFrameLoadCallbacks(true);
     206    return JSValueMakeUndefined(context);
     207}
     208
     209static JSValueRef dumpProgressFinishedCallbackCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     210{
     211    LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     212    controller->setDumpProgressFinishedCallback(true);
    205213    return JSValueMakeUndefined(context);
    206214}
     
    22982306        { "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    22992307        { "dumpFrameLoadCallbacks", dumpFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     2308        { "dumpProgressFinishedCallback", dumpProgressFinishedCallbackCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    23002309        { "dumpUserGestureInFrameLoadCallbacks", dumpUserGestureInFrameLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },       
    23012310        { "dumpResourceLoadCallbacks", dumpResourceLoadCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/Tools/DumpRenderTree/LayoutTestController.h

    r92982 r94105  
    182182    bool dumpFrameLoadCallbacks() const { return m_dumpFrameLoadCallbacks; }
    183183    void setDumpFrameLoadCallbacks(bool dumpFrameLoadCallbacks) { m_dumpFrameLoadCallbacks = dumpFrameLoadCallbacks; }
     184
     185    bool dumpProgressFinishedCallback() const { return m_dumpProgressFinishedCallback; }
     186    void setDumpProgressFinishedCallback(bool dumpProgressFinishedCallback) { m_dumpProgressFinishedCallback = dumpProgressFinishedCallback; }
    184187   
    185188    bool dumpUserGestureInFrameLoadCallbacks() const { return m_dumpUserGestureInFrameLoadCallbacks; }
     
    370373    bool m_dumpEditingCallbacks;
    371374    bool m_dumpFrameLoadCallbacks;
     375    bool m_dumpProgressFinishedCallback;
    372376    bool m_dumpUserGestureInFrameLoadCallbacks;
    373377    bool m_dumpHistoryDelegateCallbacks;
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp

    r93681 r94105  
    103103    bindMethod("dumpEditingCallbacks", &LayoutTestController::dumpEditingCallbacks);
    104104    bindMethod("dumpFrameLoadCallbacks", &LayoutTestController::dumpFrameLoadCallbacks);
     105    bindMethod("dumpProgressFinishedCallback", &LayoutTestController::dumpProgressFinishedCallback);
    105106    bindMethod("dumpUserGestureInFrameLoadCallbacks", &LayoutTestController::dumpUserGestureInFrameLoadCallbacks);
    106107    bindMethod("dumpResourceLoadCallbacks", &LayoutTestController::dumpResourceLoadCallbacks);
     
    324325}
    325326
     327void LayoutTestController::dumpProgressFinishedCallback(const CppArgumentList&, CppVariant* result)
     328{
     329    m_dumpProgressFinishedCallback = true;
     330    result->setNull();
     331}
     332
    326333void LayoutTestController::dumpUserGestureInFrameLoadCallbacks(const CppArgumentList&, CppVariant* result)
    327334{
     
    578585    m_dumpEditingCallbacks = false;
    579586    m_dumpFrameLoadCallbacks = false;
     587    m_dumpProgressFinishedCallback = false;
    580588    m_dumpUserGestureInFrameLoadCallbacks = false;
    581589    m_dumpResourceLoadCallbacks = false;
  • trunk/Tools/DumpRenderTree/chromium/LayoutTestController.h

    r93681 r94105  
    9595
    9696    // This function sets a flag that tells the test_shell to print a line of
     97    // descriptive text for the progress finished callback. It takes no
     98    // arguments, and ignores any that may be present.
     99    void dumpProgressFinishedCallback(const CppArgumentList&, CppVariant*);
     100
     101    // This function sets a flag that tells the test_shell to print a line of
    97102    // user gesture status text for some frame load callbacks. It takes no
    98103    // arguments, and ignores any that may be present.
     
    411416    bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; }
    412417    void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; }
     418    bool shouldDumpProgressFinishedCallback() { return m_dumpProgressFinishedCallback; }
     419    void setShouldDumpProgressFinishedCallback(bool value) { m_dumpProgressFinishedCallback = value; }
    413420    bool shouldDumpUserGestureInFrameLoadCallbacks() { return m_dumpUserGestureInFrameLoadCallbacks; }
    414421    void setShouldDumpUserGestureInFrameLoadCallbacks(bool value) { m_dumpUserGestureInFrameLoadCallbacks = value; }
     
    543550    bool m_dumpFrameLoadCallbacks;
    544551
     552    // If true, the test_shell will output a descriptive line for the progress
     553    // finished callback.
     554    bool m_dumpProgressFinishedCallback;
     555
    545556    // If true, the test_shell will output a line of the user gesture status
    546557    // text for some frame load callbacks.
  • trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp

    r92982 r94105  
    288288void WebViewHost::didStopLoading()
    289289{
     290    if (layoutTestController()->shouldDumpProgressFinishedCallback())
     291        fputs("postProgressFinishedNotification\n", stdout);
    290292    m_shell->setIsLoading(false);
    291293}
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r93338 r94105  
    778778static void webViewLoadFinished(WebKitWebView* view, WebKitWebFrame* frame, void*)
    779779{
     780    // The deprecated "load-finished" signal is triggered by postProgressFinishedNotification(),
     781    // so we can use it here in the DRT to provide the correct dump.
    780782    if (frame != topLoadingFrame)
    781783        return;
    782 
    783     topLoadingFrame = 0;
    784     WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
    785     if (gLayoutTestController->waitToDump())
    786         return;
    787 
    788     if (WorkQueue::shared()->count())
    789         g_timeout_add(0, processWork, 0);
    790     else
    791         dump();
     784    if (gLayoutTestController->dumpProgressFinishedCallback())
     785        printf("postProgressFinishedNotification\n");
    792786}
    793787
     
    10231017}
    10241018
     1019static void topLoadingFrameLoadFinished()
     1020{
     1021    topLoadingFrame = 0;
     1022    WorkQueue::shared()->setFrozen(true); // first complete load freezes the queue for the rest of this test
     1023    if (gLayoutTestController->waitToDump())
     1024        return;
     1025
     1026    if (WorkQueue::shared()->count())
     1027        g_timeout_add(0, processWork, 0);
     1028    else
     1029        dump();
     1030}
     1031
    10251032static void webFrameLoadStatusNotified(WebKitWebFrame* frame, gpointer user_data)
    10261033{
     
    10401047            break;
    10411048        case WEBKIT_LOAD_FINISHED:
    1042             if (frame != topLoadingFrame || !done)
     1049            if (!done)
    10431050                printf("%s - didFinishLoadForFrame\n", frameName.get());
    10441051            break;
     
    10471054        }
    10481055    }
     1056
     1057    if ((loadStatus == WEBKIT_LOAD_FINISHED || loadStatus == WEBKIT_LOAD_FAILED)
     1058        && frame == topLoadingFrame)
     1059        topLoadingFrameLoadFinished();
    10491060}
    10501061
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp

    r90856 r94105  
    7777    DumpRenderTreeSupportQt::dumpEditingCallbacks(false);
    7878    DumpRenderTreeSupportQt::dumpFrameLoader(false);
     79    DumpRenderTreeSupportQt::dumpProgressFinishedCallback(false);
    7980    DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(false);
    8081    DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(false);
     
    260261{
    261262    DumpRenderTreeSupportQt::dumpFrameLoader(true);
     263}
     264
     265void LayoutTestController::dumpProgressFinishedCallback()
     266{
     267    DumpRenderTreeSupportQt::dumpProgressFinishedCallback(true);
    262268}
    263269
  • trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h

    r90856 r94105  
    113113    void dumpEditingCallbacks();
    114114    void dumpFrameLoadCallbacks();
     115    void dumpProgressFinishedCallback();
    115116    void dumpUserGestureInFrameLoadCallbacks();
    116117    void dumpResourceLoadCallbacks();
Note: See TracChangeset for help on using the changeset viewer.