diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index d1ca60280e93..381a2a866372 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -10,7 +10,9 @@ const electron = require('electron') const {deprecate, Menu} = electron const {EventEmitter} = require('events') +// App is an EventEmitter. Object.setPrototypeOf(App.prototype, EventEmitter.prototype) +EventEmitter.call(app) Object.assign(app, { setApplicationMenu (menu) { diff --git a/lib/browser/api/auto-updater/auto-updater-native.js b/lib/browser/api/auto-updater/auto-updater-native.js index 80e2eb1b8493..cdd390d0a551 100644 --- a/lib/browser/api/auto-updater/auto-updater-native.js +++ b/lib/browser/api/auto-updater/auto-updater-native.js @@ -1,6 +1,8 @@ const EventEmitter = require('events').EventEmitter const {autoUpdater, AutoUpdater} = process.atomBinding('auto_updater') +// AutoUpdater is an EventEmitter. Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype) +EventEmitter.call(autoUpdater) module.exports = autoUpdater diff --git a/lib/browser/api/net.js b/lib/browser/api/net.js index d32f6946eee5..330faa82a8d3 100644 --- a/lib/browser/api/net.js +++ b/lib/browser/api/net.js @@ -9,7 +9,10 @@ const {Session} = process.atomBinding('session') const {net, Net} = process.atomBinding('net') const {URLRequest} = net +// Net is an EventEmitter. Object.setPrototypeOf(Net.prototype, EventEmitter.prototype) +EventEmitter.call(net) + Object.setPrototypeOf(URLRequest.prototype, EventEmitter.prototype) const kSupportedProtocols = new Set(['http:', 'https:']) diff --git a/lib/browser/api/power-monitor.js b/lib/browser/api/power-monitor.js index aee9b450c84f..e1dff2c3b73c 100644 --- a/lib/browser/api/power-monitor.js +++ b/lib/browser/api/power-monitor.js @@ -1,6 +1,8 @@ const {EventEmitter} = require('events') const {powerMonitor, PowerMonitor} = process.atomBinding('power_monitor') +// PowerMonitor is an EventEmitter. Object.setPrototypeOf(PowerMonitor.prototype, EventEmitter.prototype) +EventEmitter.call(powerMonitor) module.exports = powerMonitor diff --git a/lib/browser/api/screen.js b/lib/browser/api/screen.js index 83381ab5d797..8287bfa8bfdc 100644 --- a/lib/browser/api/screen.js +++ b/lib/browser/api/screen.js @@ -1,6 +1,8 @@ const {EventEmitter} = require('events') const {screen, Screen} = process.atomBinding('screen') +// Screen is an EventEmitter. Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype) +EventEmitter.call(screen) module.exports = screen diff --git a/lib/browser/api/system-preferences.js b/lib/browser/api/system-preferences.js index 7d9d475bc242..e4485d3d8726 100644 --- a/lib/browser/api/system-preferences.js +++ b/lib/browser/api/system-preferences.js @@ -1,6 +1,8 @@ const {EventEmitter} = require('events') const {systemPreferences, SystemPreferences} = process.atomBinding('system_preferences') +// SystemPreferences is an EventEmitter. Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype) +EventEmitter.call(systemPreferences) module.exports = systemPreferences diff --git a/lib/renderer/api/web-frame.js b/lib/renderer/api/web-frame.js index f9d2b3b1918f..3241858cfacc 100644 --- a/lib/renderer/api/web-frame.js +++ b/lib/renderer/api/web-frame.js @@ -5,6 +5,7 @@ const {webFrame, WebFrame} = process.atomBinding('web_frame') // WebFrame is an EventEmitter. Object.setPrototypeOf(WebFrame.prototype, EventEmitter.prototype) +EventEmitter.call(webFrame) // Lots of webview would subscribe to webFrame's events. webFrame.setMaxListeners(0)