diff options
| author | Stephen Blott | 2017-09-06 12:36:13 +0100 |
|---|---|---|
| committer | GitHub | 2017-09-06 12:36:13 +0100 |
| commit | 0d21fb070e93030beb591540face9138f7df557a (patch) | |
| tree | 4b7939f01ed3f336ac65f11b5fee64521a57c5d2 /lib/utils.coffee | |
| parent | dd7dc27f2ddc11e2eba15803c5d880e2393e04cf (diff) | |
| parent | d946a98df10bf1ae5bb02e5cd7eaa2a0c3a06aad (diff) | |
| download | vimium-0d21fb070e93030beb591540face9138f7df557a.tar.bz2 | |
Merge pull request #2605 from mrmr1993/isTrusted-events
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 |
