From 758b9c3a1736e7b38ffe5064496947c48c34928b Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 18 Apr 2023 09:05:29 +0200 Subject: [PATCH] mobile-config-autoconfig: fix 2x restart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On first start, only restart Firefox once after the files are installed. [2023-04-18 07:07:05] Running mobile-config-autoconfig.js [2023-04-18 07:07:05] Couldn't get Firefox version (expected on first start): TypeError: Services.appinfo.lastAppVersion is null [2023-04-18 07:07:05] Firefox version: 0 (previous: unknown) [2023-04-18 07:07:05] Creating CSS file from fragments: /home/user/.mozilla/firefox/ah7sid6m.default-release/chrome/userChrome.css … [2023-04-18 07:07:05] Updating previous Firefox version to: 0 [2023-04-18 07:07:05] Triggering Firefox restart [2023-04-18 07:07:05] Done [2023-04-18 07:07:11] Running mobile-config-autoconfig.js [2023-04-18 07:07:11] Firefox version: 102 (previous: 0) [2023-04-18 07:07:11] Reading fragments from file: /etc/mobile-config-firefox/userChrome.files [2023-04-18 07:07:11] Fragment with FF version check included: userChrome/popups.before-ff-108.css [2023-04-18 07:07:11] File is up-to-date: /home/user/.mozilla/firefox/ah7sid6m.default-release/chrome/userChrome.css [2023-04-18 07:07:11] Reading fragments from file: /etc/mobile-config-firefox/userContent.files [2023-04-18 07:07:11] File is up-to-date: /home/user/.mozilla/firefox/ah7sid6m.default-release/chrome/userContent.css [2023-04-18 07:07:11] Updating previous Firefox version to: 102 [2023-04-18 07:07:11] Setting default preferences [2023-04-18 07:07:11] Done --- src/mobile-config-autoconfig.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mobile-config-autoconfig.js b/src/mobile-config-autoconfig.js index 049f216..5d9691d 100644 --- a/src/mobile-config-autoconfig.js +++ b/src/mobile-config-autoconfig.js @@ -250,7 +250,10 @@ function css_files_update() { var file = css_file_get(name); if (file.exists()) { - if (g_ff_version != ff_previous) { + /* During the very first start, ff_previous is first "unknown", + * then the files get installed and Firefox gets restarted. + * Then ff_previous is 0. Don't restart it again. */ + if (ff_previous != 0 && g_ff_version != ff_previous) { log("Removing outdated file: " + file.path + " (Firefox" + " version changed)"); file.remove(false);