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

Issue 882587 link

Starred by 2 users

Issue metadata

Status: Verified
Owner:
Closed: Oct 23
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Default Accept-Language header for WebView differs from Chrome

Reported by lquinn@blackberry.com, Sep 10

Issue description

THIS TEMPLATE IS FOR FILING BUGS ON THE ANDROID SYSTEM WEBVIEW. GENERAL WEB BUGS SHOULD BE FILED USING A DIFFERENT TEMPLATE!

Device name: BlackBerry Motion
Android version: 8.1.0
WebView version (from system settings -> Apps -> Android System WebView): 69.0.3497.86
Application: Simple Android WebView Example
Application version: 1.0

URLs (if applicable): https://github.com/pacificregmi/SimpleAndroidWebViewExample

Steps to reproduce:
(1) In Android's Settings -> Language & input -> Languages, set "English (Canada)" as language #1 and "Français (Canada)" as language #2.
(2) Change the loadUrl() call in SimpleAndroidWebViewExample to load https://pgl.yoyo.org/http/browser-headers.php
(3) Build and run
(4) Observe the Accept-Language header

Expected result:
The Accept-Language header should have the same value as in Chrome: "en-CA,en;q=0.9,fr-CA;q=0.8,fr;q=0.7,en-GB;q=0.6,en-US;q=0.5"

Actual result:
The Accept-Language header has a different value: "en-CA,fr-CA;q=0.9,en-US;q=0.8"

Some Web content serves up content in the user's secondary language because the generic language "en" is not preferred as it is in Chrome. It seems that the fix for  bug 737232  was applied to Chrome but not WebView.

 
Labels: Needs-triage-Mobile
Cc: chelamcherla@chromium.org
Labels: WV-Triaged Needs-Feedback
 lquinn@: Please provide alternate .apk file as on navigating to  https://github.com/pacificregmi/SimpleAndroidWebViewExample seeing "There was an unexpected problem serving your request" error.

Thanks!
chelamcherla@, attached is the APK that I used to test this.
app-debug.apk
1.0 MB Download
Project Member

Comment 4 by sheriffbot@chromium.org, Sep 11

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: napper@chromium.org changwan@chromium.org ctzsm@chromium.org
Owner: claudiomagni@chromium.org
Status: Assigned (was: Unconfirmed)
WebView has a different code path [1] for this than Chrome [2]. So the fix didn't affect WebView. We probably want to apply the same fix to WebView if that is what web spec suggested.

Assign to owner of  issue 737232 , feel free to unassign if you feel it is better for WebView team to own this bit.

[1] https://cs.chromium.org/chromium/src/android_webview/browser/net/aw_http_user_agent_settings.cc?rcl=98fe895533a521d1ac7f38627b86bb2dc718e3f7&l=22
[2] https://cs.chromium.org/chromium/src/chrome/browser/net/chrome_accept_language_settings.cc?rcl=d1cfec12f0f2dc76e54d5a37039cf110ad61dfc6&l=59
lquinn@, WebView doesn't necessarily have the same Accept Language value with Chrome for Android. Since Chrome has its own language setting other than system language setting, it may consult system language setting though.

So in your case, with two languages selected, I would expect the string to be something like "en-CA,en;q=0.9,fr-CA;q=0.8,fr;q=0.7,en-US;q=0.6" (hand made, didn't consult spec, may not be true, just to show we should have base language as you mentioned).
ctzsm@, yes, that makes sense.
Cc: js...@chromium.org nona@chromium.org
 Issue 667705  has been merged into this issue.
Cc: boliu@chromium.org torne@chromium.org tobiasjs@chromium.org
Owner: changwan@chromium.org
WebView was somehow missed from the launch. I can take an initial look as claudiomagni@ seems idle.

This should be mostly fine, it requires the following work:
- moving the relevant code from chrome/browser/ to net/ and reusing it from webview
- fixing AcceptLanguageTest: currently the test assumes that navigator.languages have the same list as accept language list in useragentstring. Now it's no longer the case, which should be fine.
- fixing CTS (WebSettingsTest)

It would be nice to see a way to roll this out gracefully using Finch, but I don't have a clear idea what I can measure. I can still try to implement it behind a flag as a last resort, in case there is a serious compat issue.

Changwan, thank you for taking this issue. I currently don't have spare cycles to look at it.
Cc: claudiomagni@chromium.org
Project Member

Comment 12 by bugdroid1@chromium.org, Oct 16

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/656093235a0fc1d7c9d399deca7cd2a972939e2c

commit 656093235a0fc1d7c9d399deca7cd2a972939e2c
Author: Changwan Ryu <changwan@google.com>
Date: Tue Oct 16 23:55:55 2018

Move ExpandLanguageList from chrome/ to net/

Such that we can use it from android_webview/.

Bug:  882587 ,  737232 
Change-Id: I0006cabbdbb31dfbf1b36a67dd226fe54afe76a8
Reviewed-on: https://chromium-review.googlesource.com/c/1274598
Reviewed-by: Matt Menke <mmenke@chromium.org>
Reviewed-by: Justin DeWitt <dewittj@chromium.org>
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600196}
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/chrome/browser/BUILD.gn
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/chrome/browser/android/explore_sites/explore_sites_fetcher.cc
[delete] https://crrev.com/36f4d4de1f6244f3d7df3c08e13fbc7b16307419/chrome/browser/net/chrome_accept_language_settings.cc
[delete] https://crrev.com/36f4d4de1f6244f3d7df3c08e13fbc7b16307419/chrome/browser/net/chrome_accept_language_settings.h
[delete] https://crrev.com/36f4d4de1f6244f3d7df3c08e13fbc7b16307419/chrome/browser/net/chrome_accept_language_settings_unittest.cc
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/chrome/browser/net/profile_network_context_service.cc
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/chrome/test/BUILD.gn
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/net/http/http_util.cc
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/net/http/http_util.h
[modify] https://crrev.com/656093235a0fc1d7c9d399deca7cd2a972939e2c/net/http/http_util_unittest.cc

Project Member

Comment 13 by bugdroid1@chromium.org, Oct 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e69858666859ef9861f605c8b38c336bc76b04f8

commit e69858666859ef9861f605c8b38c336bc76b04f8
Author: Changwan Ryu <changwan@google.com>
Date: Fri Oct 19 22:52:00 2018

Expand accept languages

Expand accept languages by adding base language from language-country
pair, using the same logic that Chrome is already using.
This aligns with this W3C doc:
https://www.w3.org/International/questions/qa-lang-priorities#langtagdetail

Currently not behind a feature, will be followed by a change to use a
feature.
Also slightly refactoring tests to improve readability.

Bug:  882587 ,  737232 
Change-Id: I1e067bde4ae5b00b6b7c3be765a9cd97bbbb96df
Reviewed-on: https://chromium-review.googlesource.com/c/1286936
Commit-Queue: Changwan Ryu <changwan@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601334}
[modify] https://crrev.com/e69858666859ef9861f605c8b38c336bc76b04f8/android_webview/browser/net/aw_http_user_agent_settings.cc
[modify] https://crrev.com/e69858666859ef9861f605c8b38c336bc76b04f8/android_webview/javatests/src/org/chromium/android_webview/test/AcceptLanguageTest.java

Labels: M-72
Status: Fixed (was: Assigned)
Marking as fixed for now, although I'm thinking of adding a feature flag. It will target M72.
Verified on Black berry KKey oneNMF26F ,issue mentioned no longer reproducibleon latest 72 .Please mark it verified on the latest 72 build once available.
Status: Verified (was: Fixed)

Sign in to add a comment