diff --git a/packages/puppeteer-core/src/node/ChromeLauncher.ts b/packages/puppeteer-core/src/node/ChromeLauncher.ts index 58d15ace211..887fa81d4ad 100644 --- a/packages/puppeteer-core/src/node/ChromeLauncher.ts +++ b/packages/puppeteer-core/src/node/ChromeLauncher.ts @@ -192,6 +192,7 @@ export class ChromeLauncher extends ProductLauncher { // Merge default enabled features with user-provided ones, if any. const enabledFeatures = [ + 'PdfOopif', // Add features to enable by default here. ...userEnabledFeatures, ].filter(feature => { diff --git a/test/TestExpectations.json b/test/TestExpectations.json index 66cd6236499..ecbbf63b83c 100644 --- a/test/TestExpectations.json +++ b/test/TestExpectations.json @@ -576,6 +576,13 @@ "expectations": ["SKIP"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, + { + "testIdPattern": "[oopif.spec] OOPIF should evaluate on a page with a PDF viewer", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["chrome-headless-shell"], + "expectations": ["FAIL"], + "comment": "chrome-headless-shell does not have a PDF viewer" + }, { "testIdPattern": "[page.spec] Page Page.addScriptTag should throw when added with content to the CSP page", "platforms": ["darwin", "linux", "win32"], @@ -1437,10 +1444,10 @@ }, { "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.clickablePoint should work for iframes", - "platforms": ["linux", "win32"], + "platforms": ["linux", "win32", "win32"], "parameters": ["cdp", "chrome"], "expectations": ["FAIL", "PASS"], - "comment": "Flaky on Windows and Linux" + "comment": "Flaky with fieldtrial testing config" }, { "testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.isIntersectingViewport should work", @@ -2924,6 +2931,13 @@ "expectations": ["FAIL"], "comment": "TODO: add a comment explaining why this expectation is required (include links to issues)" }, + { + "testIdPattern": "[oopif.spec] OOPIF should evaluate on a page with a PDF viewer", + "platforms": ["darwin", "linux", "win32"], + "parameters": ["firefox", "webDriverBiDi"], + "expectations": ["SKIP"], + "comment": "chrome-specific test" + }, { "testIdPattern": "[oopif.spec] OOPIF should expose events within OOPIFs", "platforms": ["darwin", "linux", "win32"], diff --git a/test/assets/pdf-viewer.html b/test/assets/pdf-viewer.html new file mode 100644 index 00000000000..0c8796c87f9 --- /dev/null +++ b/test/assets/pdf-viewer.html @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/test/assets/sample.pdf b/test/assets/sample.pdf new file mode 100644 index 00000000000..a1eed6df6f1 Binary files /dev/null and b/test/assets/sample.pdf differ diff --git a/test/src/oopif.spec.ts b/test/src/oopif.spec.ts index aa9f3774522..a36a8bc8673 100644 --- a/test/src/oopif.spec.ts +++ b/test/src/oopif.spec.ts @@ -425,6 +425,41 @@ describe('OOPIF', function () { ).toEqual([true, true, false]); }); + it('should exposeFunction on a page with a PDF viewer', async () => { + const {page, server} = state; + + await page.goto(server.PREFIX + '/pdf-viewer.html', { + waitUntil: 'networkidle2', + }); + + await page.exposeFunction('test', () => { + console.log('test'); + }); + }); + + it('should evaluate on a page with a PDF viewer', async () => { + const {page, server} = state; + + await page.goto(server.PREFIX + '/pdf-viewer.html', { + waitUntil: 'networkidle2', + }); + + expect( + await Promise.all( + page.frames().map(async frame => { + return await frame.evaluate(() => { + return window.location.pathname; + }); + }) + ) + ).toEqual([ + '/pdf-viewer.html', + '/sample.pdf', + '/index.html', + '/sample.pdf', + ]); + }); + describe('waitForFrame', () => { it('should resolve immediately if the frame already exists', async () => { const {server, page} = state;