Remove guest from will-attach-webview event
This commit is contained in:
parent
acff2f6baf
commit
a7c050107b
4 changed files with 3 additions and 4 deletions
|
@ -507,7 +507,6 @@ Emitted when the devtools window instructs the webContents to reload
|
|||
Returns:
|
||||
|
||||
* `event` Event
|
||||
* `guest` WebContents - The contents of the guest page.
|
||||
* `webPreferences` Object - The web preferences that will be used by the guest
|
||||
page. This object can be modified to adjust the preferences for the guest
|
||||
page.
|
||||
|
|
|
@ -206,7 +206,7 @@ const attachGuest = function (event, elementInstanceId, guestInstanceId, params)
|
|||
webPreferences.preloadURL = params.preload
|
||||
}
|
||||
|
||||
event.sender.emit('will-attach-webview', event, guest, webPreferences, params)
|
||||
event.sender.emit('will-attach-webview', event, webPreferences, params)
|
||||
if (event.defaultPrevented) {
|
||||
if (guest.viewInstanceId == null) guest.viewInstanceId = params.instanceId
|
||||
destroyGuest(embedder, guestInstanceId)
|
||||
|
|
|
@ -255,7 +255,7 @@ ipcMain.on('prevent-next-will-attach-webview', (event) => {
|
|||
})
|
||||
|
||||
ipcMain.on('disable-node-on-next-will-attach-webview', (event, id) => {
|
||||
event.sender.once('will-attach-webview', (event, guest, webPreferences, params) => {
|
||||
event.sender.once('will-attach-webview', (event, webPreferences, params) => {
|
||||
params.src = `file://${path.join(__dirname, '..', 'fixtures', 'pages', 'c.html')}`
|
||||
webPreferences.nodeIntegration = false
|
||||
})
|
||||
|
|
|
@ -1100,7 +1100,7 @@ describe('<webview> tag', function () {
|
|||
w.loadURL('file://' + fixtures + '/pages/webview-visibilitychange.html')
|
||||
})
|
||||
|
||||
describe('will-attach-webview event', () => {
|
||||
describe.only('will-attach-webview event', () => {
|
||||
it('supports changing the web preferences', (done) => {
|
||||
ipcRenderer.send('disable-node-on-next-will-attach-webview')
|
||||
webview.addEventListener('console-message', (event) => {
|
||||
|
|
Loading…
Reference in a new issue