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 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1370 InjectedScriptHost.inspect(remoteObject, hints); | 1370 InjectedScriptHost.inspect(remoteObject, hints); |
| 1371 }, | 1371 }, |
| 1372 | 1372 |
| 1373 clear: function() | 1373 clear: function() |
| 1374 { | 1374 { |
| 1375 InjectedScriptHost.clearConsoleMessages(); | 1375 InjectedScriptHost.clearConsoleMessages(); |
| 1376 }, | 1376 }, |
| 1377 | 1377 |
| 1378 /** | 1378 /** |
| 1379 * @param {Node} node | 1379 * @param {Node} node |
| 1380 * @return {{type: string, listener: function(), useCapture: boolean, remove : function()}} | |
| 1380 */ | 1381 */ |
| 1381 getEventListeners: function(node) | 1382 getEventListeners: function(node) |
| 1382 { | 1383 { |
| 1383 return InjectedScriptHost.getEventListeners(node); | 1384 var result = InjectedScriptHost.getEventListeners(node); |
| 1385 if (!result) | |
| 1386 return result; | |
| 1387 /** @this {{type: string, listener: function(), useCapture: boolean}} */ | |
| 1388 var removeFunc = function() | |
| 1389 { | |
| 1390 node.removeEventListener(this.type, this.listener, this.useCapture); | |
| 1391 } | |
| 1392 try { | |
| 1393 for (var type in result) { | |
| 1394 var listeners = result[type]; | |
| 1395 for (var i = 0, listener; listener = listeners[i]; ++i) { | |
| 1396 listener["type"] = type; | |
| 1397 listener["remove"] = removeFunc; | |
| 1398 } | |
| 1399 } | |
| 1400 } catch (e) { | |
|
pfeldman
2013/10/28 09:22:57
why try / catch?
| |
| 1401 } | |
| 1402 return result; | |
| 1384 }, | 1403 }, |
| 1385 | 1404 |
| 1386 debug: function(fn) | 1405 debug: function(fn) |
| 1387 { | 1406 { |
| 1388 InjectedScriptHost.debugFunction(fn); | 1407 InjectedScriptHost.debugFunction(fn); |
| 1389 }, | 1408 }, |
| 1390 | 1409 |
| 1391 undebug: function(fn) | 1410 undebug: function(fn) |
| 1392 { | 1411 { |
| 1393 InjectedScriptHost.undebugFunction(fn); | 1412 InjectedScriptHost.undebugFunction(fn); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1447 */ | 1466 */ |
| 1448 _logEvent: function(event) | 1467 _logEvent: function(event) |
| 1449 { | 1468 { |
| 1450 inspectedWindow.console.log(event.type, event); | 1469 inspectedWindow.console.log(event.type, event); |
| 1451 } | 1470 } |
| 1452 } | 1471 } |
| 1453 | 1472 |
| 1454 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1473 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1455 return injectedScript; | 1474 return injectedScript; |
| 1456 }) | 1475 }) |
| OLD | NEW |