Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: webkit/glue/devtools/js/inject.js

Issue 159395: DevTools: make pause work for script evaluations (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/devtools/js/devtools.js ('k') | webkit/glue/devtools/js/tests.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/inject.js
===================================================================
--- webkit/glue/devtools/js/inject.js (revision 21636)
+++ webkit/glue/devtools/js/inject.js (working copy)
@@ -545,7 +545,7 @@
*/
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 @@
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;
+ });
};
« no previous file with comments | « webkit/glue/devtools/js/devtools.js ('k') | webkit/glue/devtools/js/tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698