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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScriptSource.js

Issue 1845493004: Modify devtools to show passive event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor change Created 4 years, 8 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 unified diff | Download patch
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 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1386
1387 /** 1387 /**
1388 * @param {!Node} node 1388 * @param {!Node} node
1389 * @return {!Object|undefined} 1389 * @return {!Object|undefined}
1390 */ 1390 */
1391 getEventListeners: function(node) 1391 getEventListeners: function(node)
1392 { 1392 {
1393 var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(nod e)); 1393 var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(nod e));
1394 if (!result) 1394 if (!result)
1395 return; 1395 return;
1396 /** @this {{type: string, listener: function(), useCapture: boolean}} */ 1396
1397 // TODO(dtapuska): Remove this one closure compiler is updated
1398 // to handle EventListenerOptions and passive event listeners
1399 // has shipped. Don't JSDoc these otherwise it will fail.
1400 // @param {boolean} capture
1401 // @param {boolean} passive
1402 // @return {boolean|undefined|{capture: (boolean|undefined), passive: bo olean}}
1403 function eventListenerOptions(capture, passive)
1404 {
1405 return {"capture": capture, "passive": passive};
1406 }
1407
1408 /**
1409 * @param {!Node} node
1410 * @param {string} type
1411 * @param {function()} listener
1412 * @param {boolean} capture
1413 * @param {boolean} passive
1414 */
1415 function removeEventListenerWrapper(node, type, listener, capture, passi ve)
1416 {
1417 node.removeEventListener(type, listener, eventListenerOptions(captur e, passive));
1418 }
1419
1420 /** @this {{type: string, listener: function(), useCapture: boolean, pas sive: boolean}} */
1397 var removeFunc = function() 1421 var removeFunc = function()
1398 { 1422 {
1399 node.removeEventListener(this.type, this.listener, this.useCapture); 1423 removeEventListenerWrapper(node, this.type, this.listener, this.useC apture, this.passive);
1400 } 1424 }
1401 for (var type in result) { 1425 for (var type in result) {
1402 var listeners = result[type]; 1426 var listeners = result[type];
1403 for (var i = 0, listener; listener = listeners[i]; ++i) { 1427 for (var i = 0, listener; listener = listeners[i]; ++i) {
1404 listener["type"] = type; 1428 listener["type"] = type;
1405 listener["remove"] = removeFunc; 1429 listener["remove"] = removeFunc;
1406 } 1430 }
1407 } 1431 }
1408 return result; 1432 return result;
1409 }, 1433 },
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 */ 1499 */
1476 _logEvent: function(event) 1500 _logEvent: function(event)
1477 { 1501 {
1478 inspectedGlobalObject.console.log(event.type, event); 1502 inspectedGlobalObject.console.log(event.type, event);
1479 } 1503 }
1480 } 1504 }
1481 1505
1482 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1506 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1483 return injectedScript; 1507 return injectedScript;
1484 }) 1508 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698