diff options
| author | mrmr1993 | 2017-08-18 18:41:51 +0100 | 
|---|---|---|
| committer | mrmr1993 | 2017-08-18 18:51:45 +0100 | 
| commit | d946a98df10bf1ae5bb02e5cd7eaa2a0c3a06aad (patch) | |
| tree | d8a6ed02e1efacf43c245b336eb36c04df27402d /lib/utils.coffee | |
| parent | 696feed903fe815af50c89b1badbb1e5680d6921 (diff) | |
| download | vimium-d946a98df10bf1ae5bb02e5cd7eaa2a0c3a06aad.tar.bz2 | |
Check whether events are trusted before executing listeners
Diffstat (limited to 'lib/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index babb5f96..78eed12c 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -1,3 +1,11 @@ +# Only pass events to the handler if they are marked as trusted by the browser. +# This is kept in the global namespace for brevity and ease of use. +window.forTrusted ?= (handler) -> (event) -> +  if event?.isTrusted +    handler.apply this, arguments +  else +    true +  Utils =    getCurrentVersion: ->      chrome.runtime.getManifest().version | 
