mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: turn on PdfOopif for PDF viewer (#12370)
Refs: #12292, #10696, #12172
This commit is contained in:
parent
44fb53eb33
commit
73d7692ae9
@ -192,6 +192,7 @@ export class ChromeLauncher extends ProductLauncher {
|
|||||||
|
|
||||||
// Merge default enabled features with user-provided ones, if any.
|
// Merge default enabled features with user-provided ones, if any.
|
||||||
const enabledFeatures = [
|
const enabledFeatures = [
|
||||||
|
'PdfOopif',
|
||||||
// Add features to enable by default here.
|
// Add features to enable by default here.
|
||||||
...userEnabledFeatures,
|
...userEnabledFeatures,
|
||||||
].filter(feature => {
|
].filter(feature => {
|
||||||
|
@ -576,6 +576,13 @@
|
|||||||
"expectations": ["SKIP"],
|
"expectations": ["SKIP"],
|
||||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
"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",
|
"testIdPattern": "[page.spec] Page Page.addScriptTag should throw when added with content to the CSP page",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
@ -1437,10 +1444,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.clickablePoint should work for iframes",
|
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.clickablePoint should work for iframes",
|
||||||
"platforms": ["linux", "win32"],
|
"platforms": ["linux", "win32", "win32"],
|
||||||
"parameters": ["cdp", "chrome"],
|
"parameters": ["cdp", "chrome"],
|
||||||
"expectations": ["FAIL", "PASS"],
|
"expectations": ["FAIL", "PASS"],
|
||||||
"comment": "Flaky on Windows and Linux"
|
"comment": "Flaky with fieldtrial testing config"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.isIntersectingViewport should work",
|
"testIdPattern": "[elementhandle.spec] ElementHandle specs ElementHandle.isIntersectingViewport should work",
|
||||||
@ -2924,6 +2931,13 @@
|
|||||||
"expectations": ["FAIL"],
|
"expectations": ["FAIL"],
|
||||||
"comment": "TODO: add a comment explaining why this expectation is required (include links to issues)"
|
"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",
|
"testIdPattern": "[oopif.spec] OOPIF should expose events within OOPIFs",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
3
test/assets/pdf-viewer.html
Normal file
3
test/assets/pdf-viewer.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<iframe src="sample.pdf"></iframe>
|
BIN
test/assets/sample.pdf
Normal file
BIN
test/assets/sample.pdf
Normal file
Binary file not shown.
@ -425,6 +425,41 @@ describe('OOPIF', function () {
|
|||||||
).toEqual([true, true, false]);
|
).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', () => {
|
describe('waitForFrame', () => {
|
||||||
it('should resolve immediately if the frame already exists', async () => {
|
it('should resolve immediately if the frame already exists', async () => {
|
||||||
const {server, page} = state;
|
const {server, page} = state;
|
||||||
|
Loading…
Reference in New Issue
Block a user