summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/js/devtools.js1
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc16
-rw-r--r--webkit/glue/webdevtoolsclient_impl.cc29
-rw-r--r--webkit/glue/webdevtoolsclient_impl.h1
4 files changed, 37 insertions, 10 deletions
diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js
index 30ae6ec..e3a8d98 100644
--- a/webkit/glue/devtools/js/devtools.js
+++ b/webkit/glue/devtools/js/devtools.js
@@ -60,6 +60,7 @@ devtools.ToolsAgent = function() {
* Resets tools agent to its initial state.
*/
devtools.ToolsAgent.prototype.reset = function() {
+ DevToolsHost.reset();
this.domAgent_.reset();
this.debuggerAgent_.reset();
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index ae781e0..592db96 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -224,16 +224,16 @@ void WebDevToolsAgentImpl::ClearConsoleMessages() {
void WebDevToolsAgentImpl::GetResourceContent(
int call_id,
int identifier) {
+ String content;
Page* page = web_view_impl_->page();
- if (!page) {
- return;
- }
- RefPtr<InspectorResource> resource =
- page->inspectorController()->resources().get(identifier);
- if (resource.get()) {
- tools_agent_native_delegate_stub_->DidGetResourceContent(call_id,
- resource->sourceString());
+ if (page) {
+ RefPtr<InspectorResource> resource =
+ page->inspectorController()->resources().get(identifier);
+ if (resource.get()) {
+ content = resource->sourceString();
+ }
}
+ tools_agent_native_delegate_stub_->DidGetResourceContent(call_id, content);
}
void WebDevToolsAgentImpl::SetResourceTrackingEnabled(
diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc
index 8eb7ef8..a91cea6 100644
--- a/webkit/glue/webdevtoolsclient_impl.cc
+++ b/webkit/glue/webdevtoolsclient_impl.cc
@@ -71,6 +71,15 @@ class ToolsAgentNativeDelegateImpl : public ToolsAgentNativeDelegate {
ic->addSourceToFrame(request.mime_type, content, request.frame.get());
}
+ bool WaitingForResponse(int resource_id, Node* frame) {
+ if (resource_content_requests_.contains(resource_id)) {
+ DCHECK(resource_content_requests_.get(resource_id).frame.get() == frame)
+ << "Only one frame is expected to display given resource";
+ return true;
+ }
+ return false;
+ }
+
void RequestSent(int resource_id, String mime_type, Node* frame) {
ResourceContentRequestData data;
data.mime_type = mime_type;
@@ -137,13 +146,14 @@ WebDevToolsClientImpl::WebDevToolsClientImpl(
dom_agent_obj_.set(new JsDomAgentBoundObj(this, frame, L"RemoteDomAgent"));
tools_agent_obj_.set(
new JsToolsAgentBoundObj(this, frame, L"RemoteToolsAgent"));
- tools_agent_native_delegate_impl_.set(
- new ToolsAgentNativeDelegateImpl(frame));
v8::HandleScope scope;
v8::Handle<v8::Context> frame_context = V8Proxy::GetContext(frame->frame());
dev_tools_host_.set(new BoundObject(frame_context, this, "DevToolsHost"));
dev_tools_host_->AddProtoFunction(
+ "reset",
+ WebDevToolsClientImpl::JsReset);
+ dev_tools_host_->AddProtoFunction(
"addSourceToFrame",
WebDevToolsClientImpl::JsAddSourceToFrame);
dev_tools_host_->AddProtoFunction(
@@ -191,6 +201,10 @@ void WebDevToolsClientImpl::DispatchMessageFromAgent(
void WebDevToolsClientImpl::AddResourceSourceToFrame(int resource_id,
String mime_type,
Node* frame) {
+ if (tools_agent_native_delegate_impl_->WaitingForResponse(resource_id,
+ frame)) {
+ return;
+ }
tools_agent_obj_->GetResourceContent(resource_id, resource_id);
tools_agent_native_delegate_impl_->RequestSent(resource_id, mime_type, frame);
}
@@ -208,6 +222,17 @@ void WebDevToolsClientImpl::SendRpcMessage(const std::string& class_name,
}
// static
+v8::Handle<v8::Value> WebDevToolsClientImpl::JsReset(
+ const v8::Arguments& args) {
+ WebDevToolsClientImpl* client = static_cast<WebDevToolsClientImpl*>(
+ v8::External::Cast(*args.Data())->Value());
+ WebFrameImpl* frame = client->web_view_impl_->main_frame();
+ client->tools_agent_native_delegate_impl_.set(
+ new ToolsAgentNativeDelegateImpl(frame));
+ return v8::Undefined();
+}
+
+// static
v8::Handle<v8::Value> WebDevToolsClientImpl::JsAddSourceToFrame(
const v8::Arguments& args) {
if (args.Length() < 2) {
diff --git a/webkit/glue/webdevtoolsclient_impl.h b/webkit/glue/webdevtoolsclient_impl.h
index 922d51f..e71cbad 100644
--- a/webkit/glue/webdevtoolsclient_impl.h
+++ b/webkit/glue/webdevtoolsclient_impl.h
@@ -56,6 +56,7 @@ class WebDevToolsClientImpl : public WebDevToolsClient,
WebCore::Node* frame);
void ExecuteScript(const std::string& expr);
+ static v8::Handle<v8::Value> JsReset(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddSourceToFrame(const v8::Arguments& args);
static v8::Handle<v8::Value> JsAddResourceSourceToFrame(
const v8::Arguments& args);