diff --git a/__tests__/hls_qa.test.mjs b/__tests__/hls_qa.test.mjs index b6c1152..a293121 100644 --- a/__tests__/hls_qa.test.mjs +++ b/__tests__/hls_qa.test.mjs @@ -14,8 +14,8 @@ const viewerSource = fs.readFileSync( ); const interceptorSource = fs.readFileSync( path.join(__dirname, '../src/inject/interceptors.js'), - 'utf-8' -); + 'utf-8' + ); /* ========================================================================== */ /* Helpers */ @@ -1027,21 +1027,48 @@ describe('HLS QA: iframe and multi-frame scenarios', () => { } }); - it('should scrape video elements from all frames', () => { - const indexSource = fs.readFileSync( - path.join(__dirname, '../src/viewer/index.js'), - 'utf-8' - ); + it('should scrape video elements from all frames', () => { + const indexSource = fs.readFileSync( + path.join(__dirname, '../src/viewer/index.js'), + 'utf-8' + ); - // Verify scrapeTab runs in all frames - const scrapeMatch = indexSource.match(/scrapeTab[\s\S]*?executeScript[\s\S]*?\}/); - if (!scrapeMatch) { - throw new Error('scrapeTab function not found'); - } - if (!scrapeMatch[0].includes('allFrames: true')) { - throw new Error('scrapeTab must use allFrames: true'); - } - }); + // Verify scrapeTab runs in all frames + const scrapeMatch = indexSource.match(/scrapeTab[\s\S]*?executeScript[\s\S]*?\}/); + if (!scrapeMatch) { + throw new Error('scrapeTab function not found'); + } + if (!scrapeMatch[0].includes('allFrames: true')) { + throw new Error('scrapeTab must use allFrames: true'); + } + }); + + it('deep probe + scrape must run in the MAIN world (see page globals)', () => { + // The deep probe and scraper read page globals (window.Hls, player + // instances, video._goon_hls_manifest) and window.__goon_plugin_data, + // which the main-world interceptors write. The isolated world cannot see + // these, so a missing `world: 'MAIN'` makes every main-world strategy find + // 0 manifests — the "detects nothing on pages with just