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..794d109038d2dd58eb3954b6b71418583aab0d7f 100644 |
| --- a/Source/core/inspector/InjectedScriptSource.js |
| +++ b/Source/core/inspector/InjectedScriptSource.js |
| @@ -1136,6 +1136,58 @@ 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}>} |
| + */ |
| + frameworkUserEventListeners: function(object) |
| + { |
| + return this._callGlobalObjectMethodAndReturnArray(object,"devtoolsFrameworkUserEventListeners", "Getting framework user event listeners failed: "); |
| + }, |
| + |
| + /** |
| + * @param {!Object} object |
| + * @return {!Set<function()>} |
| + */ |
| + frameworkInternalEventHandlers: function(object) |
| + { |
| + return new Set(/** @type {!Array<function()>} */(this._callGlobalObjectMethodAndReturnArray(object, "devtoolsFrameworkInternalEventHandlers", "Getting framework internal event handlers failed: "))); |
| + }, |
| + |
| + /** |
| + * @param {!Object} object |
| + * @param {string} methodName |
| + * @param {string} errorPrefix |
| + * @return {!Array<*>} |
| + */ |
| + _callGlobalObjectMethodAndReturnArray: function(object, methodName, errorPrefix) |
|
yurys
2015/08/14 17:24:20
_callCustomGetters
kozy
2015/08/14 18:15:45
Done.
|
| + { |
| + var getters = inspectedGlobalObject[methodName]; |
| + if (!getters || !isArrayLike(getters)) |
| + return []; |
| + |
| + var results = []; |
| + for (var i = 0; i < getters.length; ++i) { |
| + try { |
| + if (typeof getters[i] === "function") |
| + results = concat(results, getters[i](object)); |
| + } catch (e) { |
| + this._logError(errorPrefix, e); |
| + return []; |
| + } |
| + } |
| + return results; |
| } |
| } |
| @@ -1221,14 +1273,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)) |
| @@ -1248,11 +1292,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 +1893,13 @@ CommandLineAPIImpl.prototype = { |
| var result = nullifyObjectProto(InjectedScriptHost.getEventListeners(node)); |
| if (!result) |
| return result; |
| + |
| + var jQueryListeners = injectedScript.frameworkUserEventListeners(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() |
| { |