Chromium Code Reviews| Index: Source/core/inspector/InjectedScriptSource.js |
| diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
| index 0cffd8726f444e947f1a73c93f5c1a98ee00b2d0..a3dea0571ee3bbed8990f67cfa973ab096ccda22 100644 |
| --- a/Source/core/inspector/InjectedScriptSource.js |
| +++ b/Source/core/inspector/InjectedScriptSource.js |
| @@ -1154,7 +1154,7 @@ function CommandLineAPI(commandLineAPIImpl, callFrame) |
| CommandLineAPI.members_ = [ |
| "$", "$$", "$x", "dir", "dirxml", "keys", "values", "profile", "profileEnd", |
| "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventListeners", |
| - "debug", "undebug", "table" |
| + "debug", "undebug", "monitor", "unmonitor", "table" |
| ]; |
| /** |
| @@ -1313,12 +1313,44 @@ CommandLineAPIImpl.prototype = { |
| debug: function(fn) |
| { |
| - InjectedScriptHost.setBreakpoint(fn); |
| + var details = InjectedScriptHost.functionDetails(fn); |
| + if (!details) |
| + return; |
| + this._setBreakpoint(details.location, "debug", ""); |
|
yurys
2013/06/13 09:46:51
Please use enum for "debug" and "monitor" sources.
SeRya
2013/06/13 10:45:14
Not actual now.
|
| }, |
| undebug: function(fn) |
| { |
| - InjectedScriptHost.removeBreakpoint(fn); |
| + this._removeBreakpoint(fn, "debug"); |
| + }, |
| + |
| + monitor: function(fn) |
| + { |
| + var details = InjectedScriptHost.functionDetails(fn); |
| + if (!details) |
| + return; |
| + |
| + var name = details.name || details.inferredName || "(anonimous function)"; |
| + var condition = "console.log(\"function " + name + " called\" + (arguments.length > 0 ? \" with arguments: \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false"; |
| + this._setBreakpoint(details.location, "monitor", condition); |
| + }, |
| + |
| + unmonitor: function(fn) { |
| + this._removeBreakpoint(fn, "monitor"); |
| + }, |
| + |
| + _setBreakpoint: function(location, source, condition) |
| + { |
| + InjectedScriptHost.setBreakpoint(location.scriptId, location.lineNumber, location.columnNumber, source, condition); |
| + }, |
| + |
| + _removeBreakpoint: function(fn, source) |
| + { |
| + var details = InjectedScriptHost.functionDetails(fn); |
| + if (!details) |
| + return; |
| + var location = details.location; |
| + InjectedScriptHost.removeBreakpoint(location.scriptId, location.lineNumber, location.columnNumber, source); |
| }, |
| table: function() |