mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1733839 - Update RemoteL10n download path for Remote Settings attachments r=Mardak
Differential Revision: https://phabricator.services.mozilla.com/D127367
This commit is contained in:
parent
082dc1a4ea
commit
12f19e0443
@ -297,7 +297,9 @@ const MessageLoaderUtils = {
|
||||
if (record && record.data) {
|
||||
const downloader = new Downloader(
|
||||
RS_MAIN_BUCKET,
|
||||
RS_COLLECTION_L10N
|
||||
RS_COLLECTION_L10N,
|
||||
"browser",
|
||||
"newtab"
|
||||
);
|
||||
// Await here in order to capture the exceptions for reporting.
|
||||
await downloader.download(record.data, {
|
||||
|
@ -47,6 +47,7 @@ https_first_disabled = true
|
||||
[browser_newtab_trigger.js]
|
||||
[browser_open_tab_focus.js]
|
||||
skip-if = (os == "linux") # Test setup only implemented for OSX and Windows
|
||||
[browser_remote_l10n.js]
|
||||
[browser_topsites_contextMenu_options.js]
|
||||
[browser_topsites_section.js]
|
||||
[browser_asrouter_cfr.js]
|
||||
|
@ -0,0 +1,37 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const { RemoteL10n } = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/RemoteL10n.jsm"
|
||||
);
|
||||
|
||||
add_task(async function test_TODO() {
|
||||
const CONTENT = "remote_l10n_test_string = RemoteL10n string";
|
||||
const dirPath = OS.Path.join(
|
||||
OS.Constants.Path.localProfileDir,
|
||||
...["settings", "main", "ms-language-packs", "browser", "newtab"]
|
||||
);
|
||||
const filePath = OS.Path.join(dirPath, "asrouter.ftl");
|
||||
|
||||
await IOUtils.makeDirectory(dirPath, {
|
||||
ignoreExisting: true,
|
||||
from: OS.Constants.Path.localProfileDir,
|
||||
});
|
||||
await IOUtils.writeUTF8(filePath, CONTENT, {
|
||||
tmpPath: `${filePath}.tmp`,
|
||||
});
|
||||
|
||||
RemoteL10n.reloadL10n();
|
||||
|
||||
let [{ value }] = await RemoteL10n.l10n.formatMessages([
|
||||
{ id: "remote_l10n_test_string" },
|
||||
]);
|
||||
|
||||
Assert.equal(
|
||||
value,
|
||||
"RemoteL10n string",
|
||||
"Got back the string we wrote to disk"
|
||||
);
|
||||
});
|
@ -2743,6 +2743,24 @@ describe("ASRouter", () => {
|
||||
spy = sandbox.spy();
|
||||
global.Downloader.prototype.download = spy;
|
||||
});
|
||||
it("should be called with the expected dir path", async () => {
|
||||
const dlSpy = sandbox.spy(global, "Downloader");
|
||||
|
||||
sandbox
|
||||
.stub(global.Services.locale, "appLocaleAsBCP47")
|
||||
.get(() => "en-US");
|
||||
sandbox.stub(global.RemoteL10n, "isLocaleSupported").returns(true);
|
||||
|
||||
await MessageLoaderUtils._remoteSettingsLoader(provider, {});
|
||||
|
||||
assert.calledWith(
|
||||
dlSpy,
|
||||
"main",
|
||||
"ms-language-packs",
|
||||
"browser",
|
||||
"newtab"
|
||||
);
|
||||
});
|
||||
it("should allow fetch for known locales", async () => {
|
||||
sandbox
|
||||
.stub(global.Services.locale, "appLocaleAsBCP47")
|
||||
|
Loading…
Reference in New Issue
Block a user