Changeset 89163 in webkit


Ignore:
Timestamp:
Jun 17, 2011 1:00:33 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-17 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Network panel does not show main resource content for iframes deleted from the document
https://bugs.webkit.org/show_bug.cgi?id=62810

  • http/tests/inspector/network/network-iframe-load-and-delete-expected.txt: Added.
  • http/tests/inspector/network/network-iframe-load-and-delete.html: Added.

2011-06-17 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Network panel does not show main resource content for iframes deleted from the document
https://bugs.webkit.org/show_bug.cgi?id=62810

Test: http/tests/inspector/network/network-iframe-load-and-delete.html

  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didFinishLoadingImpl): (WebCore::InspectorInstrumentation::didFailLoadingImpl):
  • inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading):
  • inspector/InspectorPageAgent.cpp: (WebCore::cachedResourceContent): (WebCore::mainResourceContent): (WebCore::InspectorPageAgent::sharedBufferContent): (WebCore::InspectorPageAgent::resourceContent): (WebCore::InspectorPageAgent::getResourceContent): (WebCore::InspectorPageAgent::searchInResources):
  • inspector/InspectorPageAgent.h:
  • inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::didFinishLoading): (WebCore::InspectorResourceAgent::didFailLoading): (WebCore::InspectorResourceAgent::didReceiveXHRResponse): (WebCore::InspectorResourceAgent::getResourceContent):
  • inspector/InspectorResourceAgent.h:
  • inspector/InspectorStyleSheet.cpp: (WebCore::InspectorStyleSheet::resourceStyleSheetText):
  • inspector/NetworkResourcesData.cpp: (WebCore::NetworkResourcesData::ResourceData::ResourceData): (WebCore::NetworkResourcesData::setResourceType): (WebCore::NetworkResourcesData::resourceType): (WebCore::NetworkResourcesData::addResourceSharedBuffer):
  • inspector/NetworkResourcesData.h: (WebCore::NetworkResourcesData::ResourceData::type): (WebCore::NetworkResourcesData::ResourceData::setType): (WebCore::NetworkResourcesData::ResourceData::buffer): (WebCore::NetworkResourcesData::ResourceData::setBuffer): (WebCore::NetworkResourcesData::ResourceData::textEncodingName): (WebCore::NetworkResourcesData::ResourceData::setTextEncodingName):
  • loader/ResourceLoadNotifier.cpp: (WebCore::ResourceLoadNotifier::didFailToLoad): (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
  • loader/appcache/ApplicationCacheGroup.cpp: (WebCore::ApplicationCacheGroup::didFinishLoading): (WebCore::ApplicationCacheGroup::didFail):
Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89162 r89163  
     12011-06-17  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Network panel does not show main resource content for iframes deleted from the document
     6        https://bugs.webkit.org/show_bug.cgi?id=62810
     7
     8        * http/tests/inspector/network/network-iframe-load-and-delete-expected.txt: Added.
     9        * http/tests/inspector/network/network-iframe-load-and-delete.html: Added.
     10
    1112011-06-17  Ryosuke Niwa  <rniwa@webkit.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r89157 r89163  
     12011-06-17  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Network panel does not show main resource content for iframes deleted from the document
     6        https://bugs.webkit.org/show_bug.cgi?id=62810
     7
     8        Test: http/tests/inspector/network/network-iframe-load-and-delete.html
     9
     10        * inspector/InspectorInstrumentation.cpp:
     11        (WebCore::InspectorInstrumentation::didFinishLoadingImpl):
     12        (WebCore::InspectorInstrumentation::didFailLoadingImpl):
     13        * inspector/InspectorInstrumentation.h:
     14        (WebCore::InspectorInstrumentation::didFinishLoading):
     15        (WebCore::InspectorInstrumentation::didFailLoading):
     16        * inspector/InspectorPageAgent.cpp:
     17        (WebCore::cachedResourceContent):
     18        (WebCore::mainResourceContent):
     19        (WebCore::InspectorPageAgent::sharedBufferContent):
     20        (WebCore::InspectorPageAgent::resourceContent):
     21        (WebCore::InspectorPageAgent::getResourceContent):
     22        (WebCore::InspectorPageAgent::searchInResources):
     23        * inspector/InspectorPageAgent.h:
     24        * inspector/InspectorResourceAgent.cpp:
     25        (WebCore::InspectorResourceAgent::didReceiveResponse):
     26        (WebCore::InspectorResourceAgent::didFinishLoading):
     27        (WebCore::InspectorResourceAgent::didFailLoading):
     28        (WebCore::InspectorResourceAgent::didReceiveXHRResponse):
     29        (WebCore::InspectorResourceAgent::getResourceContent):
     30        * inspector/InspectorResourceAgent.h:
     31        * inspector/InspectorStyleSheet.cpp:
     32        (WebCore::InspectorStyleSheet::resourceStyleSheetText):
     33        * inspector/NetworkResourcesData.cpp:
     34        (WebCore::NetworkResourcesData::ResourceData::ResourceData):
     35        (WebCore::NetworkResourcesData::setResourceType):
     36        (WebCore::NetworkResourcesData::resourceType):
     37        (WebCore::NetworkResourcesData::addResourceSharedBuffer):
     38        * inspector/NetworkResourcesData.h:
     39        (WebCore::NetworkResourcesData::ResourceData::type):
     40        (WebCore::NetworkResourcesData::ResourceData::setType):
     41        (WebCore::NetworkResourcesData::ResourceData::buffer):
     42        (WebCore::NetworkResourcesData::ResourceData::setBuffer):
     43        (WebCore::NetworkResourcesData::ResourceData::textEncodingName):
     44        (WebCore::NetworkResourcesData::ResourceData::setTextEncodingName):
     45        * loader/ResourceLoadNotifier.cpp:
     46        (WebCore::ResourceLoadNotifier::didFailToLoad):
     47        (WebCore::ResourceLoadNotifier::dispatchDidFinishLoading):
     48        * loader/appcache/ApplicationCacheGroup.cpp:
     49        (WebCore::ApplicationCacheGroup::didFinishLoading):
     50        (WebCore::ApplicationCacheGroup::didFail):
     51
    1522011-06-17  Darin Adler  <darin@apple.com>
    253
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r89036 r89163  
    491491}
    492492
    493 void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, double finishTime)
     493void InspectorInstrumentation::didFinishLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, double finishTime)
    494494{
    495495    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    496496        timelineAgent->didFinishLoadingResource(identifier, false, finishTime);
    497497    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    498         resourceAgent->didFinishLoading(identifier, finishTime);
    499 }
    500 
    501 void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const ResourceError& error)
     498        resourceAgent->didFinishLoading(identifier, loader, finishTime);
     499}
     500
     501void InspectorInstrumentation::didFailLoadingImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
    502502{
    503503    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
    504504        timelineAgent->didFinishLoadingResource(identifier, true, 0);
    505505    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
    506         resourceAgent->didFailLoading(identifier, error);
     506        resourceAgent->didFailLoading(identifier, loader, error);
    507507    if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
    508508        consoleAgent->didFailLoading(identifier, error); // This should come AFTER resource notification, front-end relies on this.
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r89036 r89163  
    126126    static void continueWithPolicyIgnore(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
    127127    static void didReceiveContentLength(Frame*, unsigned long identifier, int dataLength, int encodedDataLength);
    128     static void didFinishLoading(Frame*, unsigned long identifier, double finishTime);
    129     static void didFailLoading(Frame*, unsigned long identifier, const ResourceError&);
     128    static void didFinishLoading(Frame*, DocumentLoader*, unsigned long identifier, double finishTime);
     129    static void didFailLoading(Frame*, DocumentLoader*, unsigned long identifier, const ResourceError&);
    130130    static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
    131131    static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
     
    254254    static void continueWithPolicyIgnoreImpl(Frame*, DocumentLoader*, unsigned long identifier, const ResourceResponse&);
    255255    static void didReceiveContentLengthImpl(InstrumentingAgents*, unsigned long identifier, int dataLength, int encodedDataLength);
    256     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, double finishTime);
    257     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, const ResourceError&);
     256    static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, double finishTime);
     257    static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, DocumentLoader*, const ResourceError&);
    258258    static void resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
    259259    static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
     
    763763}
    764764
    765 inline void InspectorInstrumentation::didFinishLoading(Frame* frame, unsigned long identifier, double finishTime)
    766 {
    767 #if ENABLE(INSPECTOR)
    768     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
    769         didFinishLoadingImpl(instrumentingAgents, identifier, finishTime);
    770 #endif
    771 }
    772 
    773 inline void InspectorInstrumentation::didFailLoading(Frame* frame, unsigned long identifier, const ResourceError& error)
    774 {
    775 #if ENABLE(INSPECTOR)
    776     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
    777         didFailLoadingImpl(instrumentingAgents, identifier, error);
     765inline void InspectorInstrumentation::didFinishLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, double finishTime)
     766{
     767#if ENABLE(INSPECTOR)
     768    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
     769        didFinishLoadingImpl(instrumentingAgents, identifier, loader, finishTime);
     770#endif
     771}
     772
     773inline void InspectorInstrumentation::didFailLoading(Frame* frame, DocumentLoader* loader, unsigned long identifier, const ResourceError& error)
     774{
     775#if ENABLE(INSPECTOR)
     776    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
     777        didFailLoadingImpl(instrumentingAgents, identifier, loader, error);
    778778#endif
    779779}
  • trunk/Source/WebCore/inspector/InspectorPageAgent.cpp

    r89079 r89163  
    111111}
    112112
    113 static bool decodeCachedResource(CachedResource* cachedResource, String* result)
     113static bool cachedResourceContent(CachedResource* cachedResource, bool withBase64Encode, String* result)
    114114{
    115115    bool hasZeroSize;
     
    117117    if (!prepared)
    118118        return false;
     119
     120    if (withBase64Encode) {
     121        RefPtr<SharedBuffer> buffer = hasZeroSize ? SharedBuffer::create() : cachedResource->data();
     122
     123        if (!buffer)
     124            return false;
     125
     126        *result = base64Encode(buffer->data(), buffer->size());
     127        return true;
     128    }
    119129
    120130    if (cachedResource) {
     
    137147}
    138148
    139 static bool decodeMainResource(Frame* frame, String* result)
    140 {
     149static bool mainResourceContent(Frame* frame, bool withBase64Encode, String* result)
     150{
     151    RefPtr<SharedBuffer> buffer = frame->loader()->documentLoader()->mainResourceData();
     152    if (!buffer)
     153        return false;
    141154    String textEncodingName = frame->document()->inputEncoding();
    142     RefPtr<SharedBuffer> buffer = frame->loader()->documentLoader()->mainResourceData();
     155
     156    return InspectorPageAgent::sharedBufferContent(buffer, textEncodingName, withBase64Encode, result);
     157}
     158
     159// static
     160bool InspectorPageAgent::sharedBufferContent(PassRefPtr<SharedBuffer> buffer, const String& textEncodingName, bool withBase64Encode, String* result)
     161{
     162    if (withBase64Encode) {
     163        *result = base64Encode(buffer->data(), buffer->size());
     164        return true;
     165    }
     166
    143167    return decodeSharedBuffer(buffer, textEncodingName, result);
    144168}
     
    149173}
    150174
    151 void InspectorPageAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result)
     175// static
     176void InspectorPageAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, bool base64Encode, String* result)
    152177{
    153178    if (!frame) {
     
    158183    FrameLoader* frameLoader = frame->loader();
    159184    DocumentLoader* loader = frameLoader->documentLoader();
     185
     186    if (!loader) {
     187        *errorString = "No documentLoader for frame to get resource content for";
     188        return;
     189    }
     190
    160191    RefPtr<SharedBuffer> buffer;
    161192    bool success = false;
    162193    if (equalIgnoringFragmentIdentifier(url, loader->url()))
    163         success = decodeMainResource(frame, result);
     194        success = mainResourceContent(frame, base64Encode, result);
    164195    if (!success)
    165         success = decodeCachedResource(cachedResource(frame, url), result);
     196        success = cachedResourceContent(cachedResource(frame, url), base64Encode, result);
    166197
    167198    if (!success)
    168199        *errorString = "No resource with given URL found";
    169 }
    170 
    171 void InspectorPageAgent::resourceContentBase64(ErrorString* errorString, Frame* frame, const KURL& url, String* result)
    172 {
    173     String textEncodingName;
    174     RefPtr<SharedBuffer> data = InspectorPageAgent::resourceData(frame, url, &textEncodingName);
    175     if (!data) {
    176         *result = String();
    177         *errorString = "No resource with given URL found";
    178         return;
    179     }
    180 
    181     *result = base64Encode(data->data(), data->size());
    182 }
    183 
    184 PassRefPtr<SharedBuffer> InspectorPageAgent::resourceData(Frame* frame, const KURL& url, String* textEncodingName)
    185 {
    186     RefPtr<SharedBuffer> buffer;
    187     FrameLoader* frameLoader = frame->loader();
    188     DocumentLoader* loader = frameLoader->documentLoader();
    189     if (equalIgnoringFragmentIdentifier(url, loader->url())) {
    190         *textEncodingName = frame->document()->inputEncoding();
    191         buffer = frameLoader->documentLoader()->mainResourceData();
    192         if (buffer)
    193             return buffer;
    194     }
    195 
    196     CachedResource* cachedResource = InspectorPageAgent::cachedResource(frame, url);
    197     if (!cachedResource)
    198         return 0;
    199 
    200     bool hasZeroSize;
    201     bool prepared = prepareCachedResourceBuffer(cachedResource, &hasZeroSize);
    202     if (!prepared)
    203         return 0;
    204 
    205     *textEncodingName = cachedResource->encoding();
    206     return hasZeroSize ? SharedBuffer::create() : cachedResource->data();
    207200}
    208201
     
    429422        return;
    430423    }
    431     if (optionalBase64Encode ? *optionalBase64Encode : false)
    432         InspectorPageAgent::resourceContentBase64(errorString, frame, KURL(ParsedURLString, url), content);
    433     else
    434         InspectorPageAgent::resourceContent(errorString, frame, KURL(ParsedURLString, url), content);
     424    bool base64Encode = optionalBase64Encode ? *optionalBase64Encode : false;
     425    resourceContent(errorString, frame, KURL(ParsedURLString, url), base64Encode, content);
    435426}
    436427
     
    494485            case InspectorPageAgent::StylesheetResource:
    495486            case InspectorPageAgent::ScriptResource:
    496                 if (decodeCachedResource(cachedResource, &content)) {
     487                if (cachedResourceContent(cachedResource, false, &content)) {
    497488                    int matchesCount = countRegularExpressionMatches(regex, content);
    498489                    if (matchesCount)
     
    504495            }
    505496        }
    506         if (decodeMainResource(frame, &content)) {
     497        if (mainResourceContent(frame, false, &content)) {
    507498            int matchesCount = countRegularExpressionMatches(regex, content);
    508499            if (matchesCount)
  • trunk/Source/WebCore/inspector/InspectorPageAgent.h

    r88940 r89163  
    5555class Page;
    5656class RegularExpression;
     57class SharedBuffer;
    5758
    5859typedef String ErrorString;
     
    7576    static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, InjectedScriptManager*);
    7677
    77     static void resourceContent(ErrorString*, Frame*, const KURL&, String* result);
    78     static void resourceContentBase64(ErrorString*, Frame*, const KURL&, String* result);
     78    static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& textEncodingName, bool withBase64Encode, String* result);
     79    static void resourceContent(ErrorString*, Frame*, const KURL&, bool base64Encode, String* result);
    7980
    8081    static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* textEncodingName);
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r89036 r89163  
    3636#include "CachedResource.h"
    3737#include "CachedResourceLoader.h"
     38#include "Document.h"
    3839#include "DocumentLoader.h"
    3940#include "EventsCollector.h"
     
    245246        else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == InspectorPageAgent::OtherResource)
    246247            type = InspectorPageAgent::DocumentResource;
    247         else if (m_loadingXHRSynchronously || m_resourcesData->isXHR(identifier))
     248        else if (m_loadingXHRSynchronously || m_resourcesData->resourceType(identifier) == InspectorPageAgent::XHRResource)
    248249            type = InspectorPageAgent::XHRResource;
    249250
    250251        m_resourcesData->responseReceived(identifier, m_pageAgent->frameId(loader->frame()), response.url());
    251252    }
    252 
     253    m_resourcesData->setResourceType(identifier, type);
    253254    m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), InspectorPageAgent::resourceTypeString(type), resourceResponse);
    254255    // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
     
    263264}
    264265
    265 void InspectorResourceAgent::didFinishLoading(unsigned long identifier, double finishTime)
    266 {
     266void InspectorResourceAgent::didFinishLoading(unsigned long identifier, DocumentLoader* loader, double finishTime)
     267{
     268    if (m_resourcesData->resourceType(identifier) == InspectorPageAgent::DocumentResource)
     269        m_resourcesData->addResourceSharedBuffer(identifier, loader->frameLoader()->documentLoader()->mainResourceData(), loader->frame()->document()->inputEncoding());
     270
    267271    if (!finishTime)
    268272        finishTime = currentTime();
     
    271275}
    272276
    273 void InspectorResourceAgent::didFailLoading(unsigned long identifier, const ResourceError& error)
    274 {
     277void InspectorResourceAgent::didFailLoading(unsigned long identifier, DocumentLoader* loader, const ResourceError& error)
     278{
     279    if (m_resourcesData->resourceType(identifier) == InspectorPageAgent::DocumentResource)
     280        m_resourcesData->addResourceSharedBuffer(identifier, loader->frameLoader()->documentLoader()->mainResourceData(), loader->frame()->document()->inputEncoding());
     281
    275282    m_frontend->loadingFailed(static_cast<int>(identifier), currentTime(), error.localizedDescription(), error.isCancellation());
    276283}
     
    293300void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier)
    294301{
    295     m_resourcesData->didReceiveXHRResponse(identifier);
     302    m_resourcesData->setResourceType(identifier, InspectorPageAgent::XHRResource);
    296303}
    297304
     
    434441    }
    435442
    436     if (resourceData->hasContent())
     443    bool base64Encode = optionalBase64Encode ? *optionalBase64Encode : false;
     444
     445    if (resourceData->hasContent()) {
    437446        *content = resourceData->content();
    438     else if (!resourceData->frameId().isNull() && !resourceData->url().isNull())
     447        return;
     448    }
     449
     450    if (resourceData->buffer() && !resourceData->textEncodingName().isNull()) {
     451        if (InspectorPageAgent::sharedBufferContent(resourceData->buffer(), resourceData->textEncodingName(), base64Encode, content))
     452            return;
     453    }
     454
     455    if (!resourceData->frameId().isNull() && !resourceData->url().isNull())
    439456        m_pageAgent->getResourceContent(errorString, resourceData->frameId(), resourceData->url(), optionalBase64Encode, content);
    440457    else
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.h

    r89036 r89163  
    9292    void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&);
    9393    void didReceiveContentLength(unsigned long identifier, int dataLength, int encodedDataLength);
    94     void didFinishLoading(unsigned long identifier, double finishTime);
    95     void didFailLoading(unsigned long identifier, const ResourceError&);
     94    void didFinishLoading(unsigned long identifier, DocumentLoader*, double finishTime);
     95    void didFailLoading(unsigned long identifier, DocumentLoader*, const ResourceError&);
    9696    void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
    9797    void mainFrameNavigated(DocumentLoader*);
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r88950 r89163  
    10701070
    10711071    String error;
    1072     InspectorPageAgent::resourceContent(&error, ownerDocument()->frame(), m_pageStyleSheet->finalURL(), result);
     1072    InspectorPageAgent::resourceContent(&error, ownerDocument()->frame(), m_pageStyleSheet->finalURL(), false, result);
    10731073    return error.isEmpty();
    10741074}
  • trunk/Source/WebCore/inspector/NetworkResourcesData.cpp

    r89036 r89163  
    4444    , m_loaderId(loaderId)
    4545    , m_hasContent(false)
    46     , m_isXHR(false)
    4746    , m_isContentPurged(false)
     47    , m_type(InspectorPageAgent::OtherResource)
    4848{
    4949}
     
    9595}
    9696
    97 void NetworkResourcesData::didReceiveXHRResponse(unsigned long identifier)
     97void NetworkResourcesData::setResourceType(unsigned long identifier, InspectorPageAgent::ResourceType type)
    9898{
    9999    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
    100100    if (!resourceData)
    101101        return;
    102     resourceData->setIsXHR(true);
     102    resourceData->setType(type);
     103}
     104
     105InspectorPageAgent::ResourceType NetworkResourcesData::resourceType(unsigned long identifier)
     106{
     107    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
     108    if (!resourceData)
     109        return InspectorPageAgent::OtherResource;
     110    return resourceData->type();
    103111}
    104112
     
    118126}
    119127
    120 bool NetworkResourcesData::isXHR(unsigned long identifier)
     128void NetworkResourcesData::addResourceSharedBuffer(unsigned long identifier, PassRefPtr<SharedBuffer> buffer, const String& textEncodingName)
    121129{
    122130    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
    123131    if (!resourceData)
    124         return false;
    125     return resourceData->isXHR();
     132        return;
     133    resourceData->setBuffer(buffer);
     134    resourceData->setTextEncodingName(textEncodingName);
    126135}
    127136
  • trunk/Source/WebCore/inspector/NetworkResourcesData.h

    r89036 r89163  
    3030#define NetworkResourcesData_h
    3131
     32#include "CachedResourceHandle.h"
     33#include "InspectorPageAgent.h"
     34#include "SharedBuffer.h"
     35
    3236#include <wtf/Deque.h>
    3337#include <wtf/HashMap.h>
     38#include <wtf/RefCounted.h>
    3439#include <wtf/text/StringBuilder.h>
    3540#include <wtf/text/WTFString.h>
     
    3843
    3944namespace WebCore {
     45
     46class SharedBuffer;
     47class CachedResource;
    4048
    4149class NetworkResourcesData {
     
    5462        void setUrl(String url) { m_url = url; }
    5563
    56         bool isXHR() const { return m_isXHR; }
    57         void setIsXHR(bool isXHR) { m_isXHR = isXHR; }
    58 
    5964        bool hasContent() const { return m_hasContent; }
    6065        String content();
     
    6570        unsigned purgeContent();
    6671
     72        InspectorPageAgent::ResourceType type() const { return m_type; }
     73        void setType(InspectorPageAgent::ResourceType type) { m_type = type; }
     74
     75        PassRefPtr<SharedBuffer> buffer() const { return m_buffer; }
     76        void setBuffer(PassRefPtr<SharedBuffer> buffer) { m_buffer = buffer; }
     77
     78        String textEncodingName() const { return m_textEncodingName; }
     79        void setTextEncodingName(String textEncodingName) { m_textEncodingName = textEncodingName; }
     80
    6781    private:
    6882        unsigned long m_identifier;
     
    7286        bool m_hasContent;
    7387        StringBuilder m_contentBuilder;
    74         bool m_isXHR;
    7588        bool m_isContentPurged;
     89        InspectorPageAgent::ResourceType m_type;
     90
     91        RefPtr<SharedBuffer> m_buffer;
     92        String m_textEncodingName;
    7693    };
    7794
     
    8299    void resourceCreated(unsigned long identifier, const String& loaderId);
    83100    void responseReceived(unsigned long identifier, const String& frameId, const String& url);
    84     void didReceiveXHRResponse(unsigned long identifier);
     101    void setResourceType(unsigned long identifier, InspectorPageAgent::ResourceType);
     102    InspectorPageAgent::ResourceType resourceType(unsigned long identifier);
    85103    void addResourceContent(unsigned long identifier, const String& content);
    86 
    87     bool isXHR(unsigned long identifier);
     104    void addResourceSharedBuffer(unsigned long identifier, PassRefPtr<SharedBuffer>, const String& textEncodingName);
    88105    ResourceData* data(unsigned long identifier);
    89106    void clear(const String& preservedLoaderId = String());
  • trunk/Source/WebCore/loader/ResourceLoadNotifier.cpp

    r87990 r89163  
    9898        m_frame->loader()->client()->dispatchDidFailLoading(loader->documentLoader(), loader->identifier(), error);
    9999
    100     InspectorInstrumentation::didFailLoading(m_frame, loader->identifier(), error);
     100    InspectorInstrumentation::didFailLoading(m_frame, loader->documentLoader(), loader->identifier(), error);
    101101}
    102102
     
    142142    m_frame->loader()->client()->dispatchDidFinishLoading(loader, identifier);
    143143
    144     InspectorInstrumentation::didFinishLoading(m_frame, identifier, finishTime);
     144    InspectorInstrumentation::didFinishLoading(m_frame, loader, identifier, finishTime);
    145145}
    146146
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp

    r88740 r89163  
    591591{
    592592#if ENABLE(INSPECTOR)
    593     InspectorInstrumentation::didFinishLoading(m_frame, m_currentResourceIdentifier, finishTime);
     593    InspectorInstrumentation::didFinishLoading(m_frame, m_frame->loader()->documentLoader(), m_currentResourceIdentifier, finishTime);
    594594#endif
    595595
     
    632632{
    633633#if ENABLE(INSPECTOR)
    634     InspectorInstrumentation::didFailLoading(m_frame, m_currentResourceIdentifier, error);
     634    InspectorInstrumentation::didFailLoading(m_frame, m_frame->loader()->documentLoader(), m_currentResourceIdentifier, error);
    635635#endif
    636636
Note: See TracChangeset for help on using the changeset viewer.