Skip to content

Commit 2ff4c2e

Browse files
committed
support mozconfig
1 parent c4bf6ac commit 2ff4c2e

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

browser/branding/enterprise/byteshift.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# License, v. 2.0. If a copy of the MPL was not distributed with this
33
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
44

5+
import buildconfig
6+
57
# Byte shift value applied to AutoConfig files. Must match the default of the
68
# general.config.obscure_value preference, which the browser subtracts when
79
# reading the file.
@@ -11,8 +13,13 @@
1113
def generate(output, input_path):
1214
"""GENERATED_FILES action: write `input_path` byte shifted by OBSCURE_VALUE.
1315
14-
`output` is a binary file object provided by the build system.
16+
`output` is a binary file object provided by the build system. If
17+
--with-enterprise-console-address was given at configure time, its value
18+
replaces the generic console address placeholder.
1519
"""
1620
with open(input_path, "rb") as fh:
1721
data = fh.read()
22+
address = buildconfig.substs.get("MOZ_ENTERPRISE_CONSOLE_ADDRESS")
23+
if address:
24+
data = data.replace(b"FIREFOX_ENTERPRISE_GENERIC", address.encode())
1825
output.write(bytes((byte + OBSCURE_VALUE) & 0xFF for byte in data))

browser/branding/enterprise/firefox.cfg.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
// the AutoConfig parser; managed preferences belong on the lines below.
33
// FIREFOX_ENTERPRISE_GENERIC is a placeholder: on first launch the console
44
// setup dialog asks for the address and persists it in felt.json. Repacks
5-
// replace it with the actual console address.
5+
// replace it with the actual console address, and local builds can bake one
6+
// in with --with-enterprise-console-address.
67
lockPref("enterprise.console.address", "FIREFOX_ENTERPRISE_GENERIC");

toolkit/moz.configure

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4662,3 +4662,20 @@ set_define("MOZ_ENTERPRISE", enable_enterprise)
46624662

46634663
# Clear the default value to avoid mozilla.com url compiled into product
46644664
imply_option("--with-crashreporter-url", "", when="--enable-enterprise")
4665+
4666+
option(
4667+
"--with-enterprise-console-address",
4668+
nargs=1,
4669+
when="--enable-enterprise",
4670+
help="Bake this enterprise console address into the AutoConfig file "
4671+
"instead of the generic placeholder",
4672+
)
4673+
4674+
4675+
@depends("--with-enterprise-console-address", when="--enable-enterprise")
4676+
def enterprise_console_address(value):
4677+
if value:
4678+
return value[0].rstrip("/")
4679+
4680+
4681+
set_config("MOZ_ENTERPRISE_CONSOLE_ADDRESS", enterprise_console_address)

0 commit comments

Comments
 (0)