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 #
Messages
Total messages: 9 (4 generated)
|