Browse Source

fix: don't copy `window.event`, fixes #1223

tophf 5 years ago
parent
commit
39503ef3a8
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/injected/web/gm-wrapper.js

+ 5 - 1
src/injected/web/gm-wrapper.js

@@ -360,7 +360,11 @@ function makeGlobalWrapper(local) {
     if (value === window) {
       value = wrapper;
     }
-    if (canCopy && (typeof value === 'function' || typeof value === 'object' && value)) {
+    if (canCopy && (
+      typeof value === 'function'
+      || typeof value === 'object' && value && name !== 'event'
+      // window.event contains the current event so it's always different
+    )) {
       local[name] = value;
     }
     return value;