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

Unified Diff: android_webview/native/aw_contents_client_bridge.cc

Issue 2869103002: [Android WebView] Propagate Java exceptions thrown in OnReceivedSslError (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
Index: android_webview/native/aw_contents_client_bridge.cc
diff --git a/android_webview/native/aw_contents_client_bridge.cc b/android_webview/native/aw_contents_client_bridge.cc
index b85568acfba18d76c31d7308ef09d492071de735..64fdbd81ce6ea8863376689403e8cc2420c9236e 100644
--- a/android_webview/native/aw_contents_client_bridge.cc
+++ b/android_webview/native/aw_contents_client_bridge.cc
@@ -111,6 +111,15 @@ void AwContentsClientBridge::AllowCertificateError(
base::MakeUnique<CertErrorCallback>(callback));
*cancel_request = !Java_AwContentsClientBridge_allowCertificateError(
env, obj, cert_error, jcert, jurl, request_id);
+ // TODO bail here, or remove the calback first?
sgurun-gerrit only 2017/05/09 20:29:59 immediately after that, the message loop will abor
gsennton 2017/05/11 12:17:17 Done.
+ if (HasException(env)) {
+ // Tell the chromium message loop to not perform any tasks after the current
+ // one - we want to make sure we return to Java cleanly without first making
+ // any new JNI calls.
+ base::MessageLoopForUI::current()->Abort();
+ // If we crashed we don't want to continue the navigation.
+ return;
+ }
// if the request is cancelled, then cancel the stored callback
if (*cancel_request) {
pending_cert_error_callbacks_.Remove(request_id);

Powered by Google App Engine
This is Rietveld 408576698