Chromium Code Reviews| Index: Source/core/inspector/InjectedScriptSource.js |
| diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
| index 5965f4bcf6791fd3dc3c4b0d76f84393a42ebfad..b3f6a6cda76ab68b160a22a81e7c035bbbe2dcfd 100644 |
| --- a/Source/core/inspector/InjectedScriptSource.js |
| +++ b/Source/core/inspector/InjectedScriptSource.js |
| @@ -1377,10 +1377,29 @@ CommandLineAPIImpl.prototype = { |
| /** |
| * @param {Node} node |
| + * @return {{type: string, listener: function(), useCapture: boolean, remove: function()}} |
| */ |
| getEventListeners: function(node) |
| { |
| - return InjectedScriptHost.getEventListeners(node); |
| + var result = InjectedScriptHost.getEventListeners(node); |
| + if (!result) |
| + return result; |
| + /** @this {{type: string, listener: function(), useCapture: boolean}} */ |
| + var removeFunc = function() |
| + { |
| + node.removeEventListener(this.type, this.listener, this.useCapture); |
| + } |
| + try { |
| + for (var type in result) { |
| + var listeners = result[type]; |
| + for (var i = 0, listener; listener = listeners[i]; ++i) { |
| + listener["type"] = type; |
| + listener["remove"] = removeFunc; |
| + } |
| + } |
| + } catch (e) { |
|
pfeldman
2013/10/28 09:22:57
why try / catch?
|
| + } |
| + return result; |
| }, |
| debug: function(fn) |