Some samsung.com images don't load in Firefox Android because its navigator.appVersion doesn't include "Linux", "Mac", or "Win"
Categories
(Web Compatibility :: Interventions, defect, P2)
Tracking
(relnote-firefox -, firefox120 wontfix, firefox121 wontfix, firefox122 wontfix, firefox123 wontfix, firefox124 wontfix, firefox125 wontfix, firefox126 wontfix, firefox127 wontfix, firefox128 fixed)
People
(Reporter: yjbrowserjyt, Assigned: cpeterson)
References
()
Details
(Keywords: parity-chrome, site-compat, Whiteboard: [qa-triaged][necko-triaged])
Attachments
(1 file, 2 obsolete files)
146.14 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0
Steps to reproduce:
Visit this website https://www.samsung.com/cn/smartphones/galaxy-s23-ultra/
Actual results:
found that the image cannot be loaded properly
Expected results:
After my development and debugging, I found thatCheckOS: (n=(n=navigator. appVersion. match (/(mac | win | Linux)/i))? N [1]. toLowerCase(): '', void document. documentElement. classList. add (n)) This code causesOn mobile Firefox, navigator.appVersion results in "5.0 (Android 13)";But on mobile browsers such as Chrome, you can get "5.0 (Linux; Android 13; LE2100 Build/TP1A. 220905.001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.52499.126 Mobile Safari/537.36"Please add more information to navigator.appVersion to make it compatible like Chrome.
Comment 1•1 year ago
|
||
I guess it's Samsung 's site problem.
Key point is that
if n is "" , document.documentElement.classList.add(n)
will raise an error Uncaught DOMException: DOMTokenList.add: The empty string is not a valid token.
and cause that following code will not be executed (including the image loader related code).
So Samsung need to make their "checkos" more robust. Either making the failure of checkos not affecting following code , or make checkos more accurately.
Updated•1 year ago
|
(In reply to jackyzy823 from comment #1)
I guess it's Samsung 's site problem.
Key point is that
if n is "" ,document.documentElement.classList.add(n)
will raise an errorUncaught DOMException: DOMTokenList.add: The empty string is not a valid token.
and cause that following code will not be executed (including the image loader related code).So Samsung need to make their "checkos" more robust. Either making the failure of checkos not affecting following code , or make checkos more accurately.
Through searching on the search engine, I found that the checkos used by Samsung has become a common practice. However, it cannot be used on Firefox and can only cause problems on more websites. This result is undesirable. Ensuring Firefox catches up with Chrome in terms of website compatibility is a prerequisite for the better development of Firefox.
Comment 3•1 year ago
|
||
Thanks for hint.
I found a similar issue bug 1799968 and https://github.com/webcompat/web-bugs/issues/108993 based on the search of "navigator. appVersion. match (/(mac | win | Linux)/i)"
As suggested in https://github.com/webcompat/web-bugs/issues/108993#issuecomment-1224778264 , we could site-patch this by re-writing navigator.appVersion
Comment 4•1 year ago
|
||
The severity field is not set for this bug.
:jonalmeida, could you have a look please?
For more information, please visit BugBot documentation.
Comment 5•1 year ago
|
||
Based on jackyzy823's comments, I'll mark this ticket as confirmed.
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Comment 7•1 year ago
|
||
There are also privacy concerns about the interface.
See also: https://bugzilla.mozilla.org/show_bug.cgi?id=1868415
Comment 8•1 year ago
|
||
And sincerely I do not understand why the site would require such information to load images...
Looks like counter-productive design.
If the site primarily targets Mainland China: may consider filing a complaint to the PRC MIIT (中华人民共和国工业和信息化部).
Beyond reason data acquisition is prohibited... at least proclaimed:
https://www.gov.cn/zhengce/2022-08/23/content_5722717.htm
Comment 9•1 year ago
|
||
[ Quote jian @ CE 2023-10-22 14:46:13 UTC:
https://bugzilla.mozilla.org/show_bug.cgi?id=1860417#c2
Ensuring Firefox catches up with Chrome in terms of website compatibility is a prerequisite for the better development of Firefox. ]
<^> Significant aspects of Chrome are undesirable.
In particular: security and privacy.
Comment 10•1 year ago
|
||
What I attained in Chrome:
[[
JavaScript navigator.userAgent
= HTTP User-Agent
= Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
JavaScript navigator.appVersion
= 5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
]]
Setting "general.appversion.override" to "5.0 (Linux; rv:999) Firefox 999
" works.
Comment 11•1 year ago
|
||
It appears "navigator.userAgent" shall be derived from User-Agent:
|*| If User-Agent begins with "Mozilla/
": return User-Agent with the initial 8 Bytes (characters) (/^Mozilla\//) stripped.
|*| Else:
|*.1| If User-Agent is non-empty: "5.0 ${User-Agent}
"
|*.2| Else: return nothing.
The above should occur when "general.appversion.override" is not set.
Assignee | ||
Comment 12•1 year ago
|
||
This code causesOn mobile Firefox, navigator.appVersion results in "5.0 (Android 13)";But on mobile browsers such as Chrome, you can get "5.0 (Linux; Android 13; LE2100 Build/TP1A. 220905.001) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.52499.126 Mobile Safari/537.36"
Maybe we should return something like 5.0 (Linux; Android 10)
from navigator.appVersion
on Android.
Assignee | ||
Comment 13•1 year ago
|
||
For comparison, Chrome's and Safari's navigator.appVersion
return the User-Agent string without the Mozilla/
prefix. Firefox just returns a short string like 5.0 (Macintosh)
.
Changing Firefox's navigator.appVersion
to return the User-Agent string without the Mozilla/
prefix still wouldn't fix this webcompat bug because Firefox Android's User-Agent string doesn't mention "Linux".
Comment 14•1 year ago
|
||
For best compatibility, maybe adding "Linux" to Firefox's mobile UA? (also deploying the above logic)
For reference, Chrome's mobile UA:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
Assignee | ||
Comment 15•1 year ago
|
||
Actual results:
found that the image cannot be loaded properly
For the record here, when I load https://www.samsung.com/cn/smartphones/galaxy-s23-ultra/ from the US, I'm redirected to https://www.samsung.com.cn/smartphones/galaxy-s23-ultra/. The page's header image loads. The smaller images lower on the page are the ones that don't load in Firefox.
Comment 16•1 year ago
|
||
The redirection appears to be newly added.
Not necessarily IP related.
I also noted Firefox Nightly appears have been experimenting desktop User-Agent with this:
https://github.com/MasterInQuestion/talk/discussions/10
This could also extend to mobile: "(Linux; Mobile; rv:999)"
And I believe the remote site mostly doesn't need to know the OS.
Assignee | ||
Comment 17•11 months ago
|
||
For future reference, Samsung's checkOS
function is in https://www.samsung.com.cn/samsung/resources/global/galaxy-s23-ultra/common/js/common.min.js
checkOS: (n = (n = navigator.appVersion.match(/(mac|win|linux)/i)) ? n[1].toLowerCase() : ""
Updated•11 months ago
|
Assignee | ||
Comment 18•11 months ago
|
||
I have a patch to add "Linux" to Firefox Android's UA string in Fx 125.
Some examples for reference:
Firefox Android's current UA string just lists "Android":
- UA string:
Mozilla/5.0 (Android 10; Mobile; rv:124.0) Gecko/124.0 Firefox/124.0
- navigator.appVersion:
5.0 (Android 10)
In contrast, Chrome's Android UA string lists "Linux; Android":
- UA string:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
- navigator.appVersion:
5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
(Same as its UA string without theMozilla/
prefix)
I propose adding "Linux" to Firefox's Android UA string:
- New UA string:
Mozilla/5.0 (Linux; Android 10; Mobile; rv:124.0) Gecko/124.0 Firefox/124.0
- New navigator.appVersion:
5.0 (Linux; Android 10)
Assignee | ||
Comment 19•11 months ago
|
||
Chrome's Android UA string lists "Linux; Android", while Firefox's lists only "Android". This has caused webcompat problems for at least one website (samsung.com) because it assumes every browser UA string will include one of "Windows", "Mac", or "Linux". Let's add "Linux; Android" to Firefox's UA string, like Chrome's, to satisfy that website assumption.
Firefox's current Android UA string:
Mozilla/5.0 (Android 10; Mobile; rv:125.0) Gecko/125.0 Firefox/125.0
Firefox's new Android UA string:
Mozilla/5.0 (Linux; Android 10; Mobile; rv:125.0) Gecko/125.0 Firefox/125.0
For comparison, an example of Chrome's Android UA string:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36
Comment 20•11 months ago
|
||
Unless there are many websites relying on "Linux" in the UA string, I think a better fix would be an intervention like the one added at https://github.com/mozilla-extensions/webcompat-addon/commit/df506ff0f3f66cd948a2825f6f74ca2c2eff7406
Assignee | ||
Comment 21•11 months ago
|
||
(In reply to Mathew Hodson from comment #20)
Unless there are many websites relying on "Linux" in the UA string, I think a better fix would be an intervention like the one added at https://github.com/mozilla-extensions/webcompat-addon/commit/df506ff0f3f66cd948a2825f6f74ca2c2eff7406
Thanks for the suggestion, Mathew. I didn't know about that samsung.com intervention for Linux. I just talked with Thomas Wisniewski (author of that intervention). He acknowledges adding "Linux" to the Android UA string has risk, but we think it's worth trying. He recommends I add a Nimbus feature flag so we can remotely turn off the "Linux; Android" UA if there is a problem.
Comment 22•11 months ago
|
||
Comment 23•11 months ago
•
|
||
Backed out for causing (part of commit message)
Could you please take a look at this?
Thank you!
Assignee | ||
Comment 24•11 months ago
•
|
||
Some media tests failed because they had special cases for desktop Linux and checked for navigator.userAgent.includes("Linux")
, which now matches both desktop Linux and Android. I will update the tests to check for "Linux && !Android".
Assignee | ||
Comment 25•11 months ago
|
||
I don't think these test issues with the new "Linux; Android" UA string indicate a high risk for webcompat issues with real websites.
I've tested the new "Linux; Android" UA string on some current UA parser libraries (client and server side) without problem:
https://uaparser.js.org/
https://bowser-js.github.io/bowser-online/
https://github.com/ua-parser/uap-core/tree/master (needs a client like https://github.com/ua-parser/uap-python)
https://exiguus.github.io/js.device.detector/
Comment 26•11 months ago
|
||
Even much more aggressive change like I previously mentioned:
https://bugzilla.mozilla.org/show_bug.cgi?id=1860417#c16
; is unlikely to cause any real issue.
Assignee | ||
Comment 27•11 months ago
|
||
(In reply to Master ? [:masterquestionable] from comment #26)
Even much more aggressive change like I previously mentioned:
https://bugzilla.mozilla.org/show_bug.cgi?id=1860417#c16
; is unlikely to cause any real issue.
We can't change the UA string from (Android ##; Mobile; rv:###.0)
to something like generic like (Linux; Mobile; rv:999)
at this time (or at least it would be outside the scope of this bug fix). Some websites depend on the Android
OS name or version, such as:
- Duo's "Trusted Endpoint" checks whether the user's Android OS version meets some minimum version requirement. This was broken in Fx 122 on Android in bug 1876742.
- (For better or worse) some websites like Reddit want to encourage users to install a native Android or iOS app.
Assignee | ||
Comment 28•11 months ago
|
||
Now that Firefox's Android UA string includes "Linux" to more closely match Chrome's Android UA string (to fix some webcompat issues), tests need to check for "Linux && !Android" to distinguish desktop Linux from Android.
These tests' Linux checks were added in bug 1849108.
Updated•11 months ago
|
Comment 29•10 months ago
|
||
“Duo's "Trusted Endpoint" checks whether the user's Android OS version meets some minimum version requirement.”
<^> This is eventually malconfigured administration policies by the user themselves: Bad assertions.
To address similar: exposing the "general.useragent.override" straightforward, appears to be the most viable solution.
(and I personally think "about:config" is a crucial part)
"outside the scope"...
不识 庐山 真面目: 只缘身在此山中.
+ Unable to tell Lú Mountain's true look: For self already in the mountain.
.
At many times the real problem is indeed "outside the scope".
Comment 30•10 months ago
|
||
I'm also interested in deploying the logic I previously mentioned:
https://bugzilla.mozilla.org/show_bug.cgi?id=1860417#c11
Just not sure how to commit.
Comment 31•10 months ago
|
||
Comment 32•10 months ago
|
||
Comment 33•10 months ago
|
||
bugherder |
Comment 34•10 months ago
|
||
I think we should add Linux
to RFP spoofed mobile as well for better compat, in a new issue of course. If there are no objections, I'll open a ticket unless someone beats me to it cc: tjr
current RFP
- "appVersion": "5.0 (Android 10)",
- "ua_os": "Android 10; Mobile",
Comment 35•10 months ago
|
||
ni tjr
Updated•10 months ago
|
Comment 36•10 months ago
|
||
bugherder |
Updated•10 months ago
|
Assignee | ||
Comment 37•9 months ago
•
|
||
Release Note Request
[Why is this notable]: This change should fix some webcompat issues, but has a small risk of introducing new webcompat issues.
[Affects Firefox for Android]: Yes. It only affects Android.
[Suggested wording]: Add "Linux" to Firefox Android's User-Agent string to fix some website compatibility issues.
[Links (documentation, blog post, etc)]: None? We could point to MDN's Firefox User-Agent string reference but I haven't updated yet. I can try to update it before 126 ships. But if we later have to revert the new User-Agent string, I'll need to revert the MDN change, too.
Comment 38•9 months ago
|
||
Thanks, added to the Fx126 beta release notes, please allow 30 minutes for the site to update and review doc.
Keeping the relnote-firefox flag as ? to keep it on the radar for inclusion in the final Fx126 release notes
Comment 39•9 months ago
|
||
This is breaking Tier 1 Google search.
Comment 40•9 months ago
|
||
Backout for causing Bug 1895513
Backout link: https://hg.mozilla.org/integration/autoland/rev/fb6f86c201450f504f821cbccdaff710b7487932
Comment 41•9 months ago
|
||
Rejecting release note request since this will be backed out from central and release.
Comment 42•9 months ago
|
||
Backout for causing Bug 1895513
Backout link: https://hg.mozilla.org/releases/mozilla-release/rev/37ff843a3c4c53552fc12bd8f541e6baa0eeed76
Comment 43•9 months ago
|
||
Putting Linux; after Android doesn't break Google search. We should check if it fixes these things.
Assignee | ||
Updated•8 months ago
|
Assignee | ||
Comment 44•8 months ago
|
||
I submitted an intervention to the Webcompat System Addon (applying bug 1799968's intervention for samsung.com on Linux to Android):
https://github.com/mozilla-extensions/webcompat-addon/pull/342
Comment 45•8 months ago
|
||
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
:cpeterson, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
Assignee | ||
Comment 46•8 months ago
|
||
Comment on attachment 9382442 [details]
Bug 1860417 - Part 2: Add "Linux" to Firefox's Android UA string. r?#necko-reviewers,#geckoview-reviewers
There are some r+ patches which didn't land and no activity in this bug for 2 weeks.
The attached patches will be obsoleted Webcompat System Addon fix https://github.com/mozilla-extensions/webcompat-addon/pull/342
Assignee | ||
Updated•8 months ago
|
Updated•8 months ago
|
Comment 47•7 months ago
|
||
(In reply to Chris Peterson [:cpeterson] from comment #46)
Comment on attachment 9382442 [details]
Bug 1860417 - Part 2: Add "Linux" to Firefox's Android UA string. r?#necko-reviewers,#geckoview-reviewersThere are some r+ patches which didn't land and no activity in this bug for 2 weeks.
The attached patches will be obsoleted Webcompat System Addon fix https://github.com/mozilla-extensions/webcompat-addon/pull/342
The WebCompat addon with this intervention landed in Firefox 128 in bug 1876368.
Description
•