aboutsummaryrefslogtreecommitdiffstats
path: root/lib/utils.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils.coffee')
-rw-r--r--lib/utils.coffee8
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