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

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

Issue 1950403002: Add the ability to return descedant event listeners. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698