Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Issue 2869103002: [Android WebView] Propagate Java exceptions thrown in OnReceivedSslError (Closed)

Created:
3 years, 7 months ago by gsennton
Modified:
3 years, 7 months ago
CC:
chromium-reviews, jam, darin-cc_chromium.org, android-webview-reviews_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android WebView] Propagate Java exceptions thrown in OnReceivedSslError The OnReceivedSslError callback is accessed through a JNI call. By default, JNI calls in Clank and WebView are handled so that when a Java exception is thrown inside a JNI call we will print the stack trace for that exception to the logcat when the JNI call returns to native. We will then intentionally crash in native to avoid any undefined behaviour caused by the pending Java exception. So when an app throws a Java exception inside OnReceivedSslError, that exception is not correctly propagated to Android's feedback mechanism. With this CL we fix this by posting the callback call to the current Java handler - so that when an exception is thrown it won't have to propagate back through JNI and a native stack, instead it propagates directly through Java to Android's UncaughtExceptionHandler, and from there on to Android's Feedback mechanism. BUG=719395 Review-Url: https://codereview.chromium.org/2869103002 Cr-Commit-Position: refs/heads/master@{#472756} Committed: https://chromium.googlesource.com/chromium/src/+/a98edc8510b39155ec0e0efa1db29b195d487d7e

Patch Set 1 #

Total comments: 6

Patch Set 2 : Bail out before calling callback in AllowCertificateError, remove TODOs. #

Patch Set 3 : Add comments to ssl_manager.h as well. #

Total comments: 3

Patch Set 4 : Post the java-side onReceivedSslError callback back to current thread to avoid native stack. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -2 lines) Patch
M android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java View 1 2 3 3 chunks +12 lines, -2 lines 0 comments Download

Messages

Total messages: 26 (6 generated)
gsennton
Torne: adding you as general reviewer since you reviewed the corresponding shouldOverrideUrlLoading CL: https://codereview.chromium.org/2169553002/ Selim: ...
3 years, 7 months ago (2017-05-09 16:50:50 UTC) #2
sgurun-gerrit only
https://codereview.chromium.org/2869103002/diff/1/android_webview/browser/aw_content_browser_client.cc File android_webview/browser/aw_content_browser_client.cc (right): https://codereview.chromium.org/2869103002/diff/1/android_webview/browser/aw_content_browser_client.cc#newcode397 android_webview/browser/aw_content_browser_client.cc:397: // TODO bail here on JNI exception ? Will ...
3 years, 7 months ago (2017-05-09 20:29:59 UTC) #3
Torne
Yeah, this LGTM as-is.
3 years, 7 months ago (2017-05-10 18:54:40 UTC) #4
sgurun-gerrit only
On 2017/05/10 18:54:40, Torne wrote: > Yeah, this LGTM as-is. just remove the //TODO bail ...
3 years, 7 months ago (2017-05-11 00:27:19 UTC) #5
estark
https://codereview.chromium.org/2869103002/diff/1/content/browser/ssl/ssl_manager.cc File content/browser/ssl/ssl_manager.cc (right): https://codereview.chromium.org/2869103002/diff/1/content/browser/ssl/ssl_manager.cc#newcode318 content/browser/ssl/ssl_manager.cc:318: // any additional code here, make sure it cannot ...
3 years, 7 months ago (2017-05-11 00:50:56 UTC) #6
gsennton
estark@ apologies for the wall of text - hopefully it explains what we're trying to ...
3 years, 7 months ago (2017-05-11 12:17:17 UTC) #7
gsennton
ping for estark@ :)
3 years, 7 months ago (2017-05-15 08:22:17 UTC) #8
estark
Thanks for the explanation. Seems like the comment should maybe go in ssl_manager.h then as ...
3 years, 7 months ago (2017-05-16 05:22:50 UTC) #9
gsennton
Thanks estark@, I added some comments to ssl_manager.h, I don't know if there's anything else ...
3 years, 7 months ago (2017-05-16 10:03:41 UTC) #10
estark
Thanks, ssl_manager lgtm
3 years, 7 months ago (2017-05-16 14:39:15 UTC) #11
gsennton
Thanks estark@, actually, we are currently contemplating having the Java-side of allowCertificateError just post its ...
3 years, 7 months ago (2017-05-17 13:19:18 UTC) #12
gsennton
https://codereview.chromium.org/2869103002/diff/40001/android_webview/browser/aw_contents_client_bridge.cc File android_webview/browser/aw_contents_client_bridge.cc (right): https://codereview.chromium.org/2869103002/diff/40001/android_webview/browser/aw_contents_client_bridge.cc#newcode126 android_webview/browser/aw_contents_client_bridge.cc:126: if (*cancel_request) { On 2017/05/17 13:19:18, gsennton wrote: > ...
3 years, 7 months ago (2017-05-17 14:45:07 UTC) #13
sgurun-gerrit only
https://codereview.chromium.org/2869103002/diff/40001/android_webview/browser/aw_contents_client_bridge.cc File android_webview/browser/aw_contents_client_bridge.cc (right): https://codereview.chromium.org/2869103002/diff/40001/android_webview/browser/aw_contents_client_bridge.cc#newcode126 android_webview/browser/aw_contents_client_bridge.cc:126: if (*cancel_request) { On 2017/05/17 14:45:07, gsennton wrote: > ...
3 years, 7 months ago (2017-05-17 15:23:58 UTC) #14
gsennton
Alright! This is much more straight-forward now :) Torne and Selim: ptal again
3 years, 7 months ago (2017-05-17 16:19:01 UTC) #15
sgurun-gerrit only
On 2017/05/17 16:19:01, gsennton wrote: > Alright! This is much more straight-forward now :) > ...
3 years, 7 months ago (2017-05-17 16:23:33 UTC) #16
Torne
lgtm
3 years, 7 months ago (2017-05-18 00:47:26 UTC) #17
Torne
Actually, can you update the CL description before landing? It still describes the old approach.
3 years, 7 months ago (2017-05-18 00:47:56 UTC) #18
gsennton
On 2017/05/18 00:47:56, Torne wrote: > Actually, can you update the CL description before landing? ...
3 years, 7 months ago (2017-05-18 09:26:52 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2869103002/60001
3 years, 7 months ago (2017-05-18 09:27:29 UTC) #23
commit-bot: I haz the power
3 years, 7 months ago (2017-05-18 09:54:54 UTC) #26
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/a98edc8510b39155ec0e0efa1db2...

Powered by Google App Engine
This is Rietveld 408576698