Prevent multiple CSP entries to be injected in the DOM on each reload if scripting is disabled.
This commit is contained in:
parent
002c8f8b67
commit
1cfb3117ef
|
@ -26,10 +26,8 @@ class DocumentCSP {
|
||||||
try {
|
try {
|
||||||
parent.insertBefore(meta, parent.firstChild);
|
parent.insertBefore(meta, parent.firstChild);
|
||||||
debug(`Failsafe <meta> CSP inserted in the DOM: "%s"`, header.value);
|
debug(`Failsafe <meta> CSP inserted in the DOM: "%s"`, header.value);
|
||||||
if (capabilities.has("script")) {
|
|
||||||
meta.remove();
|
meta.remove();
|
||||||
if (!head) parent.remove();
|
if (!head) parent.remove();
|
||||||
}
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error(e, "Error inserting CSP %s in the DOM", header && header.value);
|
error(e, "Error inserting CSP %s in the DOM", header && header.value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue