Degree of Firefox equivalence

Board for discussions around the Basilisk web browser.

Moderator: satrow

vannilla
Lunatic
Lunatic
Posts: 344
Joined: Sat, 05 May 2018, 13:29

Degree of Firefox equivalence

Unread postby vannilla » Thu, 14 Mar 2019, 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: 23008
Joined: Sun, 28 Aug 2011, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: Degree of Firefox equivalence

Unread postby Moonchild » Thu, 14 Mar 2019, 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.
Improving Mozilla code: You know you're on the right track with code changes when you spend the majority of your time deleting code.

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne

vannilla
Lunatic
Lunatic
Posts: 344
Joined: Sat, 05 May 2018, 13:29

Re: Degree of Firefox equivalence

Unread postby vannilla » Thu, 14 Mar 2019, 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: 23008
Joined: Sun, 28 Aug 2011, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: Degree of Firefox equivalence

Unread postby Moonchild » Thu, 14 Mar 2019, 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}
Improving Mozilla code: You know you're on the right track with code changes when you spend the majority of your time deleting code.

"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne


Return to “Basilisk”

Who is online

Users browsing this forum: No registered users and 2 guests