Default Accept-Language header for WebView differs from Chrome
Reported by
lquinn@blackberry.com,
Sep 10
|
||||||||
Issue descriptionTHIS 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.
,
Sep 11
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!
,
Sep 11
chelamcherla@, attached is the APK that I used to test this.
,
Sep 11
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
,
Sep 17
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
,
Sep 17
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).
,
Sep 18
ctzsm@, yes, that makes sense.
,
Sep 28
,
Oct 9
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.
,
Oct 9
Changwan, thank you for taking this issue. I currently don't have spare cycles to look at it.
,
Oct 9
,
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
,
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
,
Oct 23
Marking as fixed for now, although I'm thinking of adding a feature flag. It will target M72.
,
Oct 29
Verified on Black berry KKey oneNMF26F ,issue mentioned no longer reproducibleon latest 72 .Please mark it verified on the latest 72 build once available.
,
Dec 10
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by chelamcherla@chromium.org
, Sep 11