diff --git a/docs/api/dialog.md b/docs/api/dialog.md index 58bbd050845a..6515a0feb940 100644 --- a/docs/api/dialog.md +++ b/docs/api/dialog.md @@ -175,9 +175,9 @@ it is usually used to report errors in early stage of startup. If called before the app `ready`event on Linux, the message will be emitted to stderr, and no GUI dialog will appear. -### `dialog.showCertificateTrustDialog(browserWindow, options, callback)` _macOS_ +### `dialog.showCertificateTrustDialog([browserWindow, ]options, callback)` _macOS_ -* `browserWindow` BrowserWindow +* `browserWindow` BrowserWindow (optional) * `options` Object * `certificate` [Certificate](structures/certificate.md) - The certificate to trust/import. * `message` String - The message to display to the user. @@ -186,6 +186,9 @@ and no GUI dialog will appear. Displays a modal dialog that shows a message and certificate information, and gives the user the option of trusting/importing the certificate. +The `browserWindow` argument allows the dialog to attach itself to a parent +window, making it modal. + ## Sheets On macOS, dialogs are presented as sheets attached to a window if you provide diff --git a/lib/browser/api/dialog.js b/lib/browser/api/dialog.js index 215d3f25dd97..964461804769 100644 --- a/lib/browser/api/dialog.js +++ b/lib/browser/api/dialog.js @@ -282,7 +282,9 @@ module.exports = { return binding.showErrorBox(...args) }, - showCertificateTrustDialog: function (window, options, callback) { + showCertificateTrustDialog: function (...args) { + let [window, options, callback] = parseArgs(...args) + if (options == null || typeof options !== 'object') { throw new TypeError('options must be an object') }