From 0992a5b821aa3037d9cda0f0fb1f66c895e27ff6 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sat, 25 Dec 2021 09:10:48 -0500 Subject: [PATCH] Add test for https://github.com/gorhill/uBlock/commit/d66cd1116c0e --- platform/npm/tests/snfe.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/platform/npm/tests/snfe.js b/platform/npm/tests/snfe.js index 173d5f233..25c4f9f31 100644 --- a/platform/npm/tests/snfe.js +++ b/platform/npm/tests/snfe.js @@ -311,6 +311,19 @@ describe('SNFE', () => { }); assert.strictEqual(r, 0); }); + + // https://github.com/gorhill/uBlock/commit/d66cd1116c0e + it('should not match on localhost', async () => { + await engine.useLists([ + { name: 'test', raw: '.js$domain=foo.*|bar.*\n/^/$domain=example.*|foo.*' }, + ]); + const r = engine.matchRequest({ + originURL: 'https://localhost/', + type: 'script', + url: 'https://localhost/baz.js', + }); + assert.strictEqual(r, 0); + }); }); }); }