OLD | NEW |
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 112 } |
113 if (event->type() != eventNames().readystatechangeEvent) { | 113 if (event->type() != eventNames().readystatechangeEvent) { |
114 m_callback->sendFailure("Unexpected event type."); | 114 m_callback->sendFailure("Unexpected event type."); |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 XMLHttpRequest* xhr = static_cast<XMLHttpRequest*>(event->target()); | 118 XMLHttpRequest* xhr = static_cast<XMLHttpRequest*>(event->target()); |
119 if (xhr->readyState() != XMLHttpRequest::DONE) | 119 if (xhr->readyState() != XMLHttpRequest::DONE) |
120 return; | 120 return; |
121 | 121 |
122 String responseText = xhr->responseText(IGNORE_EXCEPTION); | 122 ScriptString responseText = xhr->responseText(IGNORE_EXCEPTION); |
123 m_callback->sendSuccess(responseText); | 123 m_callback->sendSuccess(responseText.flattenToString()); |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 SendXHRCallback(PassRefPtr<LoadResourceForFrontendCallback> callback) | 127 SendXHRCallback(PassRefPtr<LoadResourceForFrontendCallback> callback) |
128 : EventListener(EventListener::CPPEventListenerType) | 128 : EventListener(EventListener::CPPEventListenerType) |
129 , m_callback(callback) { } | 129 , m_callback(callback) { } |
130 RefPtr<LoadResourceForFrontendCallback> m_callback; | 130 RefPtr<LoadResourceForFrontendCallback> m_callback; |
131 }; | 131 }; |
132 | 132 |
133 } // namespace | 133 } // namespace |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 for (HTTPHeaderMap::const_iterator it = headers.begin(); it!= end; ++it) | 415 for (HTTPHeaderMap::const_iterator it = headers.begin(); it!= end; ++it) |
416 xhrReplayData->addHeader(it->key, it->value); | 416 xhrReplayData->addHeader(it->key, it->value); |
417 m_pendingXHRReplayData.set(client, xhrReplayData); | 417 m_pendingXHRReplayData.set(client, xhrReplayData); |
418 } | 418 } |
419 | 419 |
420 void InspectorResourceAgent::didFailXHRLoading(ThreadableLoaderClient* client) | 420 void InspectorResourceAgent::didFailXHRLoading(ThreadableLoaderClient* client) |
421 { | 421 { |
422 m_pendingXHRReplayData.remove(client); | 422 m_pendingXHRReplayData.remove(client); |
423 } | 423 } |
424 | 424 |
425 void InspectorResourceAgent::didFinishXHRLoading(ThreadableLoaderClient* client,
unsigned long identifier, const String& sourceString, const String&, const Stri
ng&, unsigned) | 425 void InspectorResourceAgent::didFinishXHRLoading(ThreadableLoaderClient* client,
unsigned long identifier, ScriptString sourceString, const String&, const Strin
g&, unsigned) |
426 { | 426 { |
427 // For Asynchronous XHRs, the inspector can grab the data directly off of th
e CachedResource. For sync XHRs, we need to | 427 // For Asynchronous XHRs, the inspector can grab the data directly off of th
e CachedResource. For sync XHRs, we need to |
428 // provide the data here, since no CachedResource was involved. | 428 // provide the data here, since no CachedResource was involved. |
429 if (m_loadingXHRSynchronously) | 429 if (m_loadingXHRSynchronously) |
430 m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identi
fier), sourceString); | 430 m_resourcesData->setResourceContent(IdentifiersFactory::requestId(identi
fier), sourceString.flattenToString()); |
431 m_pendingXHRReplayData.remove(client); | 431 m_pendingXHRReplayData.remove(client); |
432 } | 432 } |
433 | 433 |
434 void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier) | 434 void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier) |
435 { | 435 { |
436 m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier),
InspectorPageAgent::XHRResource); | 436 m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier),
InspectorPageAgent::XHRResource); |
437 } | 437 } |
438 | 438 |
439 void InspectorResourceAgent::willLoadXHRSynchronously() | 439 void InspectorResourceAgent::willLoadXHRSynchronously() |
440 { | 440 { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 , m_client(client) | 748 , m_client(client) |
749 , m_frontend(0) | 749 , m_frontend(0) |
750 , m_resourcesData(adoptPtr(new NetworkResourcesData())) | 750 , m_resourcesData(adoptPtr(new NetworkResourcesData())) |
751 , m_loadingXHRSynchronously(false) | 751 , m_loadingXHRSynchronously(false) |
752 , m_isRecalculatingStyle(false) | 752 , m_isRecalculatingStyle(false) |
753 { | 753 { |
754 } | 754 } |
755 | 755 |
756 } // namespace WebCore | 756 } // namespace WebCore |
757 | 757 |
OLD | NEW |