Chromium Code Reviews| Index: Source/core/inspector/InjectedScriptSource.js |
| diff --git a/Source/core/inspector/InjectedScriptSource.js b/Source/core/inspector/InjectedScriptSource.js |
| index fa2c21aa111638bd91281808842d108ed9e12acf..0a471d16276ed7f899962adf702212fb9ed1f00b 100644 |
| --- a/Source/core/inspector/InjectedScriptSource.js |
| +++ b/Source/core/inspector/InjectedScriptSource.js |
| @@ -1136,7 +1136,60 @@ InjectedScript.prototype = { |
| setCustomObjectFormatterEnabled: function(enabled) |
| { |
| this._customObjectFormatterEnabled = enabled; |
| - } |
| + }, |
| + |
| + /** |
| + * @param {string} prefix |
| + * @param {!Error} error |
| + */ |
| + _logError: function(prefix, error) |
| + { |
| + Promise.resolve().then(inspectedGlobalObject.console.error.bind(inspectedGlobalObject.console, prefix + error.message)); |
| + }, |
| + |
| + /** |
| + * @param {!Object} object |
| + * @return {!Array<!{type: string, listener: function(), useCapture: boolean}>} |
| + */ |
| + frameworksEventListeners: function(object) |
|
yurys
2015/08/13 23:49:06
frameworkEventListeners
kozy
2015/08/14 17:07:03
frameworkUserEventListeners
|
| + { |
| + if (isArrayLike(inspectedGlobalObject["devtoolsFrameworksEventListeners"])) { |
| + var listeners = []; |
| + var getters = inspectedGlobalObject["devtoolsFrameworksEventListeners"]; |
| + for (var i = 0; i < getters.length; ++i) { |
| + try { |
| + if (typeof getters[i] === "function") |
| + listeners = concat(listeners, getters[i](object)); |
| + } catch (e) { |
| + this._logError("Resolving Frameworks Event Listeners Failed: ", e); |
| + } |
| + } |
| + return listeners; |
| + } |
| + return []; |
| + }, |
| + |
| + /** |
| + * @param {!Object} object |
| + * @return {!Set<function()>} |
| + */ |
| + frameworksEventHandlers: function(object) |
| + { |
| + if (isArrayLike(inspectedGlobalObject["devtoolsFrameworksEventHandlers"])) { |
| + var handlers = []; |
| + var getters = inspectedGlobalObject["devtoolsFrameworksEventHandlers"]; |
|
yurys
2015/08/13 23:49:06
Please extract common part.
kozy
2015/08/14 17:07:03
Done.
|
| + for (var i = 0; i < getters.length; ++i) { |
| + try { |
| + if (typeof getters[i] === "function") |
| + handlers = concat(handlers, getters[i](object)); |
| + } catch (e) { |
| + this._logError("Resolving Frameworks Event Handlers Failed: ", e); |
| + } |
| + } |
| + return new Set(handlers); |
| + } |
| + return new Set(); |
| + }, |
| } |
| /** |
| @@ -1221,14 +1274,6 @@ InjectedScript.RemoteObject.prototype = { |
| */ |
| _customPreview: function(object, objectGroupName, customObjectConfig) |
| { |
| - /** |
| - * @param {!Error} error |
| - */ |
| - function logError(error) |
| - { |
| - Promise.resolve().then(inspectedGlobalObject.console.error.bind(inspectedGlobalObject.console, "Custom Formatter Failed: " + error.message)); |
| - } |
| - |
| try { |
| var formatters = inspectedGlobalObject["devtoolsFormatters"]; |
| if (!formatters || !isArrayLike(formatters)) |
|
yurys
2015/08/13 23:49:06
Drop !formatter check?
kozy
2015/08/14 17:07:03
typeof null === "object" in js
|
| @@ -1248,11 +1293,11 @@ InjectedScript.RemoteObject.prototype = { |
| result["configObjectId"] = injectedScript._bind(customObjectConfig, objectGroupName); |
| return result; |
| } catch (e) { |
| - logError(e); |
| + injectedScript._logError("Custom Formatter Failed: ", e); |
| } |
| } |
| } catch (e) { |
| - logError(e); |
| + injectedScript._logError("Custom Formatter Failed: ", e); |
| } |
| return null; |
| }, |
| @@ -1849,6 +1894,13 @@ CommandLineAPIImpl.prototype = { |
| var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(node)); |
| if (!result) |
| return result; |
| + |
| + var jQueryListeners = injectedScript.frameworksEventListeners(node); |
| + for (var i = 0; i < jQueryListeners.length; ++i) { |
| + result[jQueryListeners[i].type] = result[jQueryListeners[i].type] || []; |
| + result[jQueryListeners[i].type].push(jQueryListeners[i]); |
| + } |
| + |
| /** @this {{type: string, listener: function(), useCapture: boolean}} */ |
| var removeFunc = function() |
| { |