webContents: defer url load when there is a pending navigation entry
This commit is contained in:
parent
e315116336
commit
dead1ae1ba
3 changed files with 125 additions and 16 deletions
|
@ -229,6 +229,24 @@ describe('BrowserWindow module', function () {
|
|||
w.loadURL(`data:image/png;base64,${data}`)
|
||||
})
|
||||
|
||||
it('should not crash when there is a pending navigation entry', function (done) {
|
||||
const source = `
|
||||
<script>
|
||||
setInterval(function () {
|
||||
window.location = 'http://host'
|
||||
}, 1000)
|
||||
</script>
|
||||
`
|
||||
w.webContents.on('did-fail-load', function (event, code, desc, url, isMainFrame) {
|
||||
assert.equal(url, 'http://host/')
|
||||
w.webContents.loadURL('about:blank')
|
||||
})
|
||||
w.webContents.on('did-navigate', function (event, url) {
|
||||
if (url === 'about:blank') done()
|
||||
})
|
||||
w.loadURL(`data:text/html,${source}`)
|
||||
})
|
||||
|
||||
describe('POST navigations', function () {
|
||||
afterEach(() => {
|
||||
w.webContents.session.webRequest.onBeforeSendHeaders(null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue