Further refresh syntax parsing leniency (thanks insertscript).
This commit is contained in:
parent
f101661175
commit
24aedad38c
|
@ -37,7 +37,7 @@ function ReportingCSP(reportURI, reportGroup) {
|
||||||
} else if (blocker && /^(Location|Refresh)$/i.test(h.name)) {
|
} else if (blocker && /^(Location|Refresh)$/i.test(h.name)) {
|
||||||
// neutralize any HTTP redirection to data: URLs, like Chromium
|
// neutralize any HTTP redirection to data: URLs, like Chromium
|
||||||
let url = /^R/i.test(h.name)
|
let url = /^R/i.test(h.name)
|
||||||
? h.value.replace(/^[^,;]*[,;]\W*url[^=]*=[^!#$%&()*+,/:;=?@[\]\w.,~-]*/i, "") : h.value;
|
? h.value.replace(/^[^,;]*[,;](?:\W*url[^=]*=)?[^!#$%&()*+,/:;=?@[\]\w.,~-]*/i, "") : h.value;
|
||||||
if (/^data:/i.test(url)) {
|
if (/^data:/i.test(url)) {
|
||||||
h.value = h.value.slice(0, -url.length) + "data:";
|
h.value = h.value.slice(0, -url.length) + "data:";
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ notifyPage();
|
||||||
addEventListener("DOMContentLoaded", e => {
|
addEventListener("DOMContentLoaded", e => {
|
||||||
if (ns.canScript) return;
|
if (ns.canScript) return;
|
||||||
for (let m of document.querySelectorAll("meta[http-equiv=refresh]")) {
|
for (let m of document.querySelectorAll("meta[http-equiv=refresh]")) {
|
||||||
if (/^[^,;]*[,;]\W*url[^=]*=[^!#$%&()*+,/:;=?@[\]\w.,~-]*data:/i.test(m.getAttribute("content"))) {
|
if (/^[^,;]*[,;](?:\W*url[^=]*=)?[^!#$%&()*+,/:;=?@[\]\w.,~-]*data:/i.test(m.getAttribute("content"))) {
|
||||||
let url = m.getAttribute("content").replace(/.*?(?=data:)/i, "");
|
let url = m.getAttribute("content").replace(/.*?(?=data:)/i, "");
|
||||||
log(`Blocking refresh to ${url}`);
|
log(`Blocking refresh to ${url}`);
|
||||||
window.stop();
|
window.stop();
|
||||||
|
|
Loading…
Reference in New Issue