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

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

* fix tests

Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
This commit is contained in:
trop[bot]
2021-06-15 14:26:54 -07:00
committed by GitHub
parent b8e7bcb621
commit c0cc008368
2 changed files with 3 additions and 3 deletions

View File

@@ -271,7 +271,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

@@ -232,7 +232,7 @@ describe('security warnings', () => {
ifit(features.isRemoteModuleEnabled())('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`);
@@ -243,7 +243,7 @@ describe('security warnings', () => {
ifit(features.isRemoteModuleEnabled())('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);