diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 09:17:23 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-27 09:17:23 +0000 |
commit | b56c6b97fd50cd716b1652bdd2f8dfa90219c2e1 (patch) | |
tree | be94d68f24399f79d8a4161b893aabda0dce1c9f /webkit/glue/devtools/js/inject.js | |
parent | c934ed3d16c3ce6f50346bb365d30b714444db05 (diff) | |
download | chromium_src-b56c6b97fd50cd716b1652bdd2f8dfa90219c2e1.zip chromium_src-b56c6b97fd50cd716b1652bdd2f8dfa90219c2e1.tar.gz chromium_src-b56c6b97fd50cd716b1652bdd2f8dfa90219c2e1.tar.bz2 |
DevTools: split console evaluation into two steps: actual evaluation and result
wrapping. When second step is executed debugger_agent_manager will autocontinue
on break. We assume that second step doesn't call user scripts.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=21635
Review URL: http://codereview.chromium.org/159395
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21637 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/devtools/js/inject.js')
-rw-r--r-- | webkit/glue/devtools/js/inject.js | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/webkit/glue/devtools/js/inject.js b/webkit/glue/devtools/js/inject.js index ec26991..6fe992a 100644 --- a/webkit/glue/devtools/js/inject.js +++ b/webkit/glue/devtools/js/inject.js @@ -545,7 +545,7 @@ devtools.Injected.prototype.getUniqueStyleProperties_ = function(style) { */ devtools.Injected.prototype.wrapConsoleObject = function(obj) { var type = typeof obj; - if (type == 'object' || type == 'function') { + if ((type == 'object' && obj != null) || type == 'function') { var objId = '#consoleobj#' + this.lastCachedConsoleObjectId_++; this.cachedConsoleObjects_[objId] = obj; var result = { ___devtools_id : objId }; @@ -554,24 +554,25 @@ devtools.Injected.prototype.wrapConsoleObject = function(obj) { result[name] = ''; } return result; - } else { - return obj; } + return obj; }; /** * Caches console object for subsequent calls to getConsoleObjectProperties. * @param {Object} obj Object to cache. - * @return {string} console object id. + * @return {string} Console object wrapper serialized into a JSON string. */ -devtools.Injected.prototype.evaluate = function(expression) { - try { - // Evaluate the expression in the global context of the inspected window. - return [ this.wrapConsoleObject(contentWindow.eval(expression)), false ]; - } catch (e) { - return [ e.toString(), true ]; - } +devtools.Injected.prototype.serializeConsoleObject = function(obj) { + var result = this.wrapConsoleObject(obj); + return JSON.stringify(result, + function (key, value) { + if (value === undefined) { + return 'undefined'; + } + return value; + }); }; |