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

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

Issue 113953: DevTools: Add support for non-trivial console messages. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/devtools/js/inject_dispatch.js
===================================================================
--- webkit/glue/devtools/js/inject_dispatch.js (revision 17071)
+++ webkit/glue/devtools/js/inject_dispatch.js (working copy)
@@ -40,10 +40,23 @@
*/
var dispatch = function(method, var_args) {
// Handle all messages with non-primitieve arguments here.
- // TODO(pfeldman): Add more.
if (method == 'inspectedWindowCleared') {
return;
}
- var call = JSON.stringify(Array.prototype.slice.call(arguments));
+ var args = Array.prototype.slice.call(arguments);
yurys 2009/05/28 16:28:04 you can move this in the 'if' block below
+
+ // Serialize objects here.
+ if (method == 'addMessageToConsole') {
+ // Skip first argument since it is serializable.
+ for (var i = 1; i < args.length; ++i) {
+ var type = typeof args[i];
+ if (type == 'object') {
+ args[i] = Object.prototype.toString(args[i]);
+ } else if (type == 'function') {
+ args[i] = args[i].toString();
+ }
+ }
+ }
+ var call = JSON.stringify(args);
RemoteWebInspector.dispatch(call);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698