summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 12:29:12 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-20 12:29:12 +0000
commit64569cce3a56ca39eea8712a4f91caad7de32be2 (patch)
tree068a0a7feafa54a1da98d068e4ee3299d0104f5a
parent8a48cbbf221ce5af1b09fdf818d5b660f36f8ca0 (diff)
downloadchromium_src-64569cce3a56ca39eea8712a4f91caad7de32be2.zip
chromium_src-64569cce3a56ca39eea8712a4f91caad7de32be2.tar.gz
chromium_src-64569cce3a56ca39eea8712a4f91caad7de32be2.tar.bz2
DevTools: if the number of actual parameters is greater than number of the formal ones they will be available in the arguments array as elements without names. We shouldn't show such properties in the scope variables panel.
Review URL: http://codereview.chromium.org/113630 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16473 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js38
1 files changed, 25 insertions, 13 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index 9f0c2a3..4d84f6d 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -718,10 +718,10 @@ devtools.DebuggerAgent.formatCallFrame_ = function(stackFrame, script, msg) {
var scope = {};
// Add arguments.
- devtools.DebuggerAgent.valuesArrayToMap_(stackFrame.arguments, scope);
+ devtools.DebuggerAgent.argumentsArrayToMap_(stackFrame.arguments, scope);
// Add local variables.
- devtools.DebuggerAgent.valuesArrayToMap_(stackFrame.locals, scope);
+ devtools.DebuggerAgent.propertiesToMap_(stackFrame.locals, scope);
var thisObject = devtools.DebuggerAgent.formatObjectReference_(
stackFrame.receiver);
@@ -760,29 +760,41 @@ devtools.DebuggerAgent.formatObjectProperties_ = function(object, result) {
/**
* For each property in 'properties' puts its name and user-friendly value into
* 'map'.
- * @param {Array.<Object>} properties Receiver properties array from 'backtrace'
- * response.
+ * @param {Array.<Object>} properties Receiver properties or locals array from
+ * 'backtrace' response.
* @param {Object} map Result holder.
*/
devtools.DebuggerAgent.propertiesToMap_ = function(properties, map) {
for (var j = 0; j < properties.length; j++) {
var nextValue = properties[j];
- map[nextValue.name] =
- devtools.DebuggerAgent.formatObjectReference_(nextValue.value);
+ // Skip unnamed properties. They may appear e.g. when number of actual
+ // parameters is greater the that of formal. In that case the superfluous
+ // parameters will be present in the arguments list as elements without
+ // names.
+ if (nextValue.name) {
+ map[nextValue.name] =
+ devtools.DebuggerAgent.formatObjectReference_(nextValue.value);
+ }
}
};
/**
- * For each property in 'array' puts its name and user-friendly value into
- * 'map'. Each object referenced from the array is expected to be included in
- * the message.
- * @param {Array.<Object>} array Arguments or locals array from 'backtrace'
- * response.
+ * Puts arguments from the protocol arguments array to the map assigning names
+ * to the anonymous arguments.
+ * @param {Array.<Object>} array Arguments array from 'backtrace' response.
* @param {Object} map Result holder.
*/
-devtools.DebuggerAgent.valuesArrayToMap_ = function(array, map) {
- this.propertiesToMap_(array, map);
+devtools.DebuggerAgent.argumentsArrayToMap_ = function(array, map) {
+ for (var j = 0; j < array.length; j++) {
+ var nextValue = array[j];
+ // Skip unnamed properties. They may appear e.g. when number of actual
+ // parameters is greater the that of formal. In that case the superfluous
+ // parameters will be present in the arguments list as elements without
+ // names.
+ var name = nextValue.name ? nextValue.name : '<arg #' + j + '>';
+ map[name] = devtools.DebuggerAgent.formatObjectReference_(nextValue.value);
+ }
};