chore: remove promisification deprecation callbacks (#17907)
* chore: remove promisification deprecation callbacks * update docs * fix smoke test * fix executejs issue * cleanup leftovers * fix webContents.executeJavaScript tests * cleanup WebContents.prototype.takeHeapSnapshot * fix "sets arbitrary webContents as devtools" test * fix executeJavaScriptInFrame related tests
This commit is contained in:
parent
fdf5f838f4
commit
d87b3ead76
44 changed files with 94 additions and 1418 deletions
|
@ -86,9 +86,6 @@ for (const name of events) {
|
|||
})
|
||||
}
|
||||
|
||||
// Function Deprecations
|
||||
app.getFileIcon = deprecate.promisify(app.getFileIcon)
|
||||
|
||||
// Property Deprecations
|
||||
deprecate.fnToProperty(app, 'accessibilitySupportEnabled', '_isAccessibilitySupportEnabled', '_setAccessibilitySupportEnabled')
|
||||
deprecate.fnToProperty(app, 'badgeCount', '_getBadgeCount', '_setBadgeCount')
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
'use strict'
|
||||
const { deprecate } = require('electron')
|
||||
const contentTracing = process.electronBinding('content_tracing')
|
||||
const contentTracing =
|
||||
|
||||
contentTracing.getCategories = deprecate.promisify(contentTracing.getCategories)
|
||||
contentTracing.startRecording = deprecate.promisify(contentTracing.startRecording)
|
||||
contentTracing.stopRecording = deprecate.promisify(contentTracing.stopRecording)
|
||||
contentTracing.getTraceBufferUsage = deprecate.promisifyMultiArg(
|
||||
contentTracing.getTraceBufferUsage
|
||||
// convertPromiseValue: Temporarily disabled until it's used
|
||||
/* (value) => [value.paths, value.bookmarks] */
|
||||
)
|
||||
|
||||
module.exports = contentTracing
|
||||
module.exports = process.electronBinding('content_tracing')
|
||||
|
|
|
@ -216,8 +216,3 @@ module.exports = {
|
|||
return binding.showCertificateTrustDialog(window, certificate, message)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.showMessageBox = deprecate.promisify(module.exports.showMessageBox)
|
||||
module.exports.showOpenDialog = deprecate.promisify(module.exports.showOpenDialog)
|
||||
module.exports.showSaveDialog = deprecate.promisify(module.exports.showSaveDialog)
|
||||
module.exports.showCertificateTrustDialog = deprecate.promisify(module.exports.showCertificateTrustDialog)
|
||||
|
|
|
@ -20,6 +20,3 @@ if (process.platform === 'darwin') {
|
|||
getReceiptURL: () => ''
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.purchaseProduct = deprecate.promisify(module.exports.purchaseProduct)
|
||||
module.exports.getProducts = deprecate.promisify(module.exports.getProducts)
|
||||
|
|
|
@ -22,21 +22,3 @@ Object.setPrototypeOf(Cookies.prototype, EventEmitter.prototype)
|
|||
Session.prototype._init = function () {
|
||||
app.emit('session-created', this)
|
||||
}
|
||||
|
||||
Session.prototype.clearStorageData = deprecate.promisify(Session.prototype.clearStorageData)
|
||||
Session.prototype.clearHostResolverCache = deprecate.promisify(Session.prototype.clearHostResolverCache)
|
||||
Session.prototype.resolveProxy = deprecate.promisify(Session.prototype.resolveProxy)
|
||||
Session.prototype.setProxy = deprecate.promisify(Session.prototype.setProxy)
|
||||
Session.prototype.getCacheSize = deprecate.promisify(Session.prototype.getCacheSize)
|
||||
Session.prototype.clearCache = deprecate.promisify(Session.prototype.clearCache)
|
||||
Session.prototype.clearAuthCache = deprecate.promisify(Session.prototype.clearAuthCache)
|
||||
Session.prototype.getBlobData = deprecate.promisifyMultiArg(Session.prototype.getBlobData)
|
||||
|
||||
Cookies.prototype.flushStore = deprecate.promisify(Cookies.prototype.flushStore)
|
||||
Cookies.prototype.get = deprecate.promisify(Cookies.prototype.get)
|
||||
Cookies.prototype.remove = deprecate.promisify(Cookies.prototype.remove)
|
||||
Cookies.prototype.set = deprecate.promisify(Cookies.prototype.set)
|
||||
|
||||
NetLog.prototype.stopLogging = deprecate.promisify(NetLog.prototype.stopLogging)
|
||||
|
||||
Protocol.prototype.isProtocolHandled = deprecate.promisify(Protocol.prototype.isProtocolHandled)
|
||||
|
|
|
@ -202,30 +202,6 @@ WebContents.prototype.executeJavaScript = function (code, hasUserGesture) {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO(codebytere): remove when promisifications is complete
|
||||
const nativeZoomLevel = WebContents.prototype.getZoomLevel
|
||||
WebContents.prototype.getZoomLevel = function (callback) {
|
||||
if (callback == null) {
|
||||
return nativeZoomLevel.call(this)
|
||||
} else {
|
||||
process.nextTick(() => {
|
||||
callback(nativeZoomLevel.call(this))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(codebytere): remove when promisifications is complete
|
||||
const nativeZoomFactor = WebContents.prototype.getZoomFactor
|
||||
WebContents.prototype.getZoomFactor = function (callback) {
|
||||
if (callback == null) {
|
||||
return nativeZoomFactor.call(this)
|
||||
} else {
|
||||
process.nextTick(() => {
|
||||
callback(nativeZoomFactor.call(this))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Translate the options of printToPDF.
|
||||
WebContents.prototype.printToPDF = function (options) {
|
||||
const printingSetting = Object.assign({}, defaultPrintingSetting)
|
||||
|
@ -306,11 +282,6 @@ WebContents.prototype.loadFile = function (filePath, options = {}) {
|
|||
}))
|
||||
}
|
||||
|
||||
WebContents.prototype.capturePage = deprecate.promisify(WebContents.prototype.capturePage)
|
||||
WebContents.prototype.executeJavaScript = deprecate.promisify(WebContents.prototype.executeJavaScript)
|
||||
WebContents.prototype.printToPDF = deprecate.promisify(WebContents.prototype.printToPDF)
|
||||
WebContents.prototype.savePage = deprecate.promisify(WebContents.prototype.savePage)
|
||||
|
||||
const addReplyToEvent = (event) => {
|
||||
event.reply = (...args) => {
|
||||
event.sender.sendToFrame(event.frameId, ...args)
|
||||
|
@ -452,9 +423,6 @@ WebContents.prototype._init = function () {
|
|||
|
||||
// JavaScript wrapper of Debugger.
|
||||
const { Debugger } = process.electronBinding('debugger')
|
||||
|
||||
Debugger.prototype.sendCommand = deprecate.promisify(Debugger.prototype.sendCommand)
|
||||
|
||||
Object.setPrototypeOf(Debugger.prototype, EventEmitter.prototype)
|
||||
|
||||
// Public APIs.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue