Fixed hard reload needed after releasing restrictions (regression on Firefox Beta).

This commit is contained in:
hackademix 2020-05-15 21:34:39 +02:00
parent 63ca29158a
commit 212e6e2358
1 changed files with 5 additions and 9 deletions

View File

@ -27,10 +27,10 @@ function ReportingCSP(reportURI, reportGroup) {
let needsReportTo = REPORT_TO_SUPPORTED; let needsReportTo = REPORT_TO_SUPPORTED;
let blocker = capabilities && this.buildFromCapabilities(capabilities); let blocker = capabilities && this.buildFromCapabilities(capabilities);
for (let h of responseHeaders) { responseHeaders.forEach((h, index) => {
if (this.isMine(h)) { if (this.isMine(h)) {
header = h; header = h;
h.value = ""; responseHeaders.splice(index, 1);
} else if (needsReportTo && } else if (needsReportTo &&
h.name === REPORT_TO.name && h.value === REPORT_TO.value) { h.name === REPORT_TO.name && h.value === REPORT_TO.value) {
needsReportTo = false; needsReportTo = false;
@ -42,18 +42,14 @@ function ReportingCSP(reportURI, reportGroup) {
h.value = h.value.slice(0, -url.length) + "data:"; h.value = h.value.slice(0, -url.length) + "data:";
} }
} }
} });
if (blocker) { if (blocker) {
if (needsReportTo) { if (needsReportTo) {
responseHeaders.push(REPORT_TO); responseHeaders.push(REPORT_TO);
} }
if (header) { header = this.asHeader(blocker);
header.value = blocker; responseHeaders.push(header);
} else {
header = this.asHeader(blocker);
responseHeaders.push(header);
}
} }
return header; return header;