Bug 1615450 - Add `Services.appinfo` to JEXL filter context r=leplatrem

Differential Revision: https://phabricator.services.mozilla.com/D62839

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Michael Cooper 2020-02-19 18:04:39 +00:00
Родитель 7f5f33cf2f
Коммит d49fff7e75
3 изменённых файлов: 33 добавлений и 0 удалений

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

@ -259,4 +259,8 @@ class ClientEnvironmentBase {
static get attribution() {
return AttributionCode.getAttrDataAsync();
}
static get appinfo() {
return Services.appinfo;
}
}

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

@ -1 +1,2 @@
[browser_ClientEnvironment.js]
[browser_JsonSchemaValidator.js]

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

@ -0,0 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/*
* This can't be an xpcshell-test because, according to
* `toolkit/modules/Services.jsm`, "Not all applications implement
* nsIXULAppInfo (e.g. xpcshell doesn't)."
*/
const { ClientEnvironmentBase } = ChromeUtils.import(
"resource://gre/modules/components-utils/ClientEnvironment.jsm"
);
add_task(function testBuildId() {
ok(
ClientEnvironmentBase.appinfo !== undefined,
"appinfo should be available in the context"
);
ok(
typeof ClientEnvironmentBase.appinfo === "object",
"appinfo should be an object"
);
ok(
typeof ClientEnvironmentBase.appinfo.appBuildID === "string",
"buildId should be a string"
);
});