From 19242b6cb2848dffa5eda979fc285f8b3a3af89e Mon Sep 17 00:00:00 2001 From: Jimmy Date: Wed, 25 Apr 2018 16:51:35 +1200 Subject: [PATCH] Greasemonkey: fix scoping function decleration. Apparently making a function like `function foo() {};` in block scope is illegal. It should be named via assignment. Switched to an IIFE anyway because it doesn't need a name. --- qutebrowser/javascript/greasemonkey_wrapper.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/qutebrowser/javascript/greasemonkey_wrapper.js b/qutebrowser/javascript/greasemonkey_wrapper.js index 88024ff02..7f348dbcc 100644 --- a/qutebrowser/javascript/greasemonkey_wrapper.js +++ b/qutebrowser/javascript/greasemonkey_wrapper.js @@ -197,12 +197,11 @@ // with `with` scope because then it would get assigned to the // proxy and we would get the same problem, so we have to make yet // another nested scope. - function qute_gm_window_scope() { // why can't this be anonymous? + (function() { let window = qute_gm_window_proxy; // ====== The actual user script source ====== // {{ scriptSource }} // ====== End User Script ====== // - }; - qute_gm_window_scope(); + })(); }; })();