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

Unified Diff: Source/core/inspector/InjectedScriptSource.js

Issue 48363002: DevTools: Improve CommandLineAPI's getEventListeners result. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: removed try-catch Created 7 years, 2 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 | « LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InjectedScriptSource.js
diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js
index 5965f4bcf6791fd3dc3c4b0d76f84393a42ebfad..991c07d7038f2d53f4ac621982fe82b19315965e 100644
--- a/Source/core/inspector/InjectedScriptSource.js
+++ b/Source/core/inspector/InjectedScriptSource.js
@@ -1377,10 +1377,26 @@ CommandLineAPIImpl.prototype = {
/**
* @param {Node} node
+ * @return {{type: string, listener: function(), useCapture: boolean, remove: function()}|undefined}
*/
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);
+ }
+ for (var type in result) {
+ var listeners = result[type];
+ for (var i = 0, listener; listener = listeners[i]; ++i) {
+ listener["type"] = type;
+ listener["remove"] = removeFunc;
+ }
+ }
+ return result;
},
debug: function(fn)
« no previous file with comments | « LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698