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

Issue 2886963003: [Android WebView] Propagate Java exceptions from JS dialog callbacks (Closed)

Created:
3 years, 7 months ago by gsennton
Modified:
3 years, 7 months ago
Reviewers:
Avi (use Gerrit), Torne
CC:
chromium-reviews, android-webview-reviews_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Android WebView] Propagate Java exceptions from JS dialog callbacks WebView applications can throw run-time exceptions within WebView-callbacks. When such an exception is thrown from either onJsAlert, onJsConfirm, or onJsPrompt, it is not correctly propagated to Android's feedback mechanism. This is because those callbacks are called through JNI, and the default way of handling Java exceptions thrown on the Java-side of JNI calls is to print the stack trace for the current exception to the logcat when the JNI call returns to native, and then intentionally crash in native. With this CL we avoid the problem of propagating a Java exception back through JNI and the native stack by posting the WebView-callback (which can cause the Java exception) as a new task to the current Java Handler. In that way any Java exception thrown inside the WebView-callback can be propagated directly up to the Android framework's UncaughtExceptionHandler which then properly reports the Exception through the framework's crash reporting mechanism. BUG=718921 Review-Url: https://codereview.chromium.org/2886963003 Cr-Commit-Position: refs/heads/master@{#472830} Committed: https://chromium.googlesource.com/chromium/src/+/b5d138816ecd20145552720460906269c7f3a0fd

Patch Set 1 #

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

Messages

Total messages: 10 (5 generated)
gsennton
ptal :)
3 years, 7 months ago (2017-05-17 15:50:57 UTC) #2
Torne
lgtm
3 years, 7 months ago (2017-05-18 15:17:14 UTC) #3
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/2886963003/1
3 years, 7 months ago (2017-05-18 15:30:49 UTC) #5
commit-bot: I haz the power
Committed patchset #1 (id:1) as https://chromium.googlesource.com/chromium/src/+/b5d138816ecd20145552720460906269c7f3a0fd
3 years, 7 months ago (2017-05-18 16:06:44 UTC) #8
Avi (use Gerrit)
3 years, 7 months ago (2017-05-18 17:46:19 UTC) #10
Message was sent while issue was closed.
lgtm

This should be just fine. 👍

Powered by Google App Engine
This is Rietveld 408576698