New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 775125 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

navigator.languages shouldn't return an empty array even when AcceptLanguages() is empty

Reported by romain.p...@gmail.com, Oct 16 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

Steps to reproduce the problem:
This is a bug inside WebKit's Navigator::languages(), which only occurs with specific user agent implementations of Chromium (QtWebEngine in this case)

If the chrome client's AcceptLanguages() implementation returns an empty string, Navigator::languages() returns an empty vector which results in an empty navigator.languages array.

Some websites like Autodesk 360 are failing to load on such browsers in that situation, because navigator.languages[0] is unexpectedly returning undefined.

What is the expected behavior?
navigator.languages must always contain at least one language according to the HTML5 spec:

"Must return a read only array of valid BCP 47 language tags representing either one or more plausible languages, or the user’s preferred languages, ordered by preference with the most preferred language first. "

(from https://www.w3.org/TR/html51/webappapis.html#dom-navigatorlanguage-languages)

What went wrong?
Even though returning a non-empty AcceptLanguages() string is ultimately the responsiblility of the user agent, Chromium should try to handle empty strings in a spec-compliant way. Also note that the default WebViewClient implementation returns exactly that, an empty string.

It is therefore reasonable to expect Chromium to handle this default behavior and return a non-empty vector with a default language, especially as it's already doing so when there's no frame available. (at the beginning of Navigator::languages())

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 61.0.3163.100  Channel: dev
OS Version: OS X 10.12.6
Flash Version: Shockwave Flash 27.0 r0

I actually have a patched already ready to submit to fix the issue. I'm creating this ticket to cross-reference from the patch and to make sure everybody agrees on the behavior change
 
Labels: Needs-Triage-M61
Cc: dcheng@chromium.org vamshi.k...@techmahindra.com
Labels: Triaged-ET
Status: Untriaged (was: Unconfirmed)
As per the change request provided in comment #2 cc'ing to the reviewer of the file for more updates on this issue.

@dcheng -  Could you please take a look in to this issue?

Thanks!
Ping it's been almost a month since the issue was filed. Any feedback appreciated on the provided patch at https://chromium-review.googlesource.com/c/chromium/src/+/721249
This can be closed, dupe of 351715 which was fixed a long time ago

Sign in to add a comment