Degree of Firefox equivalence

Board for discussions around the Basilisk web browser.

Moderator: Basilisk-Dev

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2188
Joined: 2018-05-05, 13:29

Degree of Firefox equivalence

Unread post by vannilla » 2019-03-14, 08:33

I found this piece of code in a forked extension:

Code: Select all

modernFirefox:
        Services.vc.compare(Services.appinfo.platformVersion, '44') > 0 && (
            Services.appinfo.ID === '{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}' ||
            Services.appinfo.ID === '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}'
        )
Running some experiments show that "Services.appinfo.platformVersion" is never higher than 44 in Basilisk, but I suppose it's expected since UXP has nothing to do with Firefox release numbers. However, from the point of view of Basilisk, could "modernFirefox" ever be true? (if possible I'd like to know if this is true for Pale Moon too, but I'm mostly interested in Basilisk.)

Similarily, in a different place there are these two checks:

Code: Select all

if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') >= 0 ) {
        return null;
    }
and later on in a different code path:

Code: Select all

if ( Services.vc.compare(Services.appinfo.platformVersion, '36.0') < 0 ) {
        return null;
    }
These two pieces are mutually exclusive, of course, so the question is wether or not it's safe to take the second branch (version number higher than 36) or not.
Thanks.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35583
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Degree of Firefox equivalence

Unread post by Moonchild » 2019-03-14, 08:38

Such comparisons want to check the APPversion and not the PLATFORMversion, but it's a common mistake in extensions to use platform version because Mozilla has been using "gecko version == firefox version" for a long time. In UXP applications, the platform version will reflect the version of Goanna (currently 4.x) and such checks will therefore never consider it a "modern firefox" because it's checking the wrong thing.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2188
Joined: 2018-05-05, 13:29

Re: Degree of Firefox equivalence

Unread post by vannilla » 2019-03-14, 08:47

Yes, I understand that, so I wanted to know how to approach this for Basilisk.
Is checking the app version enough (and maybe add an ID check too to avoid executing wrong code on Pale Moon)?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35583
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Degree of Firefox equivalence

Unread post by Moonchild » 2019-03-14, 08:50

Checking the appVersion should be enough.
Basilisk uses the Firefox GUID so that's your only recourse.

For Pale Moon, you can check for the Pale Moon GUID and appropriate appVersion there.
Pale Moon's GUID is {8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked