remove page-title-updated workaround for #3380

This commit is contained in:
deepak1556 2017-04-05 16:57:33 +05:30 committed by Cheng Zhao
parent e4524ce42e
commit 5e976be43b
4 changed files with 8 additions and 16 deletions

View file

@ -76,13 +76,9 @@ BrowserWindow.prototype._init = function () {
// Change window title to page title.
this.webContents.on('page-title-updated', (event, title) => {
// The page-title-updated event is not emitted immediately (see #3645), so
// when the callback is called the BrowserWindow might have been closed.
if (this.isDestroyed()) return
// Route the event to BrowserWindow.
this.emit('page-title-updated', event, title)
if (!event.defaultPrevented) this.setTitle(title)
if (!this.isDestroyed() && !event.defaultPrevented) this.setTitle(title)
})
// Sometimes the webContents doesn't get focus when window is shown, so we

View file

@ -268,13 +268,6 @@ WebContents.prototype._init = function () {
this.reload()
})
// Delays the page-title-updated event to next tick.
this.on('-page-title-updated', function (...args) {
setImmediate(() => {
this.emit('page-title-updated', ...args)
})
})
app.emit('web-contents-created', {}, this)
}