Bug 1831963 - Remove the bypassSignatureVerificationIfDev check; r=nordzilla

This is another raw preference read, and rather than rewrite it, we were
wanting to get rid of this anyway.

Differential Revision: https://phabricator.services.mozilla.com/D179275
This commit is contained in:
Greg Tatum 2023-05-29 19:19:55 +00:00
parent a98e1929f3
commit bb55f37fdf

View File

@ -586,7 +586,6 @@ export class TranslationsParent extends JSWindowActorParent {
/** @type {RemoteSettingsClient} */
const client = lazy.RemoteSettings("translations-identification-models");
bypassSignatureVerificationIfDev(client);
TranslationsParent.#languageIdModelsRemoteClient = client;
return client;
@ -762,8 +761,6 @@ export class TranslationsParent extends JSWindowActorParent {
const client = lazy.RemoteSettings("translations-models");
TranslationsParent.#translationModelsRemoteClient = client;
bypassSignatureVerificationIfDev(client);
client.on("sync", async ({ data: { created, updated, deleted } }) => {
// Language model attachments will only be downloaded when they are used.
lazy.console.log(
@ -997,8 +994,6 @@ export class TranslationsParent extends JSWindowActorParent {
TranslationsParent.#translationsWasmRemoteClient = client;
bypassSignatureVerificationIfDev(client);
client.on("sync", async ({ data: { created, updated, deleted } }) => {
lazy.console.log(`"sync" event for remote bergamot wasm `, {
created,
@ -1649,29 +1644,6 @@ export class TranslationsParent extends JSWindowActorParent {
}
}
/**
* The signature verification can break on the Dev server. Bypass it to ensure new
* language models can always be tested. On Prod and Staging the signatures will
* always be verified.
*
* @param {RemoteSettingsClient} client
*/
function bypassSignatureVerificationIfDev(client) {
let host;
try {
const url = new URL(Services.prefs.getCharPref("services.settings.server"));
host = url.host;
} catch (error) {}
if (host === "remote-settings-dev.allizom.org") {
console.warn(
"The translations is set to the Remote Settings dev server. It's bypassing " +
"the signature verification."
);
client.verifySignature = false;
}
}
/**
* WebAssembly modules must be instantiated from a Worker, since it's considered
* unsafe eval.