chore: add deprecation warning on setting app.allowRendererProcessReuse to false (#22337)
* chore: add deprecation warning on setting app.allowRendererProcessReuse to false * fix: no deprecation warnings in process reuse spec * chore: add test for new deprecate removeProperty behavior
This commit is contained in:
parent
6a01898c76
commit
12c1d4411d
5 changed files with 44 additions and 7 deletions
|
@ -94,24 +94,31 @@ const deprecate: ElectronInternal.DeprecationUtil = {
|
|||
},
|
||||
|
||||
// remove a property with no replacement
|
||||
removeProperty: (o, removedName) => {
|
||||
removeProperty: (o, removedName, onlyForValues) => {
|
||||
// if the property's already been removed, warn about it
|
||||
if (!(removedName in o)) {
|
||||
const info = Object.getOwnPropertyDescriptor((o as any).__proto__, removedName) // eslint-disable-line
|
||||
if (!info) {
|
||||
deprecate.log(`Unable to remove property '${removedName}' from an object that lacks it.`)
|
||||
return o
|
||||
}
|
||||
if (!info.get || !info.set) {
|
||||
deprecate.log(`Unable to remove property '${removedName}' from an object does not have a getter / setter`)
|
||||
return o
|
||||
}
|
||||
|
||||
// wrap the deprecated property in an accessor to warn
|
||||
const warn = warnOnce(removedName)
|
||||
let val = o[removedName]
|
||||
return Object.defineProperty(o, removedName, {
|
||||
configurable: true,
|
||||
get: () => {
|
||||
warn()
|
||||
return val
|
||||
return info.get!.call(o)
|
||||
},
|
||||
set: newVal => {
|
||||
warn()
|
||||
val = newVal
|
||||
if (!onlyForValues || onlyForValues.includes(newVal)) {
|
||||
warn()
|
||||
}
|
||||
return info.set!.call(o, newVal)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue