Merge pull request #8134 from deepak1556/empty_client_certificate_patch

app: select-client-certificate event callback can accept certificate optionally
This commit is contained in:
Kevin Sawicki 2016-12-15 08:31:12 -08:00 committed by GitHub
commit 2a8b36c761
4 changed files with 102 additions and 31 deletions

View file

@ -378,9 +378,21 @@ void OnClientCertificateSelected(
v8::Isolate* isolate,
std::shared_ptr<content::ClientCertificateDelegate> delegate,
mate::Arguments* args) {
if (args->Length() == 2) {
delegate->ContinueWithCertificate(nullptr);
return;
}
v8::Local<v8::Value> val;
args->GetNext(&val);
if (val->IsNull()) {
delegate->ContinueWithCertificate(nullptr);
return;
}
mate::Dictionary cert_data;
if (!args->GetNext(&cert_data)) {
args->ThrowError();
if (!mate::ConvertFromV8(isolate, val, &cert_data)) {
args->ThrowError("Must pass valid certificate object.");
return;
}