[JS] UserActivation must be enabled before running document actions
else auto-print is broken (it's a regression from patch #15822).
This commit is contained in:
parent
4faf927030
commit
dea2471e96
@ -91,6 +91,9 @@ class EventDispatcher {
|
|||||||
if (id === "doc") {
|
if (id === "doc") {
|
||||||
const eventName = event.name;
|
const eventName = event.name;
|
||||||
if (eventName === "Open") {
|
if (eventName === "Open") {
|
||||||
|
// The user has decided to open this pdf, hence we enable
|
||||||
|
// userActivation.
|
||||||
|
this.userActivation();
|
||||||
// Initialize named actions before calling formatAll to avoid any
|
// Initialize named actions before calling formatAll to avoid any
|
||||||
// errors in the case where a formatter is using one of those named
|
// errors in the case where a formatter is using one of those named
|
||||||
// actions (see #15818).
|
// actions (see #15818).
|
||||||
|
@ -1753,4 +1753,31 @@ describe("Interaction", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("in autoprint.pdf", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeAll(async () => {
|
||||||
|
pages = await loadAndWait("autoprint.pdf", ".endOfContent");
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check if printing is triggered when the document is open", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
await page.waitForFunction(
|
||||||
|
"window.PDFViewerApplication.scriptingReady === true"
|
||||||
|
);
|
||||||
|
|
||||||
|
await page.waitForFunction(
|
||||||
|
`document.querySelector(".printedPage") !== null`
|
||||||
|
);
|
||||||
|
await page.keyboard.press("Escape");
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -563,3 +563,4 @@
|
|||||||
!fields_order.pdf
|
!fields_order.pdf
|
||||||
!issue15815.pdf
|
!issue15815.pdf
|
||||||
!issue15818.pdf
|
!issue15818.pdf
|
||||||
|
!autoprint.pdf
|
||||||
|
BIN
test/pdfs/autoprint.pdf
Executable file
BIN
test/pdfs/autoprint.pdf
Executable file
Binary file not shown.
Loading…
Reference in New Issue
Block a user