Remove Admiral adblock walls

This commit is contained in:
2026-05-16 22:45:23 -07:00
parent 73b5313a0c
commit 0ef0360fde
2 changed files with 103 additions and 2 deletions

View File

@@ -100,6 +100,34 @@ test("renderPage removes common cookie consent overlays before snapshot", async
assert.doesNotMatch(rendered, /<body[^>]*class="[^"]*didomi-popup-open/i);
});
test("renderPage removes Admiral adblock walls before snapshot", async () => {
const html = `<!doctype html>
<html style="overflow: hidden;">
<body style="overflow: hidden;">
<main>Article text</main>
<div style="position: fixed; inset: 0; z-index: 2147483647; overflow: auto;">
<section>
<h2>Support The Verge by allowing ads</h2>
<p>Or <a href="https://www.theverge.com/subscribe?itm_campaign=admiraladblock&itm_source=popup">subscribe</a> to continue using your ad blocker uninterrupted.</p>
<button>ALLOW ADS</button>
<a href="https://%67e%74%61%64mi%72%61l.com/pb/">Powered By</a>
</section>
</div>
</body>
</html>`;
const rendered = await renderPage(`data:text/html,${encodeURIComponent(html)}`, {
userscriptDelay: 0
});
assert.match(rendered, /Article text/);
assert.doesNotMatch(rendered, /Support The Verge by allowing ads/);
assert.doesNotMatch(rendered, /ALLOW ADS/);
assert.doesNotMatch(rendered, /getadmiral|%67e%74%61%64mi%72%61l/i);
assert.doesNotMatch(rendered, /<html[^>]*style="[^"]*overflow:\s*hidden/i);
assert.doesNotMatch(rendered, /<body[^>]*style="[^"]*overflow:\s*hidden/i);
});
test("renderPage serializes CSSOM-inserted style rules", async () => {
const html = `<!doctype html>
<html>