summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--webkit/glue/devtools/js/inject_dispatch.js6
-rw-r--r--webkit/glue/webdevtoolsagent_impl.cc25
-rw-r--r--webkit/glue/webdevtoolsagent_impl.h1
3 files changed, 32 insertions, 0 deletions
diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js
index 973e390..9e5699e 100644
--- a/webkit/glue/devtools/js/inject_dispatch.js
+++ b/webkit/glue/devtools/js/inject_dispatch.js
@@ -90,6 +90,12 @@ InjectedScript._window = function() {
// Plugging into upstreamed support.
+InjectedScript.evaluateOnSelf = function(funcBody) {
+ return DevToolsAgentHost.evaluateOnSelf("(" + funcBody + ")();");
+};
+
+
+// Plugging into upstreamed support.
Object.className = function(obj) {
return (obj == null) ? "null" : obj.constructor.name;
};
diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc
index 903231cc..e3a647e 100644
--- a/webkit/glue/webdevtoolsagent_impl.cc
+++ b/webkit/glue/webdevtoolsagent_impl.cc
@@ -326,6 +326,9 @@ void WebDevToolsAgentImpl::InitDevToolsAgentHost() {
"dispatchToApu",
WebDevToolsAgentImpl::JsDispatchToApu);
devtools_agent_host.AddProtoFunction(
+ "evaluateOnSelf",
+ WebDevToolsAgentImpl::JsEvaluateOnSelf);
+ devtools_agent_host.AddProtoFunction(
"runtimeFeatureStateChanged",
WebDevToolsAgentImpl::JsOnRuntimeFeatureStateChanged);
devtools_agent_host.Build();
@@ -483,6 +486,28 @@ v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchToApu(
}
// static
+v8::Handle<v8::Value> WebDevToolsAgentImpl::JsEvaluateOnSelf(
+ const v8::Arguments& args) {
+ String code;
+ {
+ v8::TryCatch exception_catcher;
+ code = WebCore::toWebCoreStringWithNullCheck(args[0]);
+ if (code.isEmpty() || exception_catcher.HasCaught()) {
+ return v8::Undefined();
+ }
+ }
+ WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>(
+ v8::External::Cast(*args.Data())->Value());
+ v8::Context::Scope(agent->utility_context_);
+ V8Proxy* proxy = V8Proxy::retrieve(
+ agent->web_view_impl_->page()->mainFrame());
+ v8::Local<v8::Value> result = proxy->runScript(
+ v8::Script::Compile(v8::String::New(code.utf8().data())),
+ true);
+ return result;
+}
+
+// static
v8::Handle<v8::Value> WebDevToolsAgentImpl::JsOnRuntimeFeatureStateChanged(
const v8::Arguments& args) {
v8::TryCatch exception_catcher;
diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h
index 736050a..5506962 100644
--- a/webkit/glue/webdevtoolsagent_impl.h
+++ b/webkit/glue/webdevtoolsagent_impl.h
@@ -105,6 +105,7 @@ class WebDevToolsAgentImpl : public WebKit::WebDevToolsAgentPrivate,
private:
static v8::Handle<v8::Value> JsDispatchOnClient(const v8::Arguments& args);
static v8::Handle<v8::Value> JsDispatchToApu(const v8::Arguments& args);
+ static v8::Handle<v8::Value> JsEvaluateOnSelf(const v8::Arguments& args);
static v8::Handle<v8::Value> JsOnRuntimeFeatureStateChanged(
const v8::Arguments& args);