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

Unified Diff: runtime/bin/secure_socket.cc

Issue 20316002: dart:io | Fix handling of exceptions from onBadCertificate callback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: try again Created 7 years, 5 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 | « runtime/bin/secure_socket.h ('k') | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/secure_socket.cc
diff --git a/runtime/bin/secure_socket.cc b/runtime/bin/secure_socket.cc
index 7b5cd37f003d77f0e6706f7cfd0e896e7fcc94ab..9cf0d7d3b6ed21e0c1dba5705a82d3cfc539138e 100644
--- a/runtime/bin/secure_socket.cc
+++ b/runtime/bin/secure_socket.cc
@@ -641,13 +641,14 @@ SECStatus BadCertificateCallback(void* filter, PRFileDesc* fd) {
SSLFilter* ssl_filter = static_cast<SSLFilter*>(filter);
Dart_Handle callback = ssl_filter->bad_certificate_callback();
if (Dart_IsNull(callback)) return SECFailure;
-
- Dart_EnterScope();
Dart_Handle x509_object = ssl_filter->PeerCertificate();
- Dart_Handle result =
- ThrowIfError(Dart_InvokeClosure(callback, 1, &x509_object));
- bool c_result = Dart_IsBoolean(result) && DartUtils::GetBooleanValue(result);
- Dart_ExitScope();
+ Dart_Handle result = Dart_InvokeClosure(callback, 1, &x509_object);
+ if (Dart_IsError(result)) {
+ ssl_filter->callback_error = result;
+ return SECFailure;
+ }
+ // Our wrapper is guaranteed to return a boolean.
+ bool c_result = DartUtils::GetBooleanValue(result);
return c_result ? SECSuccess : SECFailure;
}
@@ -824,6 +825,9 @@ void SSLFilter::Handshake() {
in_handshake_ = false;
}
} else {
+ if (callback_error != NULL) {
+ Dart_PropagateError(callback_error);
+ }
PRErrorCode error = PR_GetError();
if (error == PR_WOULD_BLOCK_ERROR) {
if (!in_handshake_) {
« no previous file with comments | « runtime/bin/secure_socket.h ('k') | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698