Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: Source/core/inspector/InspectorResourceAgent.cpp

Issue 302093003: Show the correct resource type when XHR fails in the inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 { 425 {
426 // Update the response and finish loading 426 // Update the response and finish loading
427 didReceiveResourceResponse(frame, identifier, loader, response, resourceLoad er); 427 didReceiveResourceResponse(frame, identifier, loader, response, resourceLoad er);
428 didFinishLoading(identifier, loader, 0, blink::WebURLLoaderClient::kUnknownE ncodedDataLength); 428 didFinishLoading(identifier, loader, 0, blink::WebURLLoaderClient::kUnknownE ncodedDataLength);
429 } 429 }
430 430
431 void InspectorResourceAgent::didFailLoading(unsigned long identifier, const Reso urceError& error) 431 void InspectorResourceAgent::didFailLoading(unsigned long identifier, const Reso urceError& error)
432 { 432 {
433 String requestId = IdentifiersFactory::requestId(identifier); 433 String requestId = IdentifiersFactory::requestId(identifier);
434 bool canceled = error.isCancellation(); 434 bool canceled = error.isCancellation();
435 m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescripti on(), canceled ? &canceled : 0); 435 m_frontend->loadingFailed(requestId, currentTime(), InspectorPageAgent::reso urceTypeJson(m_resourcesData->resourceType(requestId)), error.localizedDescripti on(), canceled ? &canceled : 0);
436 } 436 }
437 437
438 void InspectorResourceAgent::scriptImported(unsigned long identifier, const Stri ng& sourceString) 438 void InspectorResourceAgent::scriptImported(unsigned long identifier, const Stri ng& sourceString)
439 { 439 {
440 m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identifier ), sourceString); 440 m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identifier ), sourceString);
441 } 441 }
442 442
443 void InspectorResourceAgent::didReceiveScriptResponse(unsigned long identifier) 443 void InspectorResourceAgent::didReceiveScriptResponse(unsigned long identifier)
444 { 444 {
445 m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier), InspectorPageAgent::ScriptResource); 445 m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier), InspectorPageAgent::ScriptResource);
446 } 446 }
447 447
448 void InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient(uns igned long identifier, ThreadableLoaderClient* client) 448 void InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient(uns igned long identifier, ThreadableLoaderClient* client)
449 { 449 {
450 if (!client) 450 if (!client)
451 return; 451 return;
452 452
453 PendingXHRReplayDataMap::iterator it = m_pendingXHRReplayData.find(client); 453 PendingXHRReplayDataMap::iterator it = m_pendingXHRReplayData.find(client);
454 if (it == m_pendingXHRReplayData.end()) 454 if (it == m_pendingXHRReplayData.end())
455 return; 455 return;
456 456
457 m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier), InspectorPageAgent::XHRResource);
457 XHRReplayData* xhrReplayData = it->value.get(); 458 XHRReplayData* xhrReplayData = it->value.get();
458 String requestId = IdentifiersFactory::requestId(identifier); 459 String requestId = IdentifiersFactory::requestId(identifier);
459 m_resourcesData->setXHRReplayData(requestId, xhrReplayData); 460 m_resourcesData->setXHRReplayData(requestId, xhrReplayData);
460 } 461 }
461 462
462 void InspectorResourceAgent::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderCl ient* client, const AtomicString& method, const KURL& url, bool async, FormData* formData, const HTTPHeaderMap& headers, bool includeCredentials) 463 void InspectorResourceAgent::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderCl ient* client, const AtomicString& method, const KURL& url, bool async, FormData* formData, const HTTPHeaderMap& headers, bool includeCredentials)
463 { 464 {
464 ASSERT(xhr); 465 ASSERT(xhr);
465 RefPtr<XHRReplayData> xhrReplayData = XHRReplayData::create(xhr->executionCo ntext(), method, urlWithoutFragment(url), async, formData, includeCredentials); 466 RefPtr<XHRReplayData> xhrReplayData = XHRReplayData::create(xhr->executionCo ntext(), method, urlWithoutFragment(url), async, formData, includeCredentials);
466 HTTPHeaderMap::const_iterator end = headers.end(); 467 HTTPHeaderMap::const_iterator end = headers.end();
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent) 813 InspectorResourceAgent::InspectorResourceAgent(InspectorPageAgent* pageAgent)
813 : InspectorBaseAgent<InspectorResourceAgent>("Network") 814 : InspectorBaseAgent<InspectorResourceAgent>("Network")
814 , m_pageAgent(pageAgent) 815 , m_pageAgent(pageAgent)
815 , m_frontend(0) 816 , m_frontend(0)
816 , m_resourcesData(adoptPtr(new NetworkResourcesData())) 817 , m_resourcesData(adoptPtr(new NetworkResourcesData()))
817 , m_isRecalculatingStyle(false) 818 , m_isRecalculatingStyle(false)
818 { 819 {
819 } 820 }
820 821
821 } // namespace WebCore 822 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698