Chromium Code Reviews| Index: android_webview/browser/aw_contents_client_bridge.cc |
| diff --git a/android_webview/browser/aw_contents_client_bridge.cc b/android_webview/browser/aw_contents_client_bridge.cc |
| index eb4ecab7ac70783943fbdc8b4cd8df23a4616964..480f9722741b22850740f3d29484cd73f1d9280e 100644 |
| --- a/android_webview/browser/aw_contents_client_bridge.cc |
| +++ b/android_webview/browser/aw_contents_client_bridge.cc |
| @@ -62,7 +62,7 @@ void RecordClientCertificateKey(net::X509Certificate* client_cert, |
| AwContentsClientBridge::AwContentsClientBridge(JNIEnv* env, |
| const JavaRef<jobject>& obj) |
| - : java_ref_(env, obj) { |
| + : java_ref_(env, obj), has_pending_java_exception_(false) { |
| DCHECK(!obj.is_null()); |
| Java_AwContentsClientBridge_setNativeContentsClientBridge( |
| env, obj, reinterpret_cast<intptr_t>(this)); |
| @@ -111,6 +111,17 @@ void AwContentsClientBridge::AllowCertificateError( |
| base::MakeUnique<CertErrorCallback>(callback)); |
| *cancel_request = !Java_AwContentsClientBridge_allowCertificateError( |
| env, obj, cert_error, jcert, jurl, request_id); |
| + |
| + if (HasException(env)) { |
| + has_pending_java_exception_ = true; |
| + // 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) { |
|
gsennton
2017/05/17 13:19:18
Selim: I guess if we post the Java-side of allowCe
gsennton
2017/05/17 14:45:07
Aha, I see what's going on here now.
We remove thi
sgurun-gerrit only
2017/05/17 15:23:58
sounds reasonable and simpler.
|
| pending_cert_error_callbacks_.Remove(request_id); |