diff options
author | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 09:17:33 +0000 |
---|---|---|
committer | yurys@chromium.org <yurys@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-31 09:17:33 +0000 |
commit | 993f61df3dfb75bc18074cb7b0677fcf1367fa09 (patch) | |
tree | 42002e78558dc49b3061370b9bf29b629b344135 /webkit/glue | |
parent | 14bd3b14f60343740a21e2ce5ae1f35644f7f4ac (diff) | |
download | chromium_src-993f61df3dfb75bc18074cb7b0677fcf1367fa09.zip chromium_src-993f61df3dfb75bc18074cb7b0677fcf1367fa09.tar.gz chromium_src-993f61df3dfb75bc18074cb7b0677fcf1367fa09.tar.bz2 |
DevTools: load injected script using WebKit API. Now with test_shell working.
BUG=28062
Review URL: http://codereview.chromium.org/552252
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.cc | 8 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 16 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 1 |
3 files changed, 17 insertions, 8 deletions
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc index b4b51a1..f58e558 100644 --- a/webkit/glue/devtools/debugger_agent_impl.cc +++ b/webkit/glue/devtools/debugger_agent_impl.cc @@ -43,12 +43,10 @@ #include "V8Proxy.h" #undef LOG -#include "grit/webkit_resources.h" #include "third_party/WebKit/WebKit/chromium/src/WebViewImpl.h" #include "webkit/glue/devtools/debugger_agent_impl.h" #include "webkit/glue/devtools/debugger_agent_manager.h" #include "webkit/glue/webdevtoolsagent_impl.h" -#include "webkit/glue/webkit_glue.h" using WebCore::DOMWindow; using WebCore::Document; @@ -132,12 +130,6 @@ void DebuggerAgentImpl::createUtilityContext(Frame* frame, v8::Persistent<v8::Co // Give the code running in the new context a way to get access to the // original context. global->Set(v8::String::New("contentWindow"), windowGlobal); - - // Inject javascript into the context. - base::StringPiece injectjsWebkit = webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_WEBKIT_JS); - v8::Script::Compile(v8::String::New(injectjsWebkit.as_string().c_str()))->Run(); - base::StringPiece injectDispatchjs = webkit_glue::GetDataResource(IDR_DEVTOOLS_INJECT_DISPATCH_JS); - v8::Script::Compile(v8::String::New(injectDispatchjs.as_string().c_str()))->Run(); } String DebuggerAgentImpl::executeUtilityFunction( diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index a4fef52..2e92587 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -323,6 +323,21 @@ void WebDevToolsAgentImpl::sendRpcMessage(const WebKit::WebDevToolsMessageData& m_client->sendMessageToFrontend(data); } +void WebDevToolsAgentImpl::compileUtilityScripts() +{ + v8::HandleScope handleScope; + v8::Context::Scope contextScope(m_utilityContext); + // Inject javascript into the context. + WebCString injectedScriptJs = m_client->injectedScriptSource(); + v8::Script::Compile(v8::String::New( + injectedScriptJs.data(), + injectedScriptJs.length()))->Run(); + WebCString injectDispatchJs = m_client->injectedScriptDispatcherSource(); + v8::Script::Compile(v8::String::New( + injectDispatchJs.data(), + injectDispatchJs.length()))->Run(); +} + void WebDevToolsAgentImpl::initDevToolsAgentHost() { BoundObject devtoolsAgentHost(m_utilityContext, this, "DevToolsAgentHost"); @@ -378,6 +393,7 @@ void WebDevToolsAgentImpl::resetInspectorFrontendProxy() { disposeUtilityContext(); m_debuggerAgentImpl->createUtilityContext(m_webViewImpl->page()->mainFrame(), &m_utilityContext); + compileUtilityScripts(); initDevToolsAgentHost(); v8::HandleScope scope; diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h index 263b9d4..e5471cd 100644 --- a/webkit/glue/webdevtoolsagent_impl.h +++ b/webkit/glue/webdevtoolsagent_impl.h @@ -119,6 +119,7 @@ private: void disposeUtilityContext(); void unhideResourcesPanelIfNecessary(); + void compileUtilityScripts(); void initDevToolsAgentHost(); void resetInspectorFrontendProxy(); void setApuAgentEnabled(bool enabled); |