fix: Hls.cast dead code, double-patch interceptors, manifest URL patterns
CI / test (pull_request) Successful in 32s

Hls.cast() is a TypeScript identity cast in hls.js — returns input unchanged,
NOT a reverse-lookup. Replaced with scanning video element properties for
HLS instance references real players store as custom properties.

Fixed double-patching bug in interceptors.js and expanded URL pattern
matching to cover /hls/, /playlist/, /manifest/, .hlsvod paths.

83/83 tests pass, clean build (9 modules).
This commit is contained in:
robot committed 2026-08-12 21:21:03 +00:00
1 parent 542c5786be
commit 3cf402d3c7
3 files changed
+90 -50

No files matched your search

+9 -7
View File
@@ -753,19 +753,21 @@ describe('HLS QA: Deep probe strategies', () => {
});
const win = dom.window;
// Mock Hls with cast API
// Real players attach the HLS instance on the video element as a custom property.
// Hls.cast() is a TypeScript identity cast in hls.js (returns input unchanged),
// NOT a reverse-lookup — so we test what actually works in practice.
const video = win.document.getElementById('v');
video.__hlsInstance = { url: 'https://cdn.example.com/video.m3u8' };
win.Hls = class {
static cast(v) {
if (v === video) return { url: 'https://cdn.example.com/cast.m3u8' };
return null;
}
// cast() is a no-op identity function in the real hls.js library
static cast(v) { return v; }
};
const results = runProbeInWin(win);
const found = results.find(r => r.player === 'Hls.cast');
if (!found) throw new Error('Hls.cast manifest not detected. Results: ' + JSON.stringify(results));
// Should detect via video element property scan (Strategy B1)
const found = results.find(r => r.player && r.player.includes('video.') && r.url.includes('.m3u8'));
if (!found) throw new Error('Video element HLS instance not detected. Results: ' + JSON.stringify(results));
});
it('should prefer interceptor-collected manifests over inline-script', () => {