1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 // Disable `xpc::IsInAutomation()` so that missing variables don't throw
6 Services.prefs.setBoolPref(
7 "security.turn_off_all_security_so_that_viruses_can_take_over_this_computer",
12 * The following test demonstrates crashing behavior.
14 add_task(function test_missing_variables() {
15 const l10nReg = new L10nRegistry();
18 { path: "/localization/en-US/browser/test.ftl", source: "welcome-message = Welcome { $user }\n" }
20 const locales = ["en-US"];
21 const source = L10nFileSource.createMock("test", "app", locales, "/localization/{locale}", fs);
22 l10nReg.registerSources([source]);
23 const l10n = new Localization(["/browser/test.ftl"], true, l10nReg, locales);
26 const [message] = l10n.formatValuesSync([{ id: "welcome-message", args: { user: "Greg" } }]);
27 equal(message, "Welcome Greg");
31 // This will crash in debug builds.
32 const [message] = l10n.formatValuesSync([{ id: "welcome-message" }]);
33 equal(message, "Welcome {$user}");