From 15816a85799946183aab791d6244535c0f628906 Mon Sep 17 00:00:00 2001 From: Hermes QA Date: Wed, 12 Aug 2026 01:23:05 +0000 Subject: [PATCH] fix: add web_accessible_resources for interceptors.js in manifest.json Without this, Chrome blocks chrome.runtime.getURL('interceptors.js') in Manifest V3, causing HLS detection to silently fail. Added regression test to prevent future removal. --- __tests__/config_validation.test.mjs | 20 ++++++++++++++++++++ manifest.json | 6 ++++++ 2 files changed, 26 insertions(+) diff --git a/__tests__/config_validation.test.mjs b/__tests__/config_validation.test.mjs index 51a3ede..c45c059 100644 --- a/__tests__/config_validation.test.mjs +++ b/__tests__/config_validation.test.mjs @@ -79,4 +79,24 @@ describe('Config: build integrity', () => { throw new Error('No content_scripts entry references content.js'); } }); + + it('manifest.json must declare interceptors.js in web_accessible_resources', () => { + const manifest = JSON.parse( + readFileSync(resolve(root, 'manifest.json'), 'utf8') + ); + const war = manifest.web_accessible_resources; + if (!war || !Array.isArray(war)) { + throw new Error( + 'manifest.json has no web_accessible_resources. ' + + 'interceptors.js needs this for chrome.runtime.getURL() to work.' + ); + } + const allResources = war.flatMap(entry => entry.resources || []); + if (!allResources.includes('interceptors.js')) { + throw new Error( + 'manifest.json web_accessible_resources must include interceptors.js. ' + + 'Without it, the browser blocks chrome.runtime.getURL("interceptors.js").' + ); + } + }); }); diff --git a/manifest.json b/manifest.json index 2e177e1..489e0e1 100644 --- a/manifest.json +++ b/manifest.json @@ -31,6 +31,12 @@ "all_frames": true } ], + "web_accessible_resources": [ + { + "resources": ["interceptors.js"], + "matches": [""] + } + ], "icons": { "16": "icons/icon16.png", "48": "icons/icon48.png",