docs: Update the certificate APIs

This commit is contained in:
Cheng Zhao 2015-11-18 11:35:26 +08:00
parent c5bfac1969
commit 9ca022c98a
4 changed files with 84 additions and 26 deletions

View file

@ -131,6 +131,35 @@ Returns:
Emitted when a new [browserWindow](browser-window.md) is created.
### Event: 'certificate-error'
Returns:
* `event` Event
* `webContents` [WebContents](web-contents.md)
* `url` URL
* `error` String - The error code
* `certificate` Object
* `data` Buffer - PEM encoded data
* `issuerName` String
* `callback` Function
Emitted when failed to verify the `certificate` for `url`, to trust the
certificate you should prevent the default behavior with
`event.preventDefault()` and call `callback(true)`.
```javascript
session.on('certificate-error', function(event, webContents, url, error, certificate, callback) {
if (url == "https://github.com") {
// Verification logic.
event.preventDefault();
callback(true);
} else {
callback(false);
}
});
```
### Event: 'select-client-certificate'
Returns: