diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index fac80d9177e6..c323819a7877 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -81,13 +81,13 @@ const removeBackgroundPages = function (manifest) { } // Dispatch tabs events. -const hookWindowForTabEvents = function (win, webContents) { +const hookWindowForTabEvents = function (webContents) { const tabId = webContents.id for (const page of objectValues(backgroundPages)) { page.webContents.sendToAll('CHROME_TABS_ONCREATED', tabId) } - win.once('closed', () => { + webContents.once('destroyed', () => { for (const page of objectValues(backgroundPages)) { page.webContents.sendToAll('CHROME_TABS_ONREMOVED', tabId) } @@ -320,7 +320,7 @@ app.once('ready', function () { } BrowserWindow.prototype._loadDevToolsExtensions = function (webContents) { - hookWindowForTabEvents(this, webContents) + hookWindowForTabEvents(webContents) webContents.on('devtools-opened', function () { loadDevToolsExtensions(webContents, objectValues(manifestMap)) })