Backed out 2 changesets (bug 1685180) for causing Xpcshell failures at test_l10nCache.js. CLOSED TREE

Backed out changeset c05d7c567c19 (bug 1685180)
Backed out changeset be4603eff17c (bug 1685180)
This commit is contained in:
Butkovits Atila 2022-11-21 19:51:30 +02:00
Родитель bf0a7fa012
Коммит 6ded0f39e9
6 изменённых файлов: 4 добавлений и 94 удалений

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

@ -252,10 +252,6 @@ function setupSyncFxAMocks({ fxaDevices = null, state, syncEnabled = true }) {
return {
status: gUIStateStatus,
syncEnabled,
email:
gUIStateStatus === UIState.STATUS_NOT_CONFIGURED
? undefined
: "email@example.com",
};
});
@ -281,7 +277,6 @@ function setupRecentDeviceListMocks() {
sandbox.stub(UIState, "get").returns({
status: UIState.STATUS_SIGNED_IN,
syncEnabled: true,
email: "email@example.com",
});
return sandbox;

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

@ -205,8 +205,6 @@ impl LocalizationRc {
} else {
ret_val.set_is_void(true);
}
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &[id], |id| id.to_string());
ret_err.extend(errors.into_iter().map(|err| err.to_string().into()));
true
} else {
@ -238,8 +236,6 @@ impl LocalizationRc {
ret_val.push(void_string);
}
}
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &keys, |key| key.id.to_string());
ret_err.extend(errors.into_iter().map(|err| err.to_string().into()));
true
} else {
@ -276,8 +272,6 @@ impl LocalizationRc {
});
}
assert_eq!(keys.len(), ret_val.len());
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &keys, |key| key.id.to_string());
ret_err.extend(errors.into_iter().map(|err| err.to_string().into()));
true
} else {
@ -312,8 +306,6 @@ impl LocalizationRc {
v.set_is_void(true);
v
};
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &[id], |id| id.to_string());
let errors = errors
.into_iter()
.map(|err| err.to_string().into())
@ -356,8 +348,6 @@ impl LocalizationRc {
assert_eq!(keys.len(), ret_val.len());
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &keys, |key| key.id.to_string());
let errors = errors
.into_iter()
.map(|err| err.to_string().into())
@ -409,9 +399,6 @@ impl LocalizationRc {
assert_eq!(keys.len(), ret_val.len());
#[cfg(debug_assertions)]
debug_assert_variables_exist(&errors, &keys, |key| key.id.to_string());
let errors = errors
.into_iter()
.map(|err| err.to_string().into())
@ -584,42 +571,3 @@ pub extern "C" fn localization_is_sync(loc: &LocalizationRc) -> bool {
pub extern "C" fn localization_on_change(loc: &LocalizationRc) {
loc.on_change();
}
#[cfg(debug_assertions)]
fn debug_assert_variables_exist<K, F>(
errors: &[fluent_fallback::LocalizationError],
keys: &[K],
to_string: F,
) where
F: Fn(&K) -> String,
{
for error in errors {
if let fluent_fallback::LocalizationError::Resolver { errors, .. } = error {
use fluent::{
resolver::{errors::ReferenceKind, ResolverError},
FluentError,
};
for error in errors {
if let FluentError::ResolverError(ResolverError::Reference(
ReferenceKind::Variable { id },
)) = error
{
// This error needs to be actionable for Firefox engineers to fix
// their Fluent issues. It might be nicer to share the specific
// message, but at this point we don't have that information.
eprintln!(
"Fluent error, the argument \"${}\" was not provided a value.",
id
);
eprintln!("This error happened while formatting the following messages:");
for key in keys {
eprintln!(" {:?}", to_string(key))
}
// Panic with the slightly more cryptic ResolverError.
panic!("{}", error.to_string());
}
}
}
}
}

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

@ -1,6 +1,3 @@
[localization/test_formatValue.html]
skip-if = debug # Intentionally triggers a debug assert for missing Fluent arguments.
[localization/test_formatValues.html]
skip-if = debug # Intentionally triggers a debug assert for missing Fluent arguments.
[localization/test_formatMessages.html]
skip-if = debug # Intentionally triggers a debug assert for missing Fluent arguments.
[localization/test_formatMessages.html]

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

@ -1,28 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* The following test demonstrates crashing behavior.
*/
add_task(function test_missing_variables() {
const l10nReg = new L10nRegistry();
const fs = [
{ path: "/localization/en-US/browser/test.ftl", source: "welcome-message = Welcome { $user }\n" }
]
const locales = ["en-US"];
const source = L10nFileSource.createMock("test", "app", locales, "/localization/{locale}", fs);
l10nReg.registerSources([source]);
const l10n = new Localization(["/browser/test.ftl"], true, l10nReg, locales);
{
const [message] = l10n.formatValuesSync([{ id: "welcome-message", args: { user: "Greg" } }]);
equal(message, "Welcome Greg");
}
{
// This will crash in debug builds.
const [message] = l10n.formatValuesSync([{ id: "welcome-message" }]);
equal(message, "Welcome {$user}");
}
});

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

@ -8,6 +8,4 @@ head =
[test_localization.js]
[test_localization_sync.js]
[test_messagecontext.js]
[test_missing_variables.js]
skip-if = debug # Intentionally triggers a debug assert for missing Fluent arguments.
[test_pseudo.js]

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

@ -67,7 +67,7 @@ RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
file.setAttribute("class", "label");
fileDd.appendChild(file);
document.l10n.setAttributes(fileDd, "file-dd", {
pluginLibraries: plugin.pluginLibraries[0] ?? "",
pluginLibraries: plugin.pluginLibraries[0],
});
dl.appendChild(fileDd);
@ -78,7 +78,7 @@ RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
path.setAttribute("class", "label");
pathDd.appendChild(path);
document.l10n.setAttributes(pathDd, "path-dd", {
pluginFullPath: plugin.pluginFullpath[0] ?? "",
pluginFullPath: plugin.pluginFullpath[0],
});
dl.appendChild(pathDd);
@ -89,7 +89,7 @@ RPMSendQuery("RequestPlugins", {}).then(aPlugins => {
version.setAttribute("class", "label");
versionDd.appendChild(version);
document.l10n.setAttributes(versionDd, "version-dd", {
version: plugin.version ?? "",
version: plugin.version,
});
dl.appendChild(versionDd);