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

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: Fix Layout Tests 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 if (passive)
1406 return {"capture": capture, "passive": passive};
1407 else
1408 return capture;
1409 }
1410
1411 /**
1412 * @param {!Node} node
1413 * @param {string} type
1414 * @param {function()} listener
1415 * @param {boolean} capture
1416 * @param {boolean} passive
1417 */
1418 function removeEventListenerWrapper(node, type, listener, capture, passi ve)
1419 {
1420 node.removeEventListener(type, listener, eventListenerOptions(captur e, passive));
1421 }
1422
1423 /** @this {{type: string, listener: function(), useCapture: boolean, pas sive: boolean}} */
1397 var removeFunc = function() 1424 var removeFunc = function()
1398 { 1425 {
1399 node.removeEventListener(this.type, this.listener, this.useCapture); 1426 removeEventListenerWrapper(node, this.type, this.listener, this.useC apture, this.passive);
1400 } 1427 }
1401 for (var type in result) { 1428 for (var type in result) {
1402 var listeners = result[type]; 1429 var listeners = result[type];
1403 for (var i = 0, listener; listener = listeners[i]; ++i) { 1430 for (var i = 0, listener; listener = listeners[i]; ++i) {
1404 listener["type"] = type; 1431 listener["type"] = type;
1405 listener["remove"] = removeFunc; 1432 listener["remove"] = removeFunc;
1406 } 1433 }
1407 } 1434 }
1408 return result; 1435 return result;
1409 }, 1436 },
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 */ 1502 */
1476 _logEvent: function(event) 1503 _logEvent: function(event)
1477 { 1504 {
1478 inspectedGlobalObject.console.log(event.type, event); 1505 inspectedGlobalObject.console.log(event.type, event);
1479 } 1506 }
1480 } 1507 }
1481 1508
1482 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1509 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1483 return injectedScript; 1510 return injectedScript;
1484 }) 1511 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698