diff options
author | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 18:50:02 +0000 |
---|---|---|
committer | laforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 18:50:02 +0000 |
commit | a360423cf37548920b3a1c517190ec642a224396 (patch) | |
tree | 644f3404ef8384752b8b37481ef030430bbf87f8 /webkit | |
parent | 2b1393cf7bb206e79a5bf08424ac464da049e7d4 (diff) | |
download | chromium_src-a360423cf37548920b3a1c517190ec642a224396.zip chromium_src-a360423cf37548920b3a1c517190ec642a224396.tar.gz chromium_src-a360423cf37548920b3a1c517190ec642a224396.tar.bz2 |
Revert 18484 - DevTools: Add support for dumping objects into the console.
Review URL: http://codereview.chromium.org/126132
TBR=pfeldman@chromium.org
Review URL: http://codereview.chromium.org/126217
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.cc | 29 | ||||
-rw-r--r-- | webkit/glue/devtools/debugger_agent_impl.h | 6 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools.js | 36 | ||||
-rw-r--r-- | webkit/glue/devtools/js/dom_agent.js | 18 | ||||
-rw-r--r-- | webkit/glue/devtools/js/inject.js | 126 | ||||
-rw-r--r-- | webkit/glue/devtools/js/inject_dispatch.js | 13 | ||||
-rw-r--r-- | webkit/glue/devtools/tools_agent.h | 12 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.cc | 60 | ||||
-rw-r--r-- | webkit/glue/webdevtoolsagent_impl.h | 7 |
9 files changed, 117 insertions, 190 deletions
diff --git a/webkit/glue/devtools/debugger_agent_impl.cc b/webkit/glue/devtools/debugger_agent_impl.cc index 4fb5f243..41ee6d1 100644 --- a/webkit/glue/devtools/debugger_agent_impl.cc +++ b/webkit/glue/devtools/debugger_agent_impl.cc @@ -9,6 +9,7 @@ #include <wtf/Vector.h> #include "Document.h" +#include "Node.h" #include "Page.h" #undef LOG @@ -29,6 +30,7 @@ using WebCore::DOMWindow; using WebCore::Document; using WebCore::Frame; +using WebCore::Node; using WebCore::Page; using WebCore::String; using WebCore::V8ClassIndex; @@ -152,6 +154,7 @@ void DebuggerAgentImpl::ResetUtilityContext( String DebuggerAgentImpl::ExecuteUtilityFunction( v8::Handle<v8::Context> context, const String &function_name, + Node* node, const String& json_args, String* exception) { v8::HandleScope scope; @@ -160,17 +163,20 @@ String DebuggerAgentImpl::ExecuteUtilityFunction( v8::Handle<v8::Function> function = v8::Local<v8::Function>::Cast( context->Global()->Get(v8::String::New("devtools$$dispatch"))); + v8::Handle<v8::Value> node_wrapper = + V8Proxy::ToV8Object(V8ClassIndex::NODE, node); v8::Handle<v8::String> function_name_wrapper = v8::Handle<v8::String>( v8::String::New(function_name.utf8().data())); v8::Handle<v8::String> json_args_wrapper = v8::Handle<v8::String>( v8::String::New(json_args.utf8().data())); v8::Handle<v8::Value> args[] = { function_name_wrapper, + node_wrapper, json_args_wrapper }; v8::TryCatch try_catch; - v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 2, args); + v8::Handle<v8::Value> res_obj = function->Call(context->Global(), 3, args); if (try_catch.HasCaught()) { *exception = WebCore::ToWebCoreString(try_catch.Message()->Get()); return ""; @@ -180,6 +186,27 @@ String DebuggerAgentImpl::ExecuteUtilityFunction( } } +String DebuggerAgentImpl::EvaluateJavaScript( + Frame* frame, + const String &source_code, + bool* is_exception) { + v8::HandleScope scope; + v8::Handle<v8::Context> context = V8Proxy::GetContext(frame); + v8::Context::Scope context_scope(context); + v8::Local<v8::String> code = v8ExternalString(source_code); + + V8Proxy* proxy = V8Proxy::retrieve(frame); + v8::TryCatch try_catch; + v8::Handle<v8::Script> script = proxy->CompileScript(code, "", 0); + v8::Local<v8::Value> object = proxy->RunScript(script, true); + if (try_catch.HasCaught()) { + *is_exception = true; + return WebCore::ToWebCoreString(try_catch.Message()->Get()); + } else { + return WebCore::toWebCoreStringWithNullCheck(object); + } +} + WebCore::Page* DebuggerAgentImpl::GetPage() { return web_view_impl_->page(); } diff --git a/webkit/glue/devtools/debugger_agent_impl.h b/webkit/glue/devtools/debugger_agent_impl.h index 4d57b91..55d5ec8 100644 --- a/webkit/glue/devtools/debugger_agent_impl.h +++ b/webkit/glue/devtools/debugger_agent_impl.h @@ -54,9 +54,15 @@ class DebuggerAgentImpl : public DebuggerAgent { WebCore::String ExecuteUtilityFunction( v8::Handle<v8::Context> context, const WebCore::String& function_name, + WebCore::Node* node, const WebCore::String& json_args, WebCore::String* exception); + WebCore::String EvaluateJavaScript( + WebCore::Frame* frame, + const WebCore::String& source_code, + bool* is_exception); + WebCore::Page* GetPage(); WebDevToolsAgentImpl* webdevtools_agent() { return webdevtools_agent_; }; diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js index 651ca94..b1aede6 100644 --- a/webkit/glue/devtools/js/devtools.js +++ b/webkit/glue/devtools/js/devtools.js @@ -75,12 +75,8 @@ devtools.ToolsAgent.prototype.reset = function() { * result. */ devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, callback) { - var callbackId = devtools.Callback.wrap(function(result) { - var pair = JSON.parse(result); - callback(pair[0], pair[1]); - }); - RemoteToolsAgent.ExecuteUtilityFunction(callbackId, - 'evaluate', JSON.stringify([script])); + var callbackId = devtools.Callback.wrap(callback); + RemoteToolsAgent.EvaluateJavaScript(callbackId, script); }; @@ -911,28 +907,9 @@ WebInspector.UIString = function(string) { } return result; }; - - // This is needed to evaluate 'instanceof' against win.Node, etc. - // Need a real window, not just InspectorController.inspectedWindow wrapper. - var oldType = Object.type; - Object.type = function(obj) { - return oldType.call(this, obj, window); - }; })(); -Object.sortedProperties = function(obj) { - var properties = []; - for (var prop in obj) { - if (prop != '___devtools_id') { - properties.push(prop); - } - } - properties.sort(); - return properties; -} - - // Highlight extension content scripts in the scripts list. (function () { var original = WebInspector.ScriptsPanel.prototype._addScriptToFilesMenu; @@ -947,12 +924,3 @@ Object.sortedProperties = function(obj) { return result; }; })(); - - -WebInspector.Console.prototype._formatobject = function(object, elem) { - var wrapper = {}; - wrapper.id_ = object.___devtools_id; - wrapper.protoDepth_ = -1; - var section = new WebInspector.SidebarObjectPropertiesSection(wrapper, null); - elem.appendChild(section.element); -}; diff --git a/webkit/glue/devtools/js/dom_agent.js b/webkit/glue/devtools/js/dom_agent.js index f9304b7..2092d6d 100644 --- a/webkit/glue/devtools/js/dom_agent.js +++ b/webkit/glue/devtools/js/dom_agent.js @@ -840,8 +840,8 @@ devtools.DomAgent.prototype.getNodePropertiesAsync = function(nodeId, path, protoDepth, callback) { var callbackId = this.utilityFunctionCallbackWrapper_(callback); RemoteToolsAgent.ExecuteUtilityFunction(callbackId, - 'getProperties', - JSON.stringify([nodeId, path, protoDepth])); + 'getProperties', nodeId, + JSON.stringify([path, protoDepth])); }; @@ -854,7 +854,7 @@ devtools.DomAgent.prototype.getNodePrototypesAsync = function(nodeId, callback) { var callbackId = this.utilityFunctionCallbackWrapper_(callback); RemoteToolsAgent.ExecuteUtilityFunction(callbackId, - 'getPrototypes', JSON.stringify([nodeId])); + 'getPrototypes', nodeId, '[]'); }; @@ -869,7 +869,8 @@ devtools.DomAgent.prototype.getNodeStylesAsync = function(node, var callbackId = this.utilityFunctionCallbackWrapper_(callback); RemoteToolsAgent.ExecuteUtilityFunction(callbackId, 'getStyles', - JSON.stringify([node.id_, authorOnly])); + node.id_, + JSON.stringify([authorOnly])); }; @@ -885,7 +886,8 @@ devtools.DomAgent.prototype.toggleNodeStyleAsync = function( var callbackId = this.utilityFunctionCallbackWrapper_(callback); RemoteToolsAgent.ExecuteUtilityFunction(callbackId, 'toggleNodeStyle', - JSON.stringify([style.nodeId_, style.id_, enabled, name])); + style.nodeId_, + JSON.stringify([style.id_, enabled, name])); }; @@ -902,7 +904,8 @@ devtools.DomAgent.prototype.applyStyleTextAsync = function( RemoteToolsAgent.ExecuteUtilityFunction( callbackId, 'applyStyleText', - JSON.stringify([style.nodeId_, style.id_, name, styleText])); + style.nodeId_, + JSON.stringify([style.id_, name, styleText])); }; @@ -919,7 +922,8 @@ devtools.DomAgent.prototype.setStylePropertyAsync = function( RemoteToolsAgent.ExecuteUtilityFunction( callbackId, 'setStyleProperty', - JSON.stringify([node.id_, name, value])); + node.id_, + JSON.stringify([name, value])); }; diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js index 7a88f30..251501a 100644 --- a/webkit/glue/devtools/js/inject.js +++ b/webkit/glue/devtools/js/inject.js @@ -28,50 +28,20 @@ devtools.Injected = function() { * @private */ this.styles_ = []; - - /** - * This cache contains mapping from object it to an object instance for - * all results of the evaluation / console logs. - */ - this.cachedConsoleObjects_ = {}; - - /** - * Last id for the cache above. - */ - this.lastCachedConsoleObjectId_ = 1; -}; - - -/** - * Returns object for given id. This can be either node wrapper for - * integer ids or evaluation results that recide in cached console - * objects cache for arbitrary keys. - * @param {number|string} id Id to get object for. - * @return {Object} resolved object. - */ -devtools.Injected.prototype.getObjectForId_ = function(id) { - if (typeof id == 'number') { - return DevToolsAgentHost.getNodeForId(id); - } - return this.cachedConsoleObjects_[id]; }; /** * Returns array of properties for a given node on a given path. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get property value for. * @param {Array.<string>} path Path to the nested object. * @param {number} protoDepth Depth of the actual proto to inspect. * @return {Array.<Object>} Array where each property is represented * by the tree entries [{string} type, {string} name, {Object} value]. */ -devtools.Injected.prototype.getProperties = - function(nodeId, path, protoDepth) { +devtools.Injected.prototype.getProperties = function(node, path, protoDepth) { var result = []; - var obj = this.getObjectForId_(nodeId); - if (!obj) { - return []; - } + var obj = node; // Follow the path. for (var i = 0; obj && i < path.length; ++i) { @@ -103,7 +73,8 @@ devtools.Injected.prototype.getProperties = if (type == 'string') { var str = obj[name]; result.push(str.length > 99 ? str.substr(0, 99) + '...' : str); - } else if (type != 'object' && type != 'function') { + } else if (type != 'object' && type != 'array' && + type != 'function') { result.push(obj[name]); } else { result.push(undefined); @@ -115,15 +86,10 @@ devtools.Injected.prototype.getProperties = /** * Returns array of prototypes for a given node. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get prorotypes for. * @return {Array<string>} Array of proto names. */ -devtools.Injected.prototype.getPrototypes = function(nodeId) { - var node = DevToolsAgentHost.getNodeForId(nodeId); - if (!node) { - return []; - } - +devtools.Injected.prototype.getPrototypes = function(node) { var result = []; for (var prototype = node; prototype; prototype = prototype.__proto__) { var description = Object.prototype.toString.call(prototype); @@ -135,18 +101,13 @@ devtools.Injected.prototype.getPrototypes = function(nodeId) { /** * Returns style information that is used in devtools.js. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get prorotypes for. * @param {boolean} authorOnly Determines whether only author styles need to * be added. * @return {string} Style collection descriptor. */ -devtools.Injected.prototype.getStyles = function(nodeId, authorOnly) { - var node = DevToolsAgentHost.getNodeForId(nodeId); - if (!node) { - return {}; - } - - if (node.nodeType != Node.ELEMENT_NODE) { +devtools.Injected.prototype.getStyles = function(node, authorOnly) { + if (!node.nodeType == Node.ELEMENT_NODE) { return {}; } var matchedRules = window.getMatchedCSSRules(node, '', false); @@ -221,6 +182,8 @@ devtools.Injected.prototype.getStyleForId_ = function(node, id) { }; + + /** * Converts given style into serializable object. * @param {CSSStyleDeclaration} style Style to serialize. @@ -261,18 +224,13 @@ devtools.Injected.prototype.serializeStyle_ = function(style, opt_bind) { /** * Toggles style with given id on/off. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get prorotypes for. * @param {number} styleId Id of style to toggle. * @param {boolean} enabled Determines value to toggle to, * @param {string} name Name of the property. */ -devtools.Injected.prototype.toggleNodeStyle = function(nodeId, styleId, - enabled, name) { - var node = DevToolsAgentHost.getNodeForId(nodeId); - if (!node) { - return false; - } - +devtools.Injected.prototype.toggleNodeStyle = function(node, styleId, enabled, + name) { var style = this.getStyleForId_(node, styleId); if (!style) { return false; @@ -315,19 +273,14 @@ devtools.Injected.prototype.toggleNodeStyle = function(nodeId, styleId, /** * Applies given text to a style. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get prorotypes for. * @param {number} styleId Id of style to toggle. * @param {string} name Style element name. * @param {string} styleText New style text. * @return {boolean} True iff style has been edited successfully. */ -devtools.Injected.prototype.applyStyleText = function(nodeId, styleId, +devtools.Injected.prototype.applyStyleText = function(node, styleId, name, styleText) { - var node = DevToolsAgentHost.getNodeForId(nodeId); - if (!node) { - return false; - } - var style = this.getStyleForId_(node, styleId); if (!style) { return false; @@ -388,18 +341,13 @@ devtools.Injected.prototype.applyStyleText = function(nodeId, styleId, /** * Sets style property with given name to a value. - * @param {number} nodeId Id of node to get prorotypes for. + * @param {Node} node Node to get prorotypes for. * @param {string} name Style element name. * @param {string} value Value. * @return {boolean} True iff style has been edited successfully. */ -devtools.Injected.prototype.setStyleProperty = function(nodeId, +devtools.Injected.prototype.setStyleProperty = function(node, name, value) { - var node = DevToolsAgentHost.getNodeForId(nodeId); - if (!node) { - return false; - } - node.style.setProperty(name, value, ""); return true; }; @@ -513,39 +461,3 @@ devtools.Injected.prototype.getUniqueStyleProperties_ = function(style) { } return properties; }; - - -/** - * Caches console object for subsequent calls to getConsoleObjectProperties. - * @param {Object} obj Object to cache. - * @return {Object} console object wrapper. - */ -devtools.Injected.prototype.wrapConsoleObject = function(obj) { - var type = typeof obj; - if (type == 'object' || type == 'function') { - var objId = '#consoleobj#' + this.lastCachedConsoleObjectId_++; - this.cachedConsoleObjects_[objId] = obj; - var result = { ___devtools_id : objId }; - // Loop below fills dummy object with properties for completion. - for (var name in obj) { - result[name] = ''; - } - return result; - } else { - return obj; - } -}; - - -/** - * Caches console object for subsequent calls to getConsoleObjectProperties. - * @param {Object} obj Object to cache. - * @return {string} console object id. - */ -devtools.Injected.prototype.evaluate = function(expression) { - try { - return [ this.wrapConsoleObject(window.eval(expression)), false ]; - } catch (e) { - return [ e.toString(), true ]; - } -}; diff --git a/webkit/glue/devtools/js/inject_dispatch.js b/webkit/glue/devtools/js/inject_dispatch.js index e02784f..c50b123 100644 --- a/webkit/glue/devtools/js/inject_dispatch.js +++ b/webkit/glue/devtools/js/inject_dispatch.js @@ -21,11 +21,13 @@ var devtools$$obj = new devtools.Injected(); /** * Main dispatch method, all calls from the host go through this one. * @param {string} functionName Function to call + * @param {Node} node Node context of the call. * @param {string} json_args JSON-serialized call parameters. * @return {string} JSON-serialized result of the dispatched call. */ -function devtools$$dispatch(functionName, json_args) { +function devtools$$dispatch(functionName, node, json_args) { var params = JSON.parse(json_args); + params.splice(0, 0, node); var result = devtools$$obj[functionName].apply(devtools$$obj, params); return JSON.stringify(result); }; @@ -51,9 +53,14 @@ var dispatch = function(method, var_args) { // Skip first argument since it is serializable. // Method has index 0, first argument has index 1. Skip both. for (var i = 2; i < args.length; ++i) { - args[i] = devtools$$obj.wrapConsoleObject(args[i]); + var type = typeof args[i]; + if (type == 'object') { + args[i] = Object.prototype.toString(args[i]); + } else if (type == 'function') { + args[i] = args[i].toString(); + } } } var call = JSON.stringify(args); - DevToolsAgentHost.dispatch(call); + RemoteWebInspector.dispatch(call); }; diff --git a/webkit/glue/devtools/tools_agent.h b/webkit/glue/devtools/tools_agent.h index 88c9a9d..af8b639 100644 --- a/webkit/glue/devtools/tools_agent.h +++ b/webkit/glue/devtools/tools_agent.h @@ -16,9 +16,13 @@ /* Clears Dom Node highlight. */ \ METHOD0(HideDOMNodeHighlight) \ \ + /* Executes JavaScript in the context of the inspected window. */ \ + METHOD2(EvaluateJavaScript, int /* call_id */, String /* JS expression */) \ + \ /* Requests that utility js function is executed with the given args. */ \ - METHOD3(ExecuteUtilityFunction, int /* call_id */, \ - String /* function_name */, String /* json_args */) \ + METHOD4(ExecuteUtilityFunction, int /* call_id */, \ + String /* function_name */, int /* context_node_id */, \ + String /* json_args */) \ \ /* Clears cached console messages. */ \ METHOD0(ClearConsoleMessages) \ @@ -37,6 +41,10 @@ DEFINE_RPC_CLASS(ToolsAgent, TOOLS_AGENT_STRUCT) /* Updates focused node on the client. */ \ METHOD1(UpdateFocusedNode, int /* node_id */) \ \ + /* Response message to EvaluateJavaScript. */ \ + METHOD3(DidEvaluateJavaScript, int /* call_id */, String /* result */, \ + bool /* isException */) \ + \ /* Updates focused node on the client. */ \ METHOD2(FrameNavigate, std::string /* url */, bool /* top_level */) \ \ diff --git a/webkit/glue/webdevtoolsagent_impl.cc b/webkit/glue/webdevtoolsagent_impl.cc index cd8e30ac..c3a6181 100644 --- a/webkit/glue/webdevtoolsagent_impl.cc +++ b/webkit/glue/webdevtoolsagent_impl.cc @@ -42,8 +42,6 @@ using WebCore::Node; using WebCore::Page; using WebCore::ScriptValue; using WebCore::String; -using WebCore::V8ClassIndex; -using WebCore::V8Proxy; WebDevToolsAgentImpl::WebDevToolsAgentImpl( WebViewImpl* web_view_impl, @@ -85,15 +83,21 @@ void WebDevToolsAgentImpl::Attach() { // Reuse existing context in case detached/attached. if (utility_context_.IsEmpty()) { debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_); - InitDevToolsAgentHost(); } - dom_agent_impl_->SetDocument(doc); + web_inspector_stub_.set( + new BoundObject(utility_context_, this, "RemoteWebInspector")); + web_inspector_stub_->AddProtoFunction( + "dispatch", + WebDevToolsAgentImpl::JsDispatchOnClient); + web_inspector_stub_->Build(); InspectorController* ic = web_view_impl_->page()->inspectorController(); + // Unhide resources panel if necessary. tools_agent_delegate_stub_->SetResourcesPanelEnabled( ic->resourceTrackingEnabled()); + v8::HandleScope scope; ic->setFrontendProxyObject( scriptStateFromPage(web_view_impl_->page()), @@ -109,7 +113,7 @@ void WebDevToolsAgentImpl::Detach() { InspectorController* ic = web_view_impl_->page()->inspectorController(); ic->setWindowVisible(false, false); HideDOMNodeHighlight(); - devtools_agent_host_.set(NULL); + web_inspector_stub_.set(NULL); debugger_agent_impl_.set(NULL); dom_agent_impl_.set(NULL); attached_ = false; @@ -129,9 +133,6 @@ void WebDevToolsAgentImpl::SetMainFrameDocumentReady(bool ready) { doc = NULL; } debugger_agent_impl_->ResetUtilityContext(doc, &utility_context_); - if (doc) { - InitDevToolsAgentHost(); - } dom_agent_impl_->SetDocument(doc); } @@ -183,14 +184,31 @@ void WebDevToolsAgentImpl::HideDOMNodeHighlight() { } } +void WebDevToolsAgentImpl::EvaluateJavaScript(int call_id, const String& js) { + String result; + bool is_exception = false; + + Page* page = web_view_impl_->page(); + if (page->mainFrame()) { + result = debugger_agent_impl_->EvaluateJavaScript(page->mainFrame(), + js, &is_exception); + } + tools_agent_delegate_stub_->DidEvaluateJavaScript( + call_id, result, is_exception); +} + void WebDevToolsAgentImpl::ExecuteUtilityFunction( int call_id, const String& function_name, + int node_id, const String& json_args) { + Node* node = dom_agent_impl_->GetNodeForId(node_id); String result; String exception; - result = debugger_agent_impl_->ExecuteUtilityFunction(utility_context_, - function_name, json_args, &exception); + if (node) { + result = debugger_agent_impl_->ExecuteUtilityFunction(utility_context_, + function_name, node, json_args, &exception); + } tools_agent_delegate_stub_->DidExecuteUtilityFunction(call_id, result, exception); } @@ -276,18 +294,6 @@ void WebDevToolsAgentImpl::SendRpcMessage( delegate_->SendMessageToClient(class_name, method_name, raw_msg); } -void WebDevToolsAgentImpl::InitDevToolsAgentHost() { - devtools_agent_host_.set( - new BoundObject(utility_context_, this, "DevToolsAgentHost")); - devtools_agent_host_->AddProtoFunction( - "dispatch", - WebDevToolsAgentImpl::JsDispatchOnClient); - devtools_agent_host_->AddProtoFunction( - "getNodeForId", - WebDevToolsAgentImpl::JsGetNodeForId); - devtools_agent_host_->Build(); -} - // static v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient( const v8::Arguments& args) { @@ -303,16 +309,6 @@ v8::Handle<v8::Value> WebDevToolsAgentImpl::JsDispatchOnClient( } // static -v8::Handle<v8::Value> WebDevToolsAgentImpl::JsGetNodeForId( - const v8::Arguments& args) { - int node_id = static_cast<int>(args[0]->NumberValue()); - WebDevToolsAgentImpl* agent = static_cast<WebDevToolsAgentImpl*>( - v8::External::Cast(*args.Data())->Value()); - Node* node = agent->dom_agent_impl_->GetNodeForId(node_id); - return V8Proxy::ToV8Object(V8ClassIndex::NODE, node); -} - -// static void WebDevToolsAgent::ExecuteDebuggerCommand( const std::string& command, int caller_id) { diff --git a/webkit/glue/webdevtoolsagent_impl.h b/webkit/glue/webdevtoolsagent_impl.h index 60ca0fe..99fb3b5 100644 --- a/webkit/glue/webdevtoolsagent_impl.h +++ b/webkit/glue/webdevtoolsagent_impl.h @@ -44,9 +44,11 @@ class WebDevToolsAgentImpl // ToolsAgent implementation. virtual void HighlightDOMNode(int node_id); virtual void HideDOMNodeHighlight(); + virtual void EvaluateJavaScript(int call_id, const String& js); virtual void ExecuteUtilityFunction( int call_id, const WebCore::String& function_name, + int node_id, const WebCore::String& json_args); virtual void ClearConsoleMessages(); virtual void GetResourceContent( @@ -81,9 +83,6 @@ class WebDevToolsAgentImpl private: static v8::Handle<v8::Value> JsDispatchOnClient(const v8::Arguments& args); - static v8::Handle<v8::Value> JsGetNodeForId(const v8::Arguments& args); - - void InitDevToolsAgentHost(); int host_id_; WebDevToolsAgentDelegate* delegate_; @@ -99,7 +98,7 @@ class WebDevToolsAgentImpl // TODO(pfeldman): This should not be needed once GC styles issue is fixed // for matching rules. v8::Persistent<v8::Context> utility_context_; - OwnPtr<BoundObject> devtools_agent_host_; + OwnPtr<BoundObject> web_inspector_stub_; DISALLOW_COPY_AND_ASSIGN(WebDevToolsAgentImpl); }; |