Set appropriate defaults for webview options (#12271)
* Persist defaults to webPreferences object to JS land can read the inferred values instead of just user defined values * Test inherited default propogation * Refactor to remove coupling from fetching values and defaults * Test description type * Fix up tests
This commit is contained in:
parent
f54c94d6c9
commit
c2673aa970
11 changed files with 110 additions and 11 deletions
|
@ -268,6 +268,26 @@ describe('chromium feature', () => {
|
|||
b = window.open(windowUrl, '', 'nodeIntegration=no,show=no')
|
||||
})
|
||||
|
||||
it('disables webviewTag when node integration is disabled on the parent window', (done) => {
|
||||
let b
|
||||
listener = (event) => {
|
||||
assert.equal(event.data.isWebViewUndefined, true)
|
||||
b.close()
|
||||
done()
|
||||
}
|
||||
window.addEventListener('message', listener)
|
||||
|
||||
const windowUrl = require('url').format({
|
||||
pathname: `${fixtures}/pages/window-opener-no-web-view-tag.html`,
|
||||
protocol: 'file',
|
||||
query: {
|
||||
p: `${fixtures}/pages/window-opener-web-view.html`
|
||||
},
|
||||
slashes: true
|
||||
})
|
||||
b = window.open(windowUrl, '', 'nodeIntegration=no,show=no')
|
||||
})
|
||||
|
||||
it('disables node integration when it is disabled on the parent window for chrome devtools URLs', (done) => {
|
||||
let b
|
||||
app.once('web-contents-created', (event, contents) => {
|
||||
|
@ -287,7 +307,7 @@ describe('chromium feature', () => {
|
|||
app.once('web-contents-created', (event, contents) => {
|
||||
contents.once('did-finish-load', () => {
|
||||
app.once('browser-window-created', (event, window) => {
|
||||
const preferences = window.webContents.getWebPreferences()
|
||||
const preferences = window.webContents.getLastWebPreferences()
|
||||
assert.equal(preferences.javascript, false)
|
||||
window.destroy()
|
||||
b.close()
|
||||
|
@ -509,7 +529,7 @@ describe('chromium feature', () => {
|
|||
done()
|
||||
}
|
||||
window.addEventListener('message', listener)
|
||||
w = window.open(url, '', 'show=no')
|
||||
w = window.open(url, '', 'show=no,nodeIntegration=no')
|
||||
})
|
||||
|
||||
it('works when origin matches', (done) => {
|
||||
|
@ -518,7 +538,7 @@ describe('chromium feature', () => {
|
|||
done()
|
||||
}
|
||||
window.addEventListener('message', listener)
|
||||
w = window.open(`file://${fixtures}/pages/window-opener-location.html`, '', 'show=no')
|
||||
w = window.open(`file://${fixtures}/pages/window-opener-location.html`, '', 'show=no,nodeIntegration=no')
|
||||
})
|
||||
|
||||
it('works when origin does not match opener but has node integration', (done) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue