なんらかのスクリプト
'use strict';
const EVIL_DOMAINS = [
"error-report.com",
"html-load.com",
"content-loader.com",
];
const isEvilUrl = (urlString) => {
if (!urlString) return false;
const url = (() => {
try {
return new URL(urlString);
} catch {
return false;
}
})();
return EVIL_DOMAINS.some((evilDomain) => url.hostname.endsWith(evilDomain));
}
const originalRemove = Element.prototype.remove;
Element.prototype.remove = function() {
if (!["STYLE", "LINK"].includes(this.tagName)) return originalRemove.bind(this);
// NOP
}
const removeIfEvilIframe = (element) => {
if (element.src && EVIL_DOMAINS.some((evilDomain) => element.src.includes(evilDomain))) {
originalRemove.call(element);
}
};
const observer = new MutationObserver((mutations) => {
mutations.forEach(({ addedNodes }) => {
addedNodes.forEach((node) => {
if (node.nodeType !== Node.ELEMENT_NODE) return;
if (node.tagName === "IFRAME") {
removeIfEvilIframe(node);
}
if (node.hasChildNodes()) {
const iframes = node.querySelectorAll("iframe");
iframes.forEach(removeIfEvilIframe);
}
});
});
});
observer.observe(document, {
childList: true,
subtree: true,
});
window.confirm = () => { throw null };
window.navigation.addEventListener("navigate", (event) => {
if (isEvilUrl(event.destination.url)) {
event.preventDefault();
}
});