Merge pull request #18289 from Snuffleupagus/app-testingClose
Add a new helper, in the viewer, to close everything during testing
This commit is contained in:
commit
94cbe9ec23
@ -80,10 +80,7 @@ function closePages(pages) {
|
|||||||
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(async () => {
|
await page.evaluate(async () => {
|
||||||
const viewer = window.PDFViewerApplication;
|
await window.PDFViewerApplication.testingClose();
|
||||||
viewer.unbindWindowEvents();
|
|
||||||
viewer.unbindEvents();
|
|
||||||
await viewer.close();
|
|
||||||
window.localStorage.clear();
|
window.localStorage.clear();
|
||||||
});
|
});
|
||||||
await page.close({ runBeforeUnload: false });
|
await page.close({ runBeforeUnload: false });
|
||||||
|
|||||||
23
web/app.js
23
web/app.js
@ -2105,14 +2105,21 @@ const PDFViewerApplication = {
|
|||||||
unbindWindowEvents() {
|
unbindWindowEvents() {
|
||||||
this._windowAbortController?.abort();
|
this._windowAbortController?.abort();
|
||||||
this._windowAbortController = null;
|
this._windowAbortController = null;
|
||||||
if (
|
},
|
||||||
(typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) ||
|
|
||||||
AppOptions.get("isInAutomation")
|
/**
|
||||||
) {
|
* @ignore
|
||||||
this._globalAbortController?.abort();
|
*/
|
||||||
this._globalAbortController = null;
|
async testingClose() {
|
||||||
this.l10n?.pause();
|
this.l10n?.pause();
|
||||||
}
|
|
||||||
|
this.unbindEvents();
|
||||||
|
this.unbindWindowEvents();
|
||||||
|
|
||||||
|
this._globalAbortController?.abort();
|
||||||
|
this._globalAbortController = null;
|
||||||
|
|
||||||
|
await this.close();
|
||||||
},
|
},
|
||||||
|
|
||||||
_accumulateTicks(ticks, prop) {
|
_accumulateTicks(ticks, prop) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user