mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 17:55:37 +02:00
Clean up before closing the tab in integration tests
This commit is contained in:
parent
06800cd966
commit
43be717ce3
2 changed files with 11 additions and 2 deletions
|
@ -79,7 +79,13 @@ function closePages(pages) {
|
||||||
return Promise.all(
|
return Promise.all(
|
||||||
pages.map(async ([_, page]) => {
|
pages.map(async ([_, page]) => {
|
||||||
// Avoid to keep something from a previous test.
|
// 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 });
|
await page.close({ runBeforeUnload: false });
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -2098,7 +2098,10 @@ const PDFViewerApplication = {
|
||||||
unbindWindowEvents() {
|
unbindWindowEvents() {
|
||||||
this._windowAbortController?.abort();
|
this._windowAbortController?.abort();
|
||||||
this._windowAbortController = null;
|
this._windowAbortController = null;
|
||||||
if (AppOptions.get("isInAutomation")) {
|
if (
|
||||||
|
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) ||
|
||||||
|
AppOptions.get("isInAutomation")
|
||||||
|
) {
|
||||||
this._globalAbortController?.abort();
|
this._globalAbortController?.abort();
|
||||||
this._globalAbortController = null;
|
this._globalAbortController = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue