martok / palefill

Inject Polyfills for various web technologies into pages requiring them
https://martok.github.io/palefill/
Mozilla Public License 2.0
79 stars 9 forks source link

Support more UXP projects #20

Closed martok closed 2 years ago

martok commented 2 years ago

(Separated from #18)

First, I'm not going to add any more supported browsers. This is simply because I don't lie to people: I have no way (or care, really) of testing anything besides Pale Moon and unless someone specifically wants to maintain relevant features on even more niche browsers, that's not gonna happen. In retrospect, even the two that are currently in were a mistake.

After further consideration: not happening. Everybody is free to create their own forks of course, but the UXP ecosystem is apparently aready so fractured that it is impossible to target anything reliably without extensive testing.

~However. With recent changes that take Platform Version into account, there is another route. It is possible to switch based on the "Toolkit Version", for which the addon compat checks always use the Platform Version. This alone would not help here, as you can't switch on which toolkit is meant - mozilla-central is the same as Goanna in that regard. Luckily for us, in Mozilla products the Platform version always tracks the browser version, and has done so since the Phoenix days while Goanna/UXP presents its own version since Goanna 4.1 (skipping backwards from Gecko 52.6). So while a check for "Platform 5.1" would go through for Firefox 5.1, the odds of someone running that and thinking this here addon will fix much are pretty low.~

~The end result should be that any UXP app can install this addon and maybe or maybe not works.~

RamonUnch commented 2 years ago

Thanks a lot for considering extending the support to more niche browsers. I completely understand your line, I would do the same. Just focus on the Browsers I am using. and let other install it easily and let it fail if it does.

About @roytam1 builds he specified:

you may check BuildID to see if certain feature is available or not.

queueMicrotask: since 20220325000000

optchain: since 20220505000000

nullish coalescing: since 20220523000000

checking platform version from my builds can only distinguish if js-optchain and js nullish coalescing is really not available in platform code or not. (i.e. 4.8.4 or older don't have them, 4.8.5 may have them but depends on BuildID) since those features are not available before I bump versions: https://github.com/roytam1/UXP/commits/9816e341b29ac8f3eb5223a6528197e88b381e22

But actually rather than relying on the precise UXP version, I think it would be better to test for the availability of features at runtime and disable the fixes if the browser is able. It should not be hard with queueMicrotask and it is even possible with nullish coalescing operator and optional chaining operator with something like this. also the advantage of runtime syntactic detection is that it is even more future proof.

I have no Javascript skills however so I am not well placed to advise you. I mostly know C/C++ and a couple of other languages.

martok commented 2 years ago

Sorry, but no. If a maintainer chooses to have their own version numbers different from upstream, then they should be well aware of the potential fallout. BuildID is an even more useless information since that is literally just a compiler datestamp.

Of course, the existence of at least one significant project like this completely nullifies everything I had planned here. This is why we can't have nice things.