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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_contents_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "android_webview/common/devtools_instrumentation.h" 10 #include "android_webview/common/devtools_instrumentation.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 env, reinterpret_cast<const uint8_t*>(der_string.data()), 104 env, reinterpret_cast<const uint8_t*>(der_string.data()),
105 der_string.length()); 105 der_string.length());
106 ScopedJavaLocalRef<jstring> jurl(ConvertUTF8ToJavaString( 106 ScopedJavaLocalRef<jstring> jurl(ConvertUTF8ToJavaString(
107 env, request_url.spec())); 107 env, request_url.spec()));
108 // We need to add the callback before making the call to java side, 108 // We need to add the callback before making the call to java side,
109 // as it may do a synchronous callback prior to returning. 109 // as it may do a synchronous callback prior to returning.
110 int request_id = pending_cert_error_callbacks_.Add( 110 int request_id = pending_cert_error_callbacks_.Add(
111 base::MakeUnique<CertErrorCallback>(callback)); 111 base::MakeUnique<CertErrorCallback>(callback));
112 *cancel_request = !Java_AwContentsClientBridge_allowCertificateError( 112 *cancel_request = !Java_AwContentsClientBridge_allowCertificateError(
113 env, obj, cert_error, jcert, jurl, request_id); 113 env, obj, cert_error, jcert, jurl, request_id);
114 // 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.
115 if (HasException(env)) {
116 // Tell the chromium message loop to not perform any tasks after the current
117 // one - we want to make sure we return to Java cleanly without first making
118 // any new JNI calls.
119 base::MessageLoopForUI::current()->Abort();
120 // If we crashed we don't want to continue the navigation.
121 return;
122 }
114 // if the request is cancelled, then cancel the stored callback 123 // if the request is cancelled, then cancel the stored callback
115 if (*cancel_request) { 124 if (*cancel_request) {
116 pending_cert_error_callbacks_.Remove(request_id); 125 pending_cert_error_callbacks_.Remove(request_id);
117 } 126 }
118 } 127 }
119 128
120 void AwContentsClientBridge::ProceedSslError(JNIEnv* env, 129 void AwContentsClientBridge::ProceedSslError(JNIEnv* env,
121 const JavaRef<jobject>& obj, 130 const JavaRef<jobject>& obj,
122 jboolean proceed, 131 jboolean proceed,
123 jint id) { 132 jint id) {
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 pending_client_cert_request_delegates_.Remove(request_id); 537 pending_client_cert_request_delegates_.Remove(request_id);
529 538
530 delete delegate; 539 delete delegate;
531 } 540 }
532 541
533 bool RegisterAwContentsClientBridge(JNIEnv* env) { 542 bool RegisterAwContentsClientBridge(JNIEnv* env) {
534 return RegisterNativesImpl(env); 543 return RegisterNativesImpl(env);
535 } 544 }
536 545
537 } // namespace android_webview 546 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698