Backed out 5 changesets (bug 1831963) for causing failures related to translation. CLOSED TREE

Backed out changeset e2653450faa8 (bug 1831963)
Backed out changeset ced39405b51e (bug 1831963)
Backed out changeset ab6c15a5c8fb (bug 1831963)
Backed out changeset b691f7c48bf9 (bug 1831963)
Backed out changeset 260c6f5b72e6 (bug 1831963)
This commit is contained in:
Sandor Molnar 2023-05-27 03:54:16 +03:00
Родитель c013058f4f
Коммит 05603d4048
7 изменённых файлов: 15 добавлений и 40 удалений

Просмотреть файл

@ -73,10 +73,6 @@ const intermittently_loaded_scripts = {
"resource://gre/modules/nsAsyncShutdown.sys.mjs",
"resource://gre/modules/sessionstore/Utils.sys.mjs",
// Translations code which may be preffed on.
"resource://gre/actors/TranslationsChild.sys.mjs",
"resource://gre/modules/ConsoleAPIStorage.sys.mjs", // Logging related.
// Session store.
"resource://gre/modules/sessionstore/SessionHistory.sys.mjs",

Просмотреть файл

@ -906,9 +906,6 @@ async function checkLoadedScripts({
return !intermittent[scriptType].has(c);
});
if (loadedList[scriptType].length) {
console.log("Unexpected scripts:", loadedList[scriptType]);
}
is(
loadedList[scriptType].length,
0,

Просмотреть файл

@ -27,7 +27,7 @@
closemenu="none"
oncommand="TranslationsPanel.openSettingsPopup(this)">
<image class="translations-panel-gear-icon" />
<menupopup>
<menupopup id="translations-panel-settings-popup">
<menuitem class="always-translate-language-menuitem"
data-l10n-id="translations-panel-settings-always-translate-language"
data-l10n-args='{"language": ""}'
@ -126,6 +126,7 @@
<hbox class="panel-footer translations-panel-footer">
<button class="subviewbutton panel-subview-footer-button"
id="translations-panel-not-now"
oncommand="TranslationsPanel.onCancel(event);"
data-l10n-id="translations-panel-dual-cancel-button"
tabindex="0">

Просмотреть файл

@ -71,9 +71,7 @@ var TranslationsPanel = new (class {
if (header.contains(settingsButton)) {
continue;
}
const settingsButtonClone = settingsButton.cloneNode(true);
settingsButtonClone.removeAttribute("id");
header.appendChild(settingsButtonClone);
header.appendChild(settingsButton.cloneNode(true));
}
// Lazily select the elements.

Просмотреть файл

@ -3768,17 +3768,13 @@ pref("browser.storageManager.pressureNotification.usageThresholdGB", 5);
pref("browser.sanitizer.loglevel", "Warn");
// Enable Firefox translations powered by the Bergamot translations engine[1].
// Enable Firefox translations based on Bergamot[1]. This project is in-development and
// an effort to integrate the Firefox Translations[2] project direcly into Gecko.
// See Bug 971044.
//
// [1]: https://browser.mt/
// [2]: https://github.com/mozilla/firefox-translations
#ifdef EARLY_BETA_OR_EARLIER
pref("browser.translations.enable", true);
#else
pref("browser.translations.enable", false);
#endif
// Set to "All" to see all logs, which are useful for debugging. Set to "Info" to see
// the application logic logs, and not all of the translated messages, which can be
// slow and overwhelming.

Просмотреть файл

@ -53,18 +53,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
"browser.translations.autoTranslate"
);
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"chaosErrorsPref",
"browser.translations.chaos.errors"
);
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"chaosTimeoutMSPref",
"browser.translations.chaos.timeoutMS"
);
/**
* Returns the always-translate language tags as an array.
*/
@ -1859,8 +1847,12 @@ async function chaosMode(probability = 0.5) {
* - browser.translations.chaos.timeoutMS
*/
async function chaosModeTimer() {
if (lazy.chaosTimeoutMSPref) {
const timeout = Math.random() * lazy.chaosTimeoutMSPref;
/** @type {number} */
const timeoutLimit = Services.prefs.getIntPref(
"browser.translations.chaos.timeoutMS"
);
if (timeoutLimit) {
const timeout = Math.random() * timeoutLimit;
lazy.console.log(
`Chaos mode timer started for ${(timeout / 1000).toFixed(1)} seconds.`
);
@ -1875,7 +1867,10 @@ async function chaosModeTimer() {
* - browser.translations.chaos.errors
*/
async function chaosModeError(probability = 0.5) {
if (lazy.chaosErrorsPref && Math.random() < probability) {
if (
Services.prefs.getBoolPref("browser.translations.chaos.errors") &&
Math.random() < probability
) {
lazy.console.trace(`Chaos mode error generated.`);
throw new Error(
`Chaos Mode error from the pref "browser.translations.chaos.errors".`

Просмотреть файл

@ -299,13 +299,6 @@ async function setupActorTest({
detectedLanguageConfidence,
});
// Create a new tab so each test gets a new actor, and doesn't re-use the old one.
const tab = await BrowserTestUtils.openNewForegroundTab(
gBrowser,
BLANK_PAGE,
true // waitForLoad
);
/** @type {import("../../actors/TranslationsParent.sys.mjs").TranslationsParent} */
const actor =
gBrowser.selectedBrowser.browsingContext.currentWindowGlobal.getActor(
@ -316,7 +309,6 @@ async function setupActorTest({
actor,
remoteClients,
cleanup() {
BrowserTestUtils.removeTab(tab);
removeMocks();
return SpecialPowers.popPrefEnv();
},