1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

Clean up before closing the tab in integration tests

This commit is contained in:
Calixte Denizet 2024-06-18 14:02:46 +02:00
parent 06800cd966
commit 43be717ce3
2 changed files with 11 additions and 2 deletions

View file

@ -79,7 +79,13 @@ function closePages(pages) {
return Promise.all(
pages.map(async ([_, page]) => {
// Avoid to keep something from a previous test.
await page.evaluate(() => window.localStorage.clear());
await page.evaluate(async () => {
const viewer = window.PDFViewerApplication;
viewer.unbindWindowEvents();
viewer.unbindEvents();
await viewer.close();
window.localStorage.clear();
});
await page.close({ runBeforeUnload: false });
})
);