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

Side by Side 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, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/console/command-line-api-getEventListeners-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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()}|undefined}
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 for (var type in result) {
1393 var listeners = result[type];
1394 for (var i = 0, listener; listener = listeners[i]; ++i) {
1395 listener["type"] = type;
1396 listener["remove"] = removeFunc;
1397 }
1398 }
1399 return result;
1384 }, 1400 },
1385 1401
1386 debug: function(fn) 1402 debug: function(fn)
1387 { 1403 {
1388 InjectedScriptHost.debugFunction(fn); 1404 InjectedScriptHost.debugFunction(fn);
1389 }, 1405 },
1390 1406
1391 undebug: function(fn) 1407 undebug: function(fn)
1392 { 1408 {
1393 InjectedScriptHost.undebugFunction(fn); 1409 InjectedScriptHost.undebugFunction(fn);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1447 */ 1463 */
1448 _logEvent: function(event) 1464 _logEvent: function(event)
1449 { 1465 {
1450 inspectedWindow.console.log(event.type, event); 1466 inspectedWindow.console.log(event.type, event);
1451 } 1467 }
1452 } 1468 }
1453 1469
1454 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1470 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1455 return injectedScript; 1471 return injectedScript;
1456 }) 1472 })
OLDNEW
« 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