diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 20:46:37 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-02 20:46:37 +0000 |
commit | 96e867d99f62bc1d34fee7c1df0b3602acea4862 (patch) | |
tree | e2f076d2758b5e05831af7fcfd32ce88e8abdf01 /chrome/renderer/resources/extension_process_bindings.js | |
parent | 22bc912e8ead4576e8fff27d49da8d75fd6802eb (diff) | |
download | chromium_src-96e867d99f62bc1d34fee7c1df0b3602acea4862.zip chromium_src-96e867d99f62bc1d34fee7c1df0b3602acea4862.tar.gz chromium_src-96e867d99f62bc1d34fee7c1df0b3602acea4862.tar.bz2 |
Add hasListener/hasListeners to webRequestEvents
BUG=none
TEST=ExtensionApiTest.WebRequestEvents
Review URL: http://codereview.chromium.org/7542010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95151 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources/extension_process_bindings.js')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 98e31cb..b2d10ff 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -274,6 +274,16 @@ var chrome = chrome || {}; this.callbackMap_ = {}; }; + // Test if the given callback is registered for this event. + chrome.WebRequestEvent.prototype.hasListener = function(cb) { + return this.findListener_(cb) > -1; + }; + + // Test if any callbacks are registered fur thus event. + chrome.WebRequestEvent.prototype.hasListeners = function(cb) { + return this.subEvents_.length > 0; + }; + // Registers a callback to be called when this event is dispatched. If // opt_filter is specified, then the callback is only called for events that // match the given filters. If opt_extraInfo is specified, the given optional |