Try to shutdown Fluent "more" when closing the viewer during testing
Even with PR 18280 fixed, we still *occasionally* see l10n-related errors when closing the integration-tests on the bots.
This commit is contained in:
parent
f9ff613e56
commit
6492587066
@ -2111,16 +2111,15 @@ const PDFViewerApplication = {
|
|||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
async testingClose() {
|
async testingClose() {
|
||||||
this.l10n?.pause();
|
|
||||||
this.findBar?.close();
|
|
||||||
|
|
||||||
this.unbindEvents();
|
this.unbindEvents();
|
||||||
this.unbindWindowEvents();
|
this.unbindWindowEvents();
|
||||||
|
|
||||||
this._globalAbortController?.abort();
|
this._globalAbortController?.abort();
|
||||||
this._globalAbortController = null;
|
this._globalAbortController = null;
|
||||||
|
|
||||||
await this.close();
|
this.findBar?.close();
|
||||||
|
|
||||||
|
await Promise.all([this.l10n?.destroy(), this.close()]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_accumulateTicks(ticks, prop) {
|
_accumulateTicks(ticks, prop) {
|
||||||
|
|||||||
19
web/l10n.js
19
web/l10n.js
@ -23,6 +23,8 @@
|
|||||||
class L10n {
|
class L10n {
|
||||||
#dir;
|
#dir;
|
||||||
|
|
||||||
|
#elements = new Set();
|
||||||
|
|
||||||
#lang;
|
#lang;
|
||||||
|
|
||||||
#l10n;
|
#l10n;
|
||||||
@ -69,6 +71,7 @@ class L10n {
|
|||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
async translate(element) {
|
async translate(element) {
|
||||||
|
this.#elements.add(element);
|
||||||
try {
|
try {
|
||||||
this.#l10n.connectRoot(element);
|
this.#l10n.connectRoot(element);
|
||||||
await this.#l10n.translateRoots();
|
await this.#l10n.translateRoots();
|
||||||
@ -77,6 +80,22 @@ class L10n {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @inheritdoc */
|
||||||
|
async destroy() {
|
||||||
|
for (const element of this.#elements) {
|
||||||
|
this.#l10n.disconnectRoot(element);
|
||||||
|
}
|
||||||
|
this.#elements.clear();
|
||||||
|
this.#l10n.pauseObserving();
|
||||||
|
|
||||||
|
// Since `disconnectRoot`/`pauseObserving` can still trigger asynchronous
|
||||||
|
// operations, without any way to actually cancel them, attempt to
|
||||||
|
// workaround timing issues when closing the integration-tests.
|
||||||
|
await new Promise(resolve => {
|
||||||
|
window.requestAnimationFrame(resolve);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/** @inheritdoc */
|
/** @inheritdoc */
|
||||||
pause() {
|
pause() {
|
||||||
this.#l10n.pauseObserving();
|
this.#l10n.pauseObserving();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user