fix: add web_accessible_resources for interceptors.js in manifest.json
CI / test (pull_request) Failing after 16s
CI / test (pull_request) Failing after 16s
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.
This commit is contained in:
1 parent
bc3f37ae4c
commit
15816a8579
2 files changed
+26
No files matched your search
@@ -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").'
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user