From 2376f91e055d1d9eda7caaff0420cc3242da4e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Wed, 24 Feb 2021 22:04:30 +0000 Subject: [PATCH] Bug 1694728 - pause the fluent observer while updating the about:processes or about:performance page, r=Gijs. Differential Revision: https://phabricator.services.mozilla.com/D106299 --- .../components/aboutperformance/content/aboutPerformance.js | 5 +++++ toolkit/components/aboutprocesses/content/aboutProcesses.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/toolkit/components/aboutperformance/content/aboutPerformance.js b/toolkit/components/aboutperformance/content/aboutPerformance.js index a243a6942b1a..69ab397e8f21 100644 --- a/toolkit/components/aboutperformance/content/aboutPerformance.js +++ b/toolkit/components/aboutperformance/content/aboutPerformance.js @@ -504,10 +504,15 @@ var View = { // to avoid flicker when resizing. await document.l10n.translateFragment(this._fragment); + // Pause the DOMLocalization mutation observer, or the already translated + // content will be translated a second time at the next tick. + document.l10n.pauseObserving(); while (tbody.firstChild) { tbody.firstChild.remove(); } tbody.appendChild(this._fragment); + document.l10n.resumeObserving(); + this._fragment = document.createDocumentFragment(); }, insertAfterRow(row) { diff --git a/toolkit/components/aboutprocesses/content/aboutProcesses.js b/toolkit/components/aboutprocesses/content/aboutProcesses.js index 709e76db2b60..ef1edd104a13 100644 --- a/toolkit/components/aboutprocesses/content/aboutProcesses.js +++ b/toolkit/components/aboutprocesses/content/aboutProcesses.js @@ -410,10 +410,15 @@ var View = { // to avoid flicker when resizing. await document.l10n.translateFragment(this._fragment); + // Pause the DOMLocalization mutation observer, or the already translated + // content will be translated a second time at the next tick. + document.l10n.pauseObserving(); while (tbody.firstChild) { tbody.firstChild.remove(); } tbody.appendChild(this._fragment); + document.l10n.resumeObserving(); + this._fragment = document.createDocumentFragment(); }, insertAfterRow(row) {