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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2900033002: [Android WebView] Propagate Java exceptions for evaluateJavascript (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index ac2cb98c0c82a15ed565ba82aa13a72128d7f4ad..76452036e410a75cba73d8c7c79dfb9f7331fad7 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -2269,8 +2269,17 @@ public class AwContents implements SmartClipProvider {
if (callback != null) {
jsCallback = new JavaScriptCallback() {
@Override
- public void handleJavaScriptResult(String jsonResult) {
- callback.onReceiveValue(jsonResult);
+ public void handleJavaScriptResult(final String jsonResult) {
+ // Post the application callback back to the current thread to ensure the
+ // application callback is executed without any native code on the stack. This
+ // so that any exception thrown by the application callback won't have to be
+ // propagated through a native call stack.
+ mHandler.post(new Runnable() {
+ @Override
+ public void run() {
+ callback.onReceiveValue(jsonResult);
+ }
+ });
}
};
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698