feat: expose win.isContentProtected() (#47310)

* feat: expose win.isContentProtected()

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: remove stray _isContentProtected

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot] 2025-06-05 15:46:57 +02:00 committed by GitHub
commit 2e2d1f1612
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 7 deletions

View file

@ -300,8 +300,7 @@ describe('BrowserWindow module', () => {
afterEach(closeAllWindows);
it('can set content protection', async () => {
const w = new BrowserWindow({ show: false });
// @ts-expect-error This is a private API
expect(w._isContentProtected()).to.equal(false);
expect(w.isContentProtected()).to.equal(false);
const shown = once(w, 'show');
@ -309,8 +308,7 @@ describe('BrowserWindow module', () => {
await shown;
w.setContentProtection(true);
// @ts-expect-error This is a private API
expect(w._isContentProtected()).to.equal(true);
expect(w.isContentProtected()).to.equal(true);
});
it('does not remove content protection after the window is hidden and shown', async () => {
@ -329,8 +327,7 @@ describe('BrowserWindow module', () => {
w.show();
await shown;
// @ts-expect-error This is a private API
expect(w._isContentProtected()).to.equal(true);
expect(w.isContentProtected()).to.equal(true);
});
});