summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 12:37:08 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-30 12:37:08 +0000
commitb2277d66b68e535468d240912333651c9ac5fefb (patch)
treecc94692d4ae9ed20587f8da53016db1fa41ab184 /webkit
parent7d98e70ebe1e4d06ceff625017ff11eea71f2e72 (diff)
downloadchromium_src-b2277d66b68e535468d240912333651c9ac5fefb.zip
chromium_src-b2277d66b68e535468d240912333651c9ac5fefb.tar.gz
chromium_src-b2277d66b68e535468d240912333651c9ac5fefb.tar.bz2
1. Added 'scripts' command response handler that populates Scripts panel with script sources.
2. Modify WebDevToolsClientImpl::JsAddSourceToFrame so that it returns false when fails. Review URL: http://codereview.chromium.org/56058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js126
-rw-r--r--webkit/glue/devtools/js/inspector_controller_impl.js3
-rw-r--r--webkit/glue/webdevtoolsclient_impl.cc6
3 files changed, 71 insertions, 64 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index d1edb4d..abc774b 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -23,10 +23,12 @@ devtools.DebuggerAgent = function() {
* processed in handleScriptsResponse_.
*/
devtools.DebuggerAgent.prototype.requestScripts = function() {
- var cmd = new devtools.DebugCommand("scripts");
- RemoteDebuggerCommandExecutor.DebuggerCommand(cmd.toJSONProtocol());
+ var cmd = new devtools.DebugCommand('scripts', {
+ 'includeSource': true
+ });
+ RemoteDebuggerCommandExecutor.DebuggerCommand(cmd.toJSONProtocol());
// Force v8 execution so that it gets to processing the requested command.
- devtools.tools.evaluateJavaSctipt("javascript:void(0)");
+ devtools.tools.evaluateJavaSctipt('javascript:void(0)');
};
@@ -37,75 +39,80 @@ devtools.DebuggerAgent.prototype.requestScripts = function() {
* @param {string} output
*/
devtools.DebuggerAgent.prototype.handleDebuggerOutput_ = function(output) {
- debugPrint("handleDebuggerOutput_: " + output)
var msg;
try {
msg = new devtools.DebuggerMessage(output);
} catch(e) {
- debugPrint("Failed to handle debugger reponse:\n" + e);
+ debugPrint('Failed to handle debugger reponse:\n' + e);
throw e;
}
- if (response.getType() == "response") {
- if (msg.getCommand() == "scripts") {
+ if (msg.getType() == 'response') {
+ if (msg.getCommand() == 'scripts') {
this.handleScriptsResponse_(msg);
}
}
};
-/**
- * @param {devtools.DebuggerMessage} msg
- */
+/**
+ * @param {devtools.DebuggerMessage} msg
+ */
devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) {
- debugPrint("handleScriptsResponse_: " + msg)
-};
-
-
-
-/**
- * JSON based commands sent to v8 debugger.
- * @constructor
- */
-devtools.DebugCommand = function(command, opt_arguments) {
- this.command_ = command;
- this.type_ = "request";
- this.seq_ = ++devtools.DebugCommand.nextSeq_;
- if (opt_arguments) {
- this.arguments_ = opt_arguments;
- }
-};
-
-
-/**
- * Next unique number to be used as debugger request sequence number.
- * @type {number}
- */
-devtools.DebugCommand.nextSeq_ = 1;
-
-
-/**
- * @return {number}
- */
-devtools.DebugCommand.prototype.getSequenceNumber = function() {
- return this.seq_;
-};
-
-
-/**
- * @return {string}
- */
-devtools.DebugCommand.prototype.toJSONProtocol = function() {
- var json = {
- 'seq': this.seq_,
- 'type': this.type_,
- 'command': this.command_
- }
- if (this.arguments_) {
- json.arguments = this.arguments_;
- }
- return goog.json.serialize(json);
-};
+ var scripts = msg.getBody();
+ for (var i = 0; i < scripts.length; i++) {
+ var script = scripts[i];
+ WebInspector.parsedScriptSource(
+ script.id, script.name, script.source, script.lineOffset);
+ }
+};
+
+
+/**
+ * JSON based commands sent to v8 debugger.
+ * @param {string} command Name of the command to execute.
+ * @param {Object} opt_arguments Command-specific arguments map.
+ * @constructor
+ */
+devtools.DebugCommand = function(command, opt_arguments) {
+ this.command_ = command;
+ this.type_ = 'request';
+ this.seq_ = ++devtools.DebugCommand.nextSeq_;
+ if (opt_arguments) {
+ this.arguments_ = opt_arguments;
+ }
+};
+
+
+/**
+ * Next unique number to be used as debugger request sequence number.
+ * @type {number}
+ */
+devtools.DebugCommand.nextSeq_ = 1;
+
+
+/**
+ * @return {number}
+ */
+devtools.DebugCommand.prototype.getSequenceNumber = function() {
+ return this.seq_;
+};
+
+
+/**
+ * @return {string}
+ */
+devtools.DebugCommand.prototype.toJSONProtocol = function() {
+ var json = {
+ 'seq': this.seq_,
+ 'type': this.type_,
+ 'command': this.command_
+ }
+ if (this.arguments_) {
+ json.arguments = this.arguments_;
+ }
+ return goog.json.serialize(json);
+};
@@ -116,7 +123,8 @@ devtools.DebugCommand.prototype.toJSONProtocol = function() {
* @constructor
*/
devtools.DebuggerMessage = function(msg) {
- this.packet_ = msg;
+ var jsExpression = '[' + msg + '][0]';
+ this.packet_ = eval(jsExpression);
this.refs_ = [];
if (this.packet_.refs) {
for (var i = 0; i < this.packet_.refs.length; i++) {
diff --git a/webkit/glue/devtools/js/inspector_controller_impl.js b/webkit/glue/devtools/js/inspector_controller_impl.js
index e199bd1..d1af612 100644
--- a/webkit/glue/devtools/js/inspector_controller_impl.js
+++ b/webkit/glue/devtools/js/inspector_controller_impl.js
@@ -45,8 +45,7 @@ devtools.InspectorControllerImpl.prototype.addSourceToFrame =
if (!element.id) {
element.id = "f" + this.frame_element_id_++;
}
- DevToolsHost.addSourceToFrame(mimeType, source, element.id);
- return true;
+ return DevToolsHost.addSourceToFrame(mimeType, source, element.id);
};
diff --git a/webkit/glue/webdevtoolsclient_impl.cc b/webkit/glue/webdevtoolsclient_impl.cc
index 588da84..bcee3d2 100644
--- a/webkit/glue/webdevtoolsclient_impl.cc
+++ b/webkit/glue/webdevtoolsclient_impl.cc
@@ -143,15 +143,15 @@ void WebDevToolsClientImpl::JsAddSourceToFrame(
Node* node = document->getElementById(
webkit_glue::StdStringToString(node_id));
if (!node) {
- result->SetNull();
+ result->Set(false);
return;
}
- page->inspectorController()->addSourceToFrame(
+ bool r = page->inspectorController()->addSourceToFrame(
webkit_glue::StdStringToString(mime_type),
webkit_glue::StdStringToString(source),
node);
- result->SetNull();
+ result->Set(r);
}
void WebDevToolsClientImpl::JsLoaded(