mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-01-23 16:02:42 +01:00
Check if domain in list to manipulate DOM (#1)
This commit is contained in:
parent
a35f41cc32
commit
9af1659cdf
@ -28,15 +28,21 @@ var manipulateDOM = {};
|
|||||||
|
|
||||||
manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
||||||
|
|
||||||
|
|
||||||
|
let initiatorDomain, listedToManipulateDOM;
|
||||||
|
listedToManipulateDOM = stateManager._domainIsWhitelisted(initiatorDomain, "manipulate-dom");
|
||||||
|
initiatorDomain = helpers.extractDomainFromUrl(details.url, true) || Address.EXAMPLE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// by Jaap (https://gitlab.com/Jaaap)
|
// by Jaap (https://gitlab.com/Jaaap)
|
||||||
let header = details.responseHeaders.find(h => h.name.toLowerCase() === 'content-type');
|
let header = details.responseHeaders.find(h => h.name.toLowerCase() === 'content-type');
|
||||||
|
|
||||||
if (header && BrowserType.FIREFOX) {
|
if (header && BrowserType.FIREFOX && listedToManipulateDOM) {
|
||||||
|
|
||||||
let mimeType, initiatorDomain, isWhitelisted;
|
let mimeType, isWhitelisted;
|
||||||
|
|
||||||
mimeType = header.value.replace(/;.*/, '').toLowerCase();
|
mimeType = header.value.replace(/;.*/, '').toLowerCase();
|
||||||
initiatorDomain = helpers.extractDomainFromUrl(details.url, true) || Address.EXAMPLE;
|
|
||||||
isWhitelisted = stateManager._domainIsWhitelisted(initiatorDomain);
|
isWhitelisted = stateManager._domainIsWhitelisted(initiatorDomain);
|
||||||
|
|
||||||
if (!isWhitelisted && mimeType === 'text/html') {
|
if (!isWhitelisted && mimeType === 'text/html') {
|
||||||
|
Loading…
Reference in New Issue
Block a user