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

Issue 2900033002: [Android WebView] Propagate Java exceptions for evaluateJavascript (Closed)

Created:
3 years, 7 months ago by gsennton
Modified:
3 years, 7 months ago
Reviewers:
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 for evaluateJavascript WebView applications can throw run-time exceptions within WebView-callbacks. When such an exception is thrown from the callback passed to evaluateJavascript it is not correctly propagated to Android's feedback mechanism. This is because that callbacks is called through JNI, and the default way (in Chromium) 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=719396 Review-Url: https://codereview.chromium.org/2900033002 Cr-Commit-Position: refs/heads/master@{#473930} Committed: https://chromium.googlesource.com/chromium/src/+/b8b1cbadd7941505caf3cdaebfa30f019854f815

Patch Set 1 #

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

Messages

Total messages: 9 (4 generated)
gsennton
PTAL :) Note that I didn't add the fix for EvaluateJavascriptForTests. Not sure if we ...
3 years, 7 months ago (2017-05-23 12:57:44 UTC) #2
Torne
LGTM. I don't think we need to change the test version.
3 years, 7 months ago (2017-05-23 15:07:32 UTC) #3
gsennton
On 2017/05/23 15:07:32, Torne wrote: > LGTM. I don't think we need to change the ...
3 years, 7 months ago (2017-05-23 15:39:40 UTC) #4
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/2900033002/1
3 years, 7 months ago (2017-05-23 15:40:31 UTC) #6
commit-bot: I haz the power
3 years, 7 months ago (2017-05-23 16:22:53 UTC) #9
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://chromium.googlesource.com/chromium/src/+/b8b1cbadd7941505caf3cdaebfa3...

Powered by Google App Engine
This is Rietveld 408576698