8000 app: select-client-certificate event callback can accept certificate optionally by deepak1556 · Pull Request #8134 · electron/electron · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

app: select-client-certificate event callback can accept certificate optionally #8134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

deepak1556
Copy link
Member

Fixes #8088

if (skip) {
callback()
} else {
assert.equal(list.length, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, could this still be done in the render process?

Assertion failures in the main process cause the specs to immediately terminate on CI, where as in the render process they will continue to run and finish.

@@ -380,7 +380,7 @@ void OnClientCertificateSelected(
mate::Arguments* args) {
mate::Dictionary cert_data;
if (!args->GetNext(&cert_data)) {
args->ThrowError();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you call the callback with an empty object, string, number, etc. now it will continue the request where previously it would error out.

Perhaps it would be better to explicitly check for the argument being null/undefined and still throw an error when an invalid parameter was specified to prevent accidental continuing.

What do you think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to throw error for invalid arguments.

@kevinsawicki kevinsawicki self-assigned this Dec 6, 2016
@deepak1556 deepak1556 force-pushed the empty_client_certificate_patch branch from 2573de0 to cbddbdb Compare December 7, 2016 10:04
@deepak1556
Copy link
Member Author

Have addressed the comments, thanks!

@@ -378,9 +378,21 @@ void OnClientCertificateSelected(
v8::Isolate* isolate,
std::shared_ptr<content::ClientCertificateDelegate> delegate,
mate::Arguments* args) {
if (args->Length() == 2) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this check for 2 here.

Calling callback(cert, null) would hit here and return early and not use the cert but calling callback(cert, null, null) would continue with the cert.

What case is this targeting?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want request to continue with nullptr when the callback is called with no arguments or null. Here callback has already two bound arguments on c++ side, so when callback() is called, the condition will be satisfied.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh awesome, totally makes sense, thanks for explaining 👍

@kevinsawicki kevinsawicki merged commit 2a8b36c into electron:master Dec 15, 2016
@kevinsawicki
Copy link
Contributor

Thanks for this @deepak1556 🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0