feat: enable context isolation by default (#26890)

* feat: enable context isolation by default

* chore: set default in ctx iso getter

* spec: make all specs work with the new contextIsolation default

* spec: fix affinity specs

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* spec: update tests for new ctx iso default

* chore: move stray prod deps to dev deps

* spec: update tests for new ctx iso default

* turn off contextIsolation for visibility tests

* turn off contextIsolation for <webview> tag nodeintegration attribute loads native modules when navigation happens

Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
Samuel Attard 2021-03-01 13:52:29 -08:00 committed by GitHub
parent 2d0ad0b96a
commit 186301e126
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 291 additions and 194 deletions

View file

@ -121,7 +121,7 @@ describe('renderer nodeIntegrationInSubFrames', () => {
const senders = details.map(event => event[0].sender);
const isolatedGlobals = await Promise.all(senders.map(sender => sender.executeJavaScript('window.isolatedGlobal')));
for (const result of isolatedGlobals) {
if (webPreferences.contextIsolation) {
if (webPreferences.contextIsolation === undefined || webPreferences.contextIsolation) {
expect(result).to.be.undefined();
} else {
expect(result).to.equal(true);
@ -167,8 +167,8 @@ describe('renderer nodeIntegrationInSubFrames', () => {
webPreferences: { sandbox: true }
},
{
name: 'context isolation',
webPreferences: { contextIsolation: true }
name: 'context isolation disabled',
webPreferences: { contextIsolation: false }
},
{
name: 'webview',
@ -190,7 +190,8 @@ describe('renderer nodeIntegrationInSubFrames', () => {
webPreferences: {
preload: path.resolve(__dirname, 'fixtures/sub-frames/webview-iframe-preload.js'),
nodeIntegrationInSubFrames: true,
webviewTag: true
webviewTag: true,
contextIsolation: false
}
});
});