fix: don't warn about enableRemoteModule when it's undefined (#29023)

* fix: don't warn about enableRemoteModule when it's undefined

* fix tests
This commit is contained in:
Jeremy Rose
2021-05-13 01:46:59 -07:00
committed by GitHub
parent 90b6db93a2
commit 2ed8e63cfe
2 changed files with 3 additions and 3 deletions

View File

@@ -270,7 +270,7 @@ const warnAboutAllowedPopups = function () {
const warnAboutRemoteModuleWithRemoteContent = function (webPreferences?: Electron.WebPreferences) {
if (!webPreferences || isLocalhost()) return;
const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : true;
const remoteModuleEnabled = webPreferences.enableRemoteModule != null ? !!webPreferences.enableRemoteModule : false;
if (!remoteModuleEnabled) return;
if (getIsRemoteProtocol()) {

View File

@@ -228,7 +228,7 @@ describe('security warnings', () => {
it('should warn about enabled remote module with remote content', async () => {
w = new BrowserWindow({
show: false,
webPreferences
webPreferences: { ...webPreferences, enableRemoteModule: true }
});
w.loadURL(`${serverUrl}/base-page-security.html`);
@@ -239,7 +239,7 @@ describe('security warnings', () => {
it('should not warn about enabled remote module with remote content from localhost', async () => {
w = new BrowserWindow({
show: false,
webPreferences
webPreferences: { ...webPreferences, enableRemoteModule: true }
});
w.loadURL(`${serverUrl}/base-page-security-onload-message.html`);
const [,, message] = await emittedUntil(w.webContents, 'console-message', isLoaded);