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

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

Issue 2869103002: [Android WebView] Propagate Java exceptions thrown in OnReceivedSslError (Closed)
Patch Set: Post the java-side onReceivedSslError callback back to current thread to avoid native stack. 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/AwContentsClientBridge.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
index a294913efc1270ead695e6a680faae6726f85b01..d5b68192edb5340944c3162d60318129a9d1a102 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContentsClientBridge.java
@@ -7,6 +7,7 @@ package org.chromium.android_webview;
import android.content.Context;
import android.net.http.SslCertificate;
import android.net.http.SslError;
+import android.os.Handler;
import android.util.Log;
import android.webkit.ValueCallback;
@@ -172,7 +173,7 @@ public class AwContentsClientBridge {
return false;
}
final SslError sslError = SslUtil.sslErrorFromNetErrorCode(certError, cert, url);
- ValueCallback<Boolean> callback = new ValueCallback<Boolean>() {
+ final ValueCallback<Boolean> callback = new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(final Boolean value) {
ThreadUtils.runOnUiThread(new Runnable() {
@@ -183,7 +184,16 @@ public class AwContentsClientBridge {
});
}
};
- mClient.onReceivedSslError(callback, sslError);
+ // 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.
+ new Handler().post(new Runnable() {
+ @Override
+ public void run() {
+ mClient.onReceivedSslError(callback, sslError);
+ }
+ });
return true;
}
« 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