+
Skip to content

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Mar 1, 2019

Description of Change

Promisify dialog.showCertificateTrustDialog().

Checklist

Release Notes

Notes: Converted dialog.showCertificateTrustDialog() to return a Promise instead of taking a callback.

@electron-cation electron-cation bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Mar 1, 2019
@codebytere codebytere force-pushed the promisify-showcerttrust branch from e0f6179 to b25f303 Compare March 8, 2019 17:23
@codebytere codebytere marked this pull request as ready for review March 8, 2019 17:23
@codebytere codebytere force-pushed the promisify-showcerttrust branch from b25f303 to aff0bc2 Compare March 8, 2019 18:45
}

callback.Run();
promise.Resolve();
Copy link
Member

Choose a reason for hiding this comment

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

Is this method is synchronous / blocking on windows? Might be worth documenting / possibly making async somehow 🤔

@codebytere codebytere force-pushed the promisify-showcerttrust branch from aff0bc2 to defd7ae Compare March 11, 2019 20:33
@codebytere codebytere force-pushed the promisify-showcerttrust branch 3 times, most recently from 7fda78f to 1e042da Compare March 12, 2019 18:08
@codebytere codebytere requested a review from zcbenz March 12, 2019 18:09
@codebytere codebytere force-pushed the promisify-showcerttrust branch from 1e042da to 092b494 Compare March 12, 2019 21:11
@codebytere codebytere added the semver/major incompatible API changes label Mar 13, 2019
@codebytere codebytere force-pushed the promisify-showcerttrust branch from 092b494 to a80719a Compare March 13, 2019 20:47
secPolicy:(SecPolicyRef)secPolicy {
if ((self = [super init])) {
callback_ = callback;
promise_.reset(new atom::util::Promise(std::move(promise)));
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need keeping promise_ in a std::unique_ptr. It is only needed when the stored promise may be empty, but in this class since the promise is guaranteed to be always available, it can just be stored as normal value.

@interface TrustDelegate : NSObject {
 @private
  atom::util::Promise promise_;
}

promise_ = std::move(promise);

Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized there is no constructor in objective-c classes so std::unique_ptr is the only way to go. This PR should be ready to go!

@codebytere codebytere force-pushed the promisify-showcerttrust branch from a80719a to 21a6f45 Compare March 14, 2019 19:10
@codebytere codebytere force-pushed the promisify-showcerttrust branch from 21a6f45 to adfa72a Compare March 14, 2019 20:32
@zcbenz zcbenz merged commit 961c9a8 into master Mar 15, 2019
@release-clerk
Copy link

release-clerk bot commented Mar 15, 2019

Release Notes Persisted

Converted dialog.showCertificateTrustDialog() to return a Promise instead of taking a callback.

@zcbenz zcbenz deleted the promisify-showcerttrust branch March 15, 2019 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/major incompatible API changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载