mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 08:13:12 +09:00
Fix global leaks detected by mocha
Fix globals leaked in stringUtils, isJson and static/nav.html.
This commit is contained in:
1 parent
0a9ddef120
commit
0d4ad2f075
3 files changed
+3
-4
No files matched your search
+1
-2
@@ -3,8 +3,7 @@ function hashCode(string){
|
|||||||
var hash = 0;
|
var hash = 0;
|
||||||
if (string.length == 0) return hash;
|
if (string.length == 0) return hash;
|
||||||
for (let i = 0; i < string.length; i++) {
|
for (let i = 0; i < string.length; i++) {
|
||||||
char = string.charCodeAt(i);
|
hash = ((hash << 5) - hash) + string.charCodeAt(i);
|
||||||
hash = ((hash << 5) - hash) + char;
|
|
||||||
hash = hash & hash; // Convert to 32bit integer
|
hash = hash & hash; // Convert to 32bit integer
|
||||||
}
|
}
|
||||||
return hash;
|
return hash;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ module.exports = function(x){
|
|||||||
if(x === false || x === true || x === null) return true; // === false is valid JSON, so is true and null
|
if(x === false || x === true || x === null) return true; // === false is valid JSON, so is true and null
|
||||||
var isNotJson = false
|
var isNotJson = false
|
||||||
try{
|
try{
|
||||||
z = JSON.parse(x);
|
JSON.parse(x);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
isNotJson = true;
|
isNotJson = true;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<%# Very ugly ejs code to hide the Players button if the playerManager plugin isn`t installed %>
|
<%# Very ugly ejs code to hide the Players button if the playerManager plugin isn`t installed %>
|
||||||
<%
|
<%
|
||||||
sidebarPluginButtonsHtml = "";
|
let sidebarPluginButtonsHtml = "";
|
||||||
for(let o in locals.masterPlugins){
|
for(let o in locals.masterPlugins){
|
||||||
let plug = locals.masterPlugins[o];
|
let plug = locals.masterPlugins[o];
|
||||||
if(plug.main
|
if(plug.main
|
||||||
|
|||||||
Reference in new issue
Block a user