Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1215 { | 1215 { |
| 1216 if (!object || !object.addEventListener || !object.removeEventListener) | 1216 if (!object || !object.addEventListener || !object.removeEventListener) |
| 1217 return; | 1217 return; |
| 1218 var types = CommandLineAPIImpl._normalizeEventTypes(opt_types); | 1218 var types = CommandLineAPIImpl._normalizeEventTypes(opt_types); |
| 1219 for (var i = 0; i < types.length; ++i) | 1219 for (var i = 0; i < types.length; ++i) |
| 1220 object.removeEventListener(types[i], CommandLineAPIImpl._logEvent, false ); | 1220 object.removeEventListener(types[i], CommandLineAPIImpl._logEvent, false ); |
| 1221 } | 1221 } |
| 1222 | 1222 |
| 1223 /** | 1223 /** |
| 1224 * @param {!Node} node | 1224 * @param {!Node} node |
| 1225 * @param {?Object} options | |
| 1225 * @return {!Object|undefined} | 1226 * @return {!Object|undefined} |
| 1226 */ | 1227 */ |
| 1227 CommandLineAPIImpl.getEventListeners = function(node) | 1228 CommandLineAPIImpl.getEventListeners = function(node, options) |
| 1228 { | 1229 { |
| 1229 var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(node)); | 1230 if (!options) options = {}; |
|
caseq
2016/05/09 21:08:39
style: move options to the next line, or just opti
dtapuska
2016/05/18 14:04:53
Done.
| |
| 1231 var showPassive = true; | |
| 1232 var showBlocking = true; | |
| 1233 if (typeof options['passive'] != "undefined") { | |
| 1234 showPassive = options['passive']; | |
| 1235 showBlocking = !showPassive; | |
| 1236 } | |
| 1237 | |
| 1238 var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(node, | |
| 1239 options ['descendants'], | |
| 1240 showPas sive, | |
| 1241 showBlo cking)); | |
| 1230 if (!result) | 1242 if (!result) |
| 1231 return; | 1243 return; |
| 1232 | 1244 |
| 1233 // TODO(dtapuska): Remove this one closure compiler is updated | 1245 // TODO(dtapuska): Remove this one closure compiler is updated |
| 1234 // to handle EventListenerOptions and passive event listeners | 1246 // to handle EventListenerOptions and passive event listeners |
| 1235 // has shipped. Don't JSDoc these otherwise it will fail. | 1247 // has shipped. Don't JSDoc these otherwise it will fail. |
| 1236 // @param {boolean} capture | 1248 // @param {boolean} capture |
| 1237 // @param {boolean} passive | 1249 // @param {boolean} passive |
| 1238 // @return {boolean|undefined|{capture: (boolean|undefined), passive: boolea n}} | 1250 // @return {boolean|undefined|{capture: (boolean|undefined), passive: boolea n}} |
| 1239 function eventListenerOptions(capture, passive) | 1251 function eventListenerOptions(capture, passive) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1300 /** | 1312 /** |
| 1301 * @param {!Event} event | 1313 * @param {!Event} event |
| 1302 */ | 1314 */ |
| 1303 CommandLineAPIImpl._logEvent = function(event) | 1315 CommandLineAPIImpl._logEvent = function(event) |
| 1304 { | 1316 { |
| 1305 inspectedGlobalObject.console.log(event.type, event); | 1317 inspectedGlobalObject.console.log(event.type, event); |
| 1306 } | 1318 } |
| 1307 | 1319 |
| 1308 return injectedScript; | 1320 return injectedScript; |
| 1309 }) | 1321 }) |
| OLD | NEW |