summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2019-02-01 01:17:58 +0100
committerhackademix2019-02-01 01:17:58 +0100
commit0878ad2b0a0d3af5db66cc6a4f7d882e17a13365 (patch)
tree877ee5d84d5cb33e6e4091c2418afdb11731ceee
parentd152a5387197e37bbb9838392f454f041e2478ea (diff)
downloadnoscript-0878ad2b0a0d3af5db66cc6a4f7d882e17a13365.tar.gz
noscript-0878ad2b0a0d3af5db66cc6a4f7d882e17a13365.tar.xz
noscript-0878ad2b0a0d3af5db66cc6a4f7d882e17a13365.zip
Remove usage of non-standard Array methods.
-rw-r--r--src/content/ftp.js6
-rw-r--r--src/lib/persistent-tabs.js4
-rw-r--r--src/ui/toolbar.js2
-rw-r--r--src/xss/InjectionChecker.js9
4 files changed, 10 insertions, 11 deletions
diff --git a/src/content/ftp.js b/src/content/ftp.js
index 4b9585e..73ef5e8 100644
--- a/src/content/ftp.js
+++ b/src/content/ftp.js
@@ -9,7 +9,7 @@
) {
return;
}
-
+
gTable = document.getElementsByTagName("table")[0];
gTBody = gTable.tBodies[0];
if (gTBody.rows.length < 2)
@@ -31,7 +31,7 @@
headCells[i].addEventListener("click", rowAction(i), true);
}
if (gUI_showHidden) {
- gRows = Array.slice(gTBody.rows);
+ gRows = Array.from(gTBody.rows);
hiddenObjects = gRows.some(row => row.className == "hidden-object");
}
gTable.setAttribute("order", "");
@@ -60,7 +60,7 @@
}
function orderBy(column) {
if (!gRows)
- gRows = Array.slice(gTBody.rows);
+ gRows = Array.from(gTBody.rows);
var order;
if (gOrderBy == column) {
order = gTable.getAttribute("order") == "asc" ? "desc" : "asc";
diff --git a/src/lib/persistent-tabs.js b/src/lib/persistent-tabs.js
index 8f7f711..f24c6dd 100644
--- a/src/lib/persistent-tabs.js
+++ b/src/lib/persistent-tabs.js
@@ -7,12 +7,12 @@ if (typeof flextabs === "function") {
let rx = new RegExp(`(?:^|[#;])tab-${id}=(\\d+)(?:;|$)`);
let current = location.hash.match(rx);
console.log(`persisted %o`, current);
- let toggles = tabs.querySelectorAll(".flextabs__toggle");
+ let toggles = Array.from(tabs.querySelectorAll(".flextabs__toggle"));
let currentToggle = toggles[current && parseInt(current[1]) || 0];
if (currentToggle) currentToggle.click();
for (let toggle of toggles) {
toggle.addEventListener("click", e => {
- let currentIdx = Array.indexOf(toggles, toggle);
+ let currentIdx = toggles.indexOf(toggle);
location.hash = location.hash.split(";").filter(p => !rx.test(p))
.concat(`tab-${id}=${currentIdx}`).join(";");
});
diff --git a/src/ui/toolbar.js b/src/ui/toolbar.js
index d2a2f6e..df3515e 100644
--- a/src/ui/toolbar.js
+++ b/src/ui/toolbar.js
@@ -87,7 +87,7 @@
}
UI.local.toolbarLayout = {
left, right,
- hidden: Array.map(document.querySelectorAll("#top > .hider > .icon"), el => el.id),
+ hidden: Array.from(document.querySelectorAll("#top > .hider > .icon")).map(el => el.id),
};
debug("%o", UI.local);
diff --git a/src/xss/InjectionChecker.js b/src/xss/InjectionChecker.js
index 181ea49..45ef29b 100644
--- a/src/xss/InjectionChecker.js
+++ b/src/xss/InjectionChecker.js
@@ -107,11 +107,10 @@ XSS.InjectionChecker = (async () => {
var bs = {
nq: new RegExp("[" + def + "]")
};
- Array.forEach("'\"`", // special treatment for quotes
- function(c) {
- bs[c] = new RegExp("[" + def + c + "]");
- }
- );
+ for (let c of ['"', '"', '`']) {
+ // special treatment for quotes
+ bs[c] = new RegExp("[" + def + c + "]");
+ }
delete this.breakStops;
return (this.breakStops = bs);
},