[PATCH 6 of 7] hgweb: look up "URLSearchParams" in "window" to work around jshint issues

Anton Shestakov av6 at dwimlabs.net
Mon Nov 27 04:28:13 EST 2017


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1511359897 -28800
#      Wed Nov 22 22:11:37 2017 +0800
# Node ID b95d29f0e64c433c40ec23ad415f848d3c77429b
# Parent  32c7b8d09f80d30062952d897733b8761fcfe80f
# EXP-Topic hgweb-cleanup
hgweb: look up "URLSearchParams" in "window" to work around jshint issues

Unfortunately, current version of jshint (2.9.5) doesn't know such a global
variable and complains that it's undefined. Since this line tries to look up
URLSearchParams in a global scope (i.e. window), let's simply preface it with
"window." to work around jshint.

diff --git a/mercurial/templates/static/mercurial.js b/mercurial/templates/static/mercurial.js
--- a/mercurial/templates/static/mercurial.js
+++ b/mercurial/templates/static/mercurial.js
@@ -451,7 +451,7 @@ function renderDiffOptsForm() {
         "ignoreblanklines",
     ];
 
-    var urlParams = new URLSearchParams(window.location.search);
+    var urlParams = new window.URLSearchParams(window.location.search);
 
     function updateAndRefresh(e) {
         var checkbox = e.target;


More information about the Mercurial-devel mailing list