From d946a98df10bf1ae5bb02e5cd7eaa2a0c3a06aad Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Fri, 18 Aug 2017 18:41:51 +0100 Subject: Check whether events are trusted before executing listeners --- lib/utils.coffee | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/utils.coffee') 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 -- cgit v1.2.3