Skip to content

Commit

Permalink
fix: deny instead of canceling when certificate-error passes false (#…
Browse files Browse the repository at this point in the history
…29826) (#29870)

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
  • Loading branch information
trop[bot] and nornagon committed Jun 25, 2021
1 parent 5c3670c commit 272f9db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_app.cc
Expand Up @@ -412,7 +412,7 @@ struct Converter<content::CertificateRequestResultType> {
if (!ConvertFromV8(isolate, val, &b))
return false;
*out = b ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
: content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL;
: content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
return true;
}
};
Expand Down
18 changes: 18 additions & 0 deletions spec-main/api-app-spec.ts
Expand Up @@ -322,6 +322,24 @@ describe('app module', () => {
w.loadURL(secureUrl);
await emittedOnce(app, 'certificate-error');
});

describe('when denied', () => {
before(() => {
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
callback(false);
});
});

after(() => {
app.removeAllListeners('certificate-error');
});

it('causes did-fail-load', async () => {
const w = new BrowserWindow({ show: false });
w.loadURL(secureUrl);
await emittedOnce(w.webContents, 'did-fail-load');
});
});
});

// xdescribe('app.importCertificate', () => {
Expand Down

0 comments on commit 272f9db

Please sign in to comment.