replace __proto__ with Object.setPrototype
This commit is contained in:
parent
2c3cacdc08
commit
4e2f1311e0
10 changed files with 12 additions and 12 deletions
|
@ -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')
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 = {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue