summaryrefslogtreecommitdiffstats
path: root/webkit/glue/devtools
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue/devtools')
-rw-r--r--webkit/glue/devtools/net_agent_impl.cc13
-rw-r--r--webkit/glue/devtools/net_agent_impl.h9
2 files changed, 21 insertions, 1 deletions
diff --git a/webkit/glue/devtools/net_agent_impl.cc b/webkit/glue/devtools/net_agent_impl.cc
index 5aba9bb..5b04662 100644
--- a/webkit/glue/devtools/net_agent_impl.cc
+++ b/webkit/glue/devtools/net_agent_impl.cc
@@ -18,6 +18,7 @@
#include "ResourceError.h"
#include "ResourceRequest.h"
#include "ResourceResponse.h"
+#include "ScriptString.h"
#include "TextEncoding.h"
#include <wtf/CurrentTime.h>
#undef LOG
@@ -155,6 +156,7 @@ void NetAgentImpl::DidFinishLoading(
// Start removing resources from the cache once there are too many of them.
if (finished_resources_.size() > 200) {
for (int i = 0; i < 50; ++i) {
+ xml_http_sources_.remove(finished_resources_[i].first);
delete finished_resources_[i].second;
}
finished_resources_.remove(0, 50);
@@ -187,6 +189,12 @@ void NetAgentImpl::DidLoadResourceFromMemoryCache(
int identifier = last_cached_identifier_--;
}
+void NetAgentImpl::DidLoadResourceByXMLHttpRequest(
+ int identifier,
+ const WebCore::ScriptString& source) {
+ xml_http_sources_.set(identifier, source);
+}
+
void NetAgentImpl::GetResourceContent(
int call_id,
int identifier,
@@ -197,7 +205,10 @@ void NetAgentImpl::GetResourceContent(
String source;
- if (main_loader_.get() && main_loader_->requestURL() == url) {
+ WebCore::ScriptString script = xml_http_sources_.get(identifier);
+ if (!script.isNull()) {
+ source = String(script);
+ } else if (main_loader_.get() && main_loader_->requestURL() == url) {
RefPtr<SharedBuffer> buffer = main_loader_->mainResourceData();
String text_encoding_name = document_->inputEncoding();
if (buffer) {
diff --git a/webkit/glue/devtools/net_agent_impl.h b/webkit/glue/devtools/net_agent_impl.h
index 893c4b5..e1d882b 100644
--- a/webkit/glue/devtools/net_agent_impl.h
+++ b/webkit/glue/devtools/net_agent_impl.h
@@ -20,6 +20,7 @@ class DocumentLoader;
class HTTPHeaderMap;
class ResourceError;
class ResourceResponse;
+class ScriptString;
class String;
struct ResourceRequest;
}
@@ -78,6 +79,10 @@ class NetAgentImpl : public NetAgent {
const WebCore::ResourceRequest& request,
const WebCore::ResourceResponse& response,
int length);
+ void DidLoadResourceByXMLHttpRequest(
+ int identifier,
+ const WebCore::ScriptString& source);
+
private:
// Serializes headers map into a value.
@@ -89,8 +94,12 @@ class NetAgentImpl : public NetAgent {
typedef HashMap<int, DictionaryValue*, DefaultHash<int>::Hash,
WTF::UnsignedWithZeroKeyHashTraits<int> > ResourcesMap;
typedef Vector<std::pair<int, DictionaryValue*> > FinishedResources;
+ typedef HashMap<int, WebCore::ScriptString, DefaultHash<int>::Hash,
+ WTF::UnsignedWithZeroKeyHashTraits<int> > XmlHttpSources;
+
ResourcesMap pending_resources_;
FinishedResources finished_resources_;
+ XmlHttpSources xml_http_sources_;
int last_cached_identifier_;
bool attached_;
DISALLOW_COPY_AND_ASSIGN(NetAgentImpl);