Provide a way for Fenix or GV to override UA strings for specific websites
Categories
(GeckoView :: General, task, P1)
Tracking
(firefox-esr60 wontfix, firefox66 wontfix, firefox67 wontfix, firefox68 affected)
People
(Reporter: cpeterson, Assigned: snorp)
References
Details
(Whiteboard: [geckoview:fenix:m5])
AMO and SUMO can't differentiate Fennec from Fenix because both browsers use the same User-Agent string:
Mozilla/5.0 (Android 9; Mobile; rv:68.0) Gecko/68.0 Firefox/68.0
AMO mistakenly thinks Fenix can install Fennec add-ons. SUMO can provide appropriate KB articles without knowing which browser the user is using.
If GeckoView 68 spoofs a special version number (e.g. "68.0.99") on https://addons.mozilla.org/ and https://support.mozilla.org/, then the sites' server-side checks can assume:
- version <= 68.0.98 is legacy Fennec
- version >= 68.0.99 is Fenix (or some other GeckoView-powered browser)
Gecko can override the UA for specific websites with UserAgentOverrides.jsm:
https://hg.mozilla.org/mozilla-central/file/tip/mobile/android/app/ua-update.json.in
However, the WebCompat team wants to remove UserAgentOverrides.jsm in Gecko 69. That won't be a problem. AMO's and SUMO's server-side version checks will still work unchanged because:
- Fenix 69 is >= 68.0.99
- Fennec will never have version 69+ because Fennec will move to ESR 68.
This bug was originally filed in the Fenix issue tracker:
https://github.com/mozilla-mobile/fenix/issues/1134
Comment 1•6 years ago
|
||
We don't expose the minior release number in the UA. Seems we can't use https://developer.mozilla.org/en-US/docs/Web/API/Navigator/buildID since 64.
Reporter | ||
Comment 2•6 years ago
|
||
(In reply to Kevin Brosnan [:kbrosnan] from comment #1)
We don't expose the minior release number in the UA. Seems we can't use https://developer.mozilla.org/en-US/docs/Web/API/Navigator/buildID since 64.
Doh! I forgot about that. I'm sure the UserAgentOverrides.jsm feature will send whatever UA string value we want, but sending a three-part version like "68.0.99" might confuse AMO's or SUMO's UA-parsing scripts if they always expect a two-part version like "68.0".
Fenix 68 could spoof version "68.99" or (my original suggestion) version "69.0". I don't expect AMO or SUMO will need different custom content for Fenix 68 and 69.
Comment 3•6 years ago
|
||
Please don't use UserAgentOverrides.jsm
It's being removed in bug 1513574 (It's inefficient and has known bugs).
If you want to change the UA string just for certain domains I would reccomend you do it via the go-faster addon.
https://github.com/mozilla/webcompat-addon
https://searchfox.org/mozilla-central/source/browser/extensions/webcompat
Reporter | ||
Comment 4•6 years ago
|
||
James will investigate how we should handle UA overrides or support the WebCompat extension in Fenix. Fenix wants to bundle the WebCompat extension, but it's not planned for Fenix MVP.
Fenix MVP will ship GV 68 Beta on June 25. TBD when Fenix will update to GV 69, but probably GV 69 Beta or Release in August or September. Without a UA override solution for Fenix 68, AMO and SUMO would not be able to differentiate Fennec and Fenix for about two months. Given that only early adopters will be trying Fenix 68 and SUMO is unlikely to have much Fenix-customized content yet, this might not be a big problem.
Comment 5•6 years ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #4)
James will investigate how we should handle UA overrides or support the WebCompat extension in Fenix. Fenix wants to bundle the WebCompat extension, but it's not planned for Fenix MVP.
If doing that is not possible within the timeframe, we can leave UA overrides in the tree for a while, but I'm worried that adding another feature dependent on UAOverrides.jsm would just make it harder to remove.
What I would suggest is something similar to the t.co hack just instead of using UAOverrides.jsm
we use nsIDocShell.customUserAgent
I hope this is helpful.
Reporter | ||
Comment 6•6 years ago
|
||
Resolving this GV bug as WONTFIX because Fenix can override the UA itself in onLoadRequest
like FxR does (to auto-request desktop sites):
FxR override issue:
https://github.com/MozillaReality/FirefoxReality/issues/488
FxR override code:
https://github.com/MozillaReality/FirefoxReality/blob/c5f1b17ed8392aff09a1cc252f78f7d01f3fc2bc/app/src/common/shared/org/mozilla/vrbrowser/browser/UserAgentOverride.java
Reporter | ||
Comment 7•6 years ago
|
||
I am still pushing hard for the Fenix team to implement this UA override. In the meantime, the AMO and SUMO teams can proceed with their server-side UA checks for "Firefox Android version >= 69 means Fenix". That check will be valid even if we don't implement a UA override workaround for the overlapping period of Fennec/Fenix 68.
Description
•