Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 // NOTE: Please keep the list of API methods below snchronized to that in WebIns pector.RuntimeModel! | 1149 // NOTE: Please keep the list of API methods below snchronized to that in WebIns pector.RuntimeModel! |
| 1150 /** | 1150 /** |
| 1151 * @type {Array.<string>} | 1151 * @type {Array.<string>} |
| 1152 * @const | 1152 * @const |
| 1153 */ | 1153 */ |
| 1154 CommandLineAPI.members_ = [ | 1154 CommandLineAPI.members_ = [ |
| 1155 "$", "$$", "$x", "dir", "dirxml", "keys", "values", "profile", "profileEnd", | 1155 "$", "$$", "$x", "dir", "dirxml", "keys", "values", "profile", "profileEnd", |
| 1156 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventLis teners", | 1156 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventLis teners", |
| 1157 "debug", "undebug", "table" | 1157 "debug", "undebug", "monitor", "unmonitor", "table" |
| 1158 ]; | 1158 ]; |
| 1159 | 1159 |
| 1160 /** | 1160 /** |
| 1161 * @constructor | 1161 * @constructor |
| 1162 */ | 1162 */ |
| 1163 function CommandLineAPIImpl() | 1163 function CommandLineAPIImpl() |
| 1164 { | 1164 { |
| 1165 } | 1165 } |
| 1166 | 1166 |
| 1167 CommandLineAPIImpl.prototype = { | 1167 CommandLineAPIImpl.prototype = { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1306 /** | 1306 /** |
| 1307 * @param {Node} node | 1307 * @param {Node} node |
| 1308 */ | 1308 */ |
| 1309 getEventListeners: function(node) | 1309 getEventListeners: function(node) |
| 1310 { | 1310 { |
| 1311 return InjectedScriptHost.getEventListeners(node); | 1311 return InjectedScriptHost.getEventListeners(node); |
| 1312 }, | 1312 }, |
| 1313 | 1313 |
| 1314 debug: function(fn) | 1314 debug: function(fn) |
| 1315 { | 1315 { |
| 1316 InjectedScriptHost.setBreakpoint(fn); | 1316 var details = InjectedScriptHost.functionDetails(fn); |
| 1317 if (!details) | |
| 1318 return; | |
| 1319 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.
| |
| 1317 }, | 1320 }, |
| 1318 | 1321 |
| 1319 undebug: function(fn) | 1322 undebug: function(fn) |
| 1320 { | 1323 { |
| 1321 InjectedScriptHost.removeBreakpoint(fn); | 1324 this._removeBreakpoint(fn, "debug"); |
| 1325 }, | |
| 1326 | |
| 1327 monitor: function(fn) | |
| 1328 { | |
| 1329 var details = InjectedScriptHost.functionDetails(fn); | |
| 1330 if (!details) | |
| 1331 return; | |
| 1332 | |
| 1333 var name = details.name || details.inferredName || "(anonimous function) "; | |
| 1334 var condition = "console.log(\"function " + name + " called\" + (argumen ts.length > 0 ? \" with arguments: \" + Array.prototype.join.call(arguments, \", \") : \"\")) && false"; | |
| 1335 this._setBreakpoint(details.location, "monitor", condition); | |
| 1336 }, | |
| 1337 | |
| 1338 unmonitor: function(fn) { | |
| 1339 this._removeBreakpoint(fn, "monitor"); | |
| 1340 }, | |
| 1341 | |
| 1342 _setBreakpoint: function(location, source, condition) | |
| 1343 { | |
| 1344 InjectedScriptHost.setBreakpoint(location.scriptId, location.lineNumber, location.columnNumber, source, condition); | |
| 1345 }, | |
| 1346 | |
| 1347 _removeBreakpoint: function(fn, source) | |
| 1348 { | |
| 1349 var details = InjectedScriptHost.functionDetails(fn); | |
| 1350 if (!details) | |
| 1351 return; | |
| 1352 var location = details.location; | |
| 1353 InjectedScriptHost.removeBreakpoint(location.scriptId, location.lineNumb er, location.columnNumber, source); | |
| 1322 }, | 1354 }, |
| 1323 | 1355 |
| 1324 table: function() | 1356 table: function() |
| 1325 { | 1357 { |
| 1326 inspectedWindow.console.table.apply(inspectedWindow.console, arguments); | 1358 inspectedWindow.console.table.apply(inspectedWindow.console, arguments); |
| 1327 }, | 1359 }, |
| 1328 | 1360 |
| 1329 /** | 1361 /** |
| 1330 * @param {number} num | 1362 * @param {number} num |
| 1331 */ | 1363 */ |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1366 */ | 1398 */ |
| 1367 _logEvent: function(event) | 1399 _logEvent: function(event) |
| 1368 { | 1400 { |
| 1369 inspectedWindow.console.log(event.type, event); | 1401 inspectedWindow.console.log(event.type, event); |
| 1370 } | 1402 } |
| 1371 } | 1403 } |
| 1372 | 1404 |
| 1373 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1405 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1374 return injectedScript; | 1406 return injectedScript; |
| 1375 }) | 1407 }) |
| OLD | NEW |