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

Issue 754061 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 680790



Sign in to add a comment

initSafeBrowsing should always invoke the callback on the UI thread

Project Member Reported by ntfschr@chromium.org, Aug 9 2017

Issue description

After careful inspection, it looks like WebView#initSafeBrowsing() will sometimes invoke the callback on threads other than the UI thread. This conflicts with the API documentation [1].

Thread guarantees seem like a reasonable thing to me, so we should just ensure that we always invoke on the UI thread.

[1] https://cs.corp.google.com/android/frameworks/base/core/java/android/webkit/WebView.java?q=package:android+f:webkit+initsafebrowsing&l=1661
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 10 2017

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

commit 9364e47b961b5889d2d960553d09311437e5907f
Author: Nate Fischer <ntfschr@chromium.org>
Date: Thu Aug 10 20:28:51 2017

AW: ensure initSafeBrowsing callback is invoked on UI thread

This wraps initSafeBrowsing()'s callback in another callback. The
wrapperCallback is responsible for running the actual callback on the
UI thread. This is to stay consistent about which thread the
callback is actually invoked on.

Bug:  754061 
Test: run_webview_instrumentation_test_apk -f SafeBrowsingTest#testInitSafeBrowsingCallbackOnUIThread
Change-Id: I49a37443ba283884679dac7f521da007e5aec117
Reviewed-on: https://chromium-review.googlesource.com/609412
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#493516}
[modify] https://crrev.com/9364e47b961b5889d2d960553d09311437e5907f/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java
[modify] https://crrev.com/9364e47b961b5889d2d960553d09311437e5907f/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java

Cc: amineer@chromium.org
Labels: ReleaseBlock-Stable Merge-Request-61
I'm on the fence about whether or not this is merge-worthy. I'm requesting the merge, but amineer@ should take a look at my reasoning below (and feel free to disagree with it).

Q: How will this help our users?
A: This guarantees that the callback is invoked on a consistent thread. This impacts app stability/bugs. Without this guarantee, applications may incorrectly assume the UI thread is always used, causing bugs for the edge cases when we use a different thread.

Q: Is this necessary?
A: Not critical, but we shouldn't make thread guarantees without merging this back, and I think the API will be lacking without those guarantees. tobiasjs@ let me know if you agree/disagree.

This should be on the safer-side for merges:

 * Only affects android_webview/
 * I anticipate a clean merge
 * Full automated test coverage
Project Member

Comment 3 by sheriffbot@chromium.org, Aug 11 2017

Labels: -Merge-Request-61 Merge-Review-61 Hotlist-Merge-Review
This bug requires manual review: M61 has already been promoted to the beta branch, so this requires manual review
Please contact the milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), ketakid@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: -Merge-Review-61 Merge-Approved-61
We can take this for 61 so long as we merge ahead of next beta.  Thus, approved for M61 branch 3163, but please merge by EOD.  Thanks!
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 14 2017

Labels: -merge-approved-61 merge-merged-3163
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c7f4188a67c7e0dea2610fada3efa714302d2bf5

commit c7f4188a67c7e0dea2610fada3efa714302d2bf5
Author: Nate Fischer <ntfschr@chromium.org>
Date: Mon Aug 14 18:35:34 2017

AW: ensure initSafeBrowsing callback is invoked on UI thread

This wraps initSafeBrowsing()'s callback in another callback. The
wrapperCallback is responsible for running the actual callback on the
UI thread. This is to stay consistent about which thread the
callback is actually invoked on.

TBR=ntfschr@chromium.org

(cherry picked from commit 9364e47b961b5889d2d960553d09311437e5907f)

Bug:  754061 
Test: run_webview_instrumentation_test_apk -f SafeBrowsingTest#testInitSafeBrowsingCallbackOnUIThread
Change-Id: I49a37443ba283884679dac7f521da007e5aec117
Reviewed-on: https://chromium-review.googlesource.com/609412
Commit-Queue: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Tobias Sargeant <tobiasjs@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#493516}
Reviewed-on: https://chromium-review.googlesource.com/614129
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Cr-Commit-Position: refs/branch-heads/3163@{#541}
Cr-Branched-From: ff259bab28b35d242e10186cd63af7ed404fae0d-refs/heads/master@{#488528}
[modify] https://crrev.com/c7f4188a67c7e0dea2610fada3efa714302d2bf5/android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java
[modify] https://crrev.com/c7f4188a67c7e0dea2610fada3efa714302d2bf5/android_webview/javatests/src/org/chromium/android_webview/test/SafeBrowsingTest.java

Status: Fixed (was: Assigned)
Thanks, Alex!
Labels: WebView-SafeBrowsing
Status: Verified (was: Fixed)
Bulk edit: marking stale 'fixed' bugs as 'verified' since they don't need verification at this point.

Sign in to add a comment