diff --git a/lib/browser/api/app.js b/lib/browser/api/app.js index ac2cf6084146..c2e2899e77c7 100644 --- a/lib/browser/api/app.js +++ b/lib/browser/api/app.js @@ -9,7 +9,7 @@ const bindings = process.atomBinding('app') const downloadItemBindings = process.atomBinding('download_item') const app = bindings.app -app.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(app, EventEmitter.prototype) app.setApplicationMenu = function (menu) { return Menu.setApplicationMenu(menu) @@ -102,7 +102,7 @@ deprecate.event(app, 'select-certificate', 'select-client-certificate') // Wrappers for native classes. var wrapDownloadItem = function (downloadItem) { // downloadItem is an EventEmitter. - downloadItem.__proto__ = EventEmitter.prototype + Object.setPrototypeOf(downloadItem, EventEmitter.prototype) // Deprecated. deprecate.property(downloadItem, 'url', 'getURL') diff --git a/lib/browser/api/auto-updater/auto-updater-native.js b/lib/browser/api/auto-updater/auto-updater-native.js index 86a1e63503cc..1fff05dbd65c 100644 --- a/lib/browser/api/auto-updater/auto-updater-native.js +++ b/lib/browser/api/auto-updater/auto-updater-native.js @@ -1,6 +1,6 @@ const EventEmitter = require('events').EventEmitter const autoUpdater = process.atomBinding('auto_updater').autoUpdater -autoUpdater.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(autoUpdater, EventEmitter.prototype) module.exports = autoUpdater diff --git a/lib/browser/api/browser-window.js b/lib/browser/api/browser-window.js index d29f4c743141..a00fef3b4536 100644 --- a/lib/browser/api/browser-window.js +++ b/lib/browser/api/browser-window.js @@ -5,7 +5,7 @@ const deprecate = require('electron').deprecate const EventEmitter = require('events').EventEmitter const {BrowserWindow, _setDeprecatedOptionsCheck} = process.atomBinding('window') -BrowserWindow.prototype.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(BrowserWindow.prototype, EventEmitter.prototype) BrowserWindow.prototype._init = function () { // avoid recursive require. diff --git a/lib/browser/api/menu.js b/lib/browser/api/menu.js index 892f7a250fc9..e05637e79e7d 100644 --- a/lib/browser/api/menu.js +++ b/lib/browser/api/menu.js @@ -87,7 +87,7 @@ var indexToInsertByPosition = function (items, position) { const Menu = bindings.Menu -Menu.prototype.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(Menu.prototype, EventEmitter.prototype) Menu.prototype._init = function () { this.commandsMap = {} diff --git a/lib/browser/api/power-monitor.js b/lib/browser/api/power-monitor.js index e09a36e6608f..02afeb5ba111 100644 --- a/lib/browser/api/power-monitor.js +++ b/lib/browser/api/power-monitor.js @@ -1,6 +1,6 @@ const EventEmitter = require('events').EventEmitter const powerMonitor = process.atomBinding('power_monitor').powerMonitor -powerMonitor.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(powerMonitor, EventEmitter.prototype) module.exports = powerMonitor diff --git a/lib/browser/api/screen.js b/lib/browser/api/screen.js index 42f6ad1a51ad..9326ace2c4f1 100644 --- a/lib/browser/api/screen.js +++ b/lib/browser/api/screen.js @@ -1,6 +1,6 @@ const EventEmitter = require('events').EventEmitter const screen = process.atomBinding('screen').screen -screen.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(screen, EventEmitter.prototype) module.exports = screen diff --git a/lib/browser/api/session.js b/lib/browser/api/session.js index f0ff786cf2bd..47e00bd0462f 100644 --- a/lib/browser/api/session.js +++ b/lib/browser/api/session.js @@ -27,7 +27,7 @@ Object.defineProperty(exports, 'defaultSession', { var wrapSession = function (session) { // session is an EventEmitter. - session.__proto__ = EventEmitter.prototype + Object.setPrototypeOf(session, EventEmitter.prototype) } bindings._setWrapSession(wrapSession) diff --git a/lib/browser/api/tray.js b/lib/browser/api/tray.js index 293825200e48..ce67dbe117a2 100644 --- a/lib/browser/api/tray.js +++ b/lib/browser/api/tray.js @@ -2,7 +2,7 @@ const deprecate = require('electron').deprecate const EventEmitter = require('events').EventEmitter const Tray = process.atomBinding('tray').Tray -Tray.prototype.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype) Tray.prototype._init = function () { // Deprecated. diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 60c159467ff9..ef3d703dee7f 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -66,7 +66,7 @@ const webFrameMethods = [ let wrapWebContents = function (webContents) { // webContents is an EventEmitter. var controller, method, name, ref1 - webContents.__proto__ = EventEmitter.prototype + Object.setPrototypeOf(webContents, EventEmitter.prototype) // Every remote callback from renderer process would add a listenter to the // render-view-deleted event, so ignore the listenters warning. @@ -217,7 +217,7 @@ let wrapWebContents = function (webContents) { // Wrapper for native class. let wrapDebugger = function (webContentsDebugger) { // debugger is an EventEmitter. - webContentsDebugger.__proto__ = EventEmitter.prototype + Object.setPrototypeOf(webContentsDebugger, EventEmitter.prototype) } binding._setWrapWebContents(wrapWebContents) diff --git a/lib/renderer/api/web-frame.js b/lib/renderer/api/web-frame.js index 7f48f1eabbd1..4a152d4f3646 100644 --- a/lib/renderer/api/web-frame.js +++ b/lib/renderer/api/web-frame.js @@ -6,7 +6,7 @@ const EventEmitter = require('events').EventEmitter const webFrame = process.atomBinding('web_frame').webFrame // webFrame is an EventEmitter. -webFrame.__proto__ = EventEmitter.prototype +Object.setPrototypeOf(webFrame, EventEmitter.prototype) // Lots of webview would subscribe to webFrame's events. webFrame.setMaxListeners(0)