autoconfig: get_firefox_version: add try…catch

On first run / after:
$ rm ~/.mozilla

The function fails with:
TypeError: Services.appinfo.lastAppVersion is null

Expect the failure so the script doesn't crash.
Revert "autoconfig: get_firefox_version: remove try…catch", but
with another error message.

Without this patch an error shows up when starting Firefox with the
config, until the user manually starts it again.

This reverts commit 2405aabd4c.
This commit is contained in:
Oliver Smith 2023-04-18 08:44:50 +02:00
parent b6227bde5f
commit aaa603fae7
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -71,7 +71,12 @@ function log_obj(obj) {
} }
function get_firefox_version() { function get_firefox_version() {
try {
return Services.appinfo.lastAppVersion.split(".")[0]; return Services.appinfo.lastAppVersion.split(".")[0];
} catch(e) {
log("Couldn't get Firefox version (expected on first start): " + e);
return 0;
}
} }
function get_firefox_version_previous() { function get_firefox_version_previous() {