Changeset 32543

Show
Ignore:
Timestamp:
04/25/08 00:53:18 (23 months ago)
Author:
hausmann@webkit.org
Message:

Holger Hans Peter Freyther < zecke@selfish.org>

Implement dumping of resource load callbacks to pass http/tests/xmlhttprequest/abort-should-cancel-load.html

Similar to Editing and Frameloading we do the dumping within WebCore

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/ChangeLog

    r32498 r32543  
     12008-04-25  Holger Hans Peter Freyther  <zecke@selfish.org> 
     2 
     3        Reviewed by Simon. 
     4 
     5        Implement dumping of resource load callbacks to pass http/tests/xmlhttprequest/abort-should-cancel-load.html 
     6         
     7        Similar to Editing and Frameloading we do the dumping within WebCore 
     8         
     9 
     10        * WebCoreSupport/FrameLoaderClientQt.cpp: 
     11        (qt_dump_frame_loader): 
     12        (qt_dump_resource_load_callbacks): 
     13        (drtDescriptionSuitableForTestResult): 
     14        (WebCore::FrameLoaderClientQt::dispatchDidFailLoading): 
     15        (WebCore::FrameLoaderClientQt::dispatchDidLoadResourceFromMemoryCache): 
     16        (WebCore::FrameLoaderClientQt::dispatchDecidePolicyForMIMEType): 
     17 
    1182008-04-24  Anders Carlsson  <andersca@apple.com> 
    219 
  • trunk/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp

    r32479 r32543  
    6767 
    6868static bool dumpFrameLoaderCallbacks = false; 
     69static bool dumpResourceLoadCallbacks = false; 
     70 
     71static QMap<unsigned long, QString> dumpAssignedUrls; 
    6972 
    7073void QWEBKIT_EXPORT qt_dump_frame_loader(bool b) 
    7174{ 
    7275    dumpFrameLoaderCallbacks = b; 
     76} 
     77 
     78void QWEBKIT_EXPORT qt_dump_resource_load_callbacks(bool b) 
     79{ 
     80    dumpResourceLoadCallbacks = b; 
    7381} 
    7482 
     
    95103    QUrl url = _url; 
    96104    return url.toString(); 
     105} 
     106 
     107static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceError& error) 
     108{ 
     109    QString failingURL = error.failingURL(); 
     110    return QString::fromLatin1("<NSError domain NSURLErrorDomain, code %1, failing URL \"%2\">").arg(error.errorCode()).arg(failingURL); 
     111} 
     112 
     113static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceRequest& request) 
     114{ 
     115    QString url = request.url().string(); 
     116    return QString::fromLatin1("<NSURLRequest %1>").arg(url); 
     117} 
     118 
     119static QString drtDescriptionSuitableForTestResult(const WebCore::ResourceResponse& response) 
     120{ 
     121    QString text = response.httpStatusText(); 
     122    if (text.isEmpty()) 
     123        return QLatin1String("(null)"); 
     124 
     125    return text; 
    97126} 
    98127 
     
    700729} 
    701730 
    702 void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader*, const WebCore::ResourceRequest&) 
    703 { 
    704 } 
    705  
    706 void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long, WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response) 
    707 { 
     731void FrameLoaderClientQt::assignIdentifierToInitialRequest(unsigned long identifier, WebCore::DocumentLoader* loader, const WebCore::ResourceRequest& request) 
     732{ 
     733    if (dumpResourceLoadCallbacks) 
     734        dumpAssignedUrls[identifier] = drtDescriptionSuitableForTestResult(request.url()); 
     735} 
     736 
     737void FrameLoaderClientQt::dispatchWillSendRequest(WebCore::DocumentLoader*, unsigned long identifier, WebCore::ResourceRequest& newRequest, const WebCore::ResourceResponse& redirectResponse) 
     738{ 
     739    if (dumpResourceLoadCallbacks) 
     740        printf("%s - willSendRequest %s redirectResponse %s\n", 
     741               qPrintable(dumpAssignedUrls[identifier]), 
     742               qPrintable(drtDescriptionSuitableForTestResult(newRequest)), 
     743               qPrintable(drtDescriptionSuitableForTestResult(redirectResponse))); 
     744 
    708745    // seems like the Mac code doesn't do anything here by default neither 
    709746    //qDebug() << "FrameLoaderClientQt::dispatchWillSendRequest" << request.isNull() << request.url().string`(); 
     
    736773} 
    737774 
    738 void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long, const WebCore::ResourceError&) 
    739 { 
     775void FrameLoaderClientQt::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const WebCore::ResourceError& error) 
     776{ 
     777    if (dumpResourceLoadCallbacks) 
     778        printf("%s - didFailLoadingWithError: %s\n", qPrintable(dumpAssignedUrls[identifier]), qPrintable(drtDescriptionSuitableForTestResult(error))); 
     779 
    740780    if (m_firstData) { 
    741781        FrameLoader *fl = loader->frameLoader(); 
  • trunk/WebKitTools/ChangeLog

    r32527 r32543  
     12008-04-25  Holger Hans Peter Freyther  <zecke@selfish.org> 
     2 
     3        Reviewed by Simon. 
     4 
     5        Implement dumping of resource load callbacks to pass http/tests/xmlhttprequest/abort-should-cancel-load.html 
     6         
     7        Similar to Editing and Frameloading we do the dumping within WebCore 
     8         
     9 
     10        * DumpRenderTree/qt/jsobjects.cpp: 
     11        (LayoutTestController::dumpResourceLoadCallbacks): 
     12        * DumpRenderTree/qt/jsobjects.h: 
     13 
    1142008-04-24  Jan Michael Alonzo  <jmalonzo@unpluggable.com> 
    215 
  • trunk/WebKitTools/DumpRenderTree/qt/jsobjects.cpp

    r29729 r32543  
    3636#include "DumpRenderTree.h" 
    3737extern void qt_dump_editing_callbacks(bool b); 
     38extern void qt_dump_resource_load_callbacks(bool b); 
    3839 
    3940LayoutTestController::LayoutTestController(WebCore::DumpRenderTree *drt) 
     
    108109    qDebug() << ">>>dumpEditingCallbacks"; 
    109110    qt_dump_editing_callbacks(true); 
     111} 
     112 
     113void LayoutTestController::dumpResourceLoadCallbacks() 
     114{ 
     115    qt_dump_resource_load_callbacks(true); 
    110116} 
    111117 
  • trunk/WebKitTools/DumpRenderTree/qt/jsobjects.h

    r29729 r32543  
    6969    void notifyDone(); 
    7070    void dumpEditingCallbacks(); 
     71    void dumpResourceLoadCallbacks(); 
    7172    void queueReload(); 
    7273    void provisionalLoad();