diff options
author | Ben Murdoch <benm@google.com> | 2010-08-11 14:44:44 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2010-08-12 19:15:41 +0100 |
commit | dd8bb3de4f353a81954234999f1fea748aee2ea9 (patch) | |
tree | 729b52bf09294f0d6c67cd5ea80aee1b727b7bd8 /WebKit/chromium/src/js/DevTools.js | |
parent | f3d41ba51d86bf719c7a65ab5297aea3c17e2d98 (diff) | |
download | external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.zip external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.gz external_webkit-dd8bb3de4f353a81954234999f1fea748aee2ea9.tar.bz2 |
Merge WebKit at r65072 : Initial merge by git.
Change-Id: Ibcf418498376b2660aacb7f8d46ea7085ef91585
Diffstat (limited to 'WebKit/chromium/src/js/DevTools.js')
-rw-r--r-- | WebKit/chromium/src/js/DevTools.js | 71 |
1 files changed, 9 insertions, 62 deletions
diff --git a/WebKit/chromium/src/js/DevTools.js b/WebKit/chromium/src/js/DevTools.js index 674f1d7..895c68b 100644 --- a/WebKit/chromium/src/js/DevTools.js +++ b/WebKit/chromium/src/js/DevTools.js @@ -41,44 +41,22 @@ * @prama {string} methodName * @param {string} param1, param2, param3 Arguments to dispatch. */ -devtools$$dispatch = function(remoteName, methodName, param1, param2, param3) +devtools$$dispatch = function(message) { - remoteName = "Remote" + remoteName.substring(0, remoteName.length - 8); - var agent = window[remoteName]; - if (!agent) { - debugPrint("No remote agent '" + remoteName + "' found."); - return; - } - var method = agent[methodName]; - if (!method) { - debugPrint("No method '" + remoteName + "." + methodName + "' found."); - return; - } - method.call(this, param1, param2, param3); + var args = typeof message === "string" ? JSON.parse(message) : message; + var methodName = args[0]; + var parameters = args.slice(1); + WebInspector[methodName].apply(WebInspector, parameters); }; devtools.ToolsAgent = function() { - RemoteToolsAgent.didDispatchOn = WebInspector.Callback.processCallback; - RemoteToolsAgent.dispatchOnClient = this.dispatchOnClient_.bind(this); this.profilerAgent_ = new devtools.ProfilerAgent(); }; /** - * @param {string} script Script exression to be evaluated in the context of the - * inspected page. - * @param {function(Object|string, boolean):undefined} opt_callback Function to - * call with the result. - */ -devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, opt_callback) -{ - InspectorBackend.evaluate(script, opt_callback || function() {}); -}; - - -/** * @return {devtools.ProfilerAgent} Profiler agent instance. */ devtools.ToolsAgent.prototype.getProfilerAgent = function() @@ -87,38 +65,6 @@ devtools.ToolsAgent.prototype.getProfilerAgent = function() }; -/** - * @param {string} message Serialized call to be dispatched on WebInspector. - * @private - */ -devtools.ToolsAgent.prototype.dispatchOnClient_ = function(message) -{ - var args = typeof message === "string" ? JSON.parse(message) : message; - var methodName = args[0]; - var parameters = args.slice(1); - WebInspector[methodName].apply(WebInspector, parameters); -}; - - -/** - * Evaluates js expression. - * @param {string} expr - */ -devtools.ToolsAgent.prototype.evaluate = function(expr) -{ - RemoteToolsAgent.evaluate(expr); -}; - - -/** - * Prints string to the inspector console or shows alert if the console doesn't - * exist. - * @param {string} text - */ -function debugPrint(text) { - WebInspector.log(text); -} - /** * Global instance of the tools agent. @@ -142,13 +88,15 @@ var context = {}; // Used by WebCore's inspector routines. } if ("page" in WebInspector._paramsObject) { WebInspector.socket = new WebSocket("ws://" + window.location.host + "/devtools/page/" + WebInspector._paramsObject.page); - WebInspector.socket.onmessage = function(message) { eval(message.data); } + WebInspector.socket.onmessage = function(message) { devtools$$dispatch(message.data); } WebInspector.socket.onerror = function(error) { console.err(error); } WebInspector.socket.onopen = function() { WebInspector.socketOpened = true; if (WebInspector.loadedDone) WebInspector.doLoadedDone(); }; + InspectorFrontendHost.sendMessageToBackend = WebInspector.socket.send.bind(WebInspector.socket); + InspectorFrontendHost.loaded = WebInspector.socket.send.bind(WebInspector.socket, "loaded"); } })(); /////////////////////////////////////////////////////////////////////////////// @@ -165,7 +113,7 @@ WebInspector.loaded = function() Preferences.debuggerAlwaysEnabled = true; Preferences.profilerAlwaysEnabled = true; Preferences.canEditScriptSource = true; - + Preferences.onlineDetectionEnabled = false; if ("page" in WebInspector._paramsObject) { WebInspector.loadedDone = true; if (WebInspector.socketOpened) @@ -177,7 +125,6 @@ WebInspector.loaded = function() WebInspector.doLoadedDone = function() { oldLoaded.call(this); - InspectorFrontendHost.loaded(); } devtools.domContentLoaded = function() |