chore: Add new webFrame IsolatedWorldInfo API and deprecate (#16801)

* chore: Add new webFrame IsolatedWorldInfo API and deprecate

* Flag deprecated methods in documentation

* address comments

* Address review comments

* remove unused variable

* Update based on review
This commit is contained in:
Nitish Sakhawalkar 2019-02-13 10:05:28 -08:00 committed by John Kleinschmidt
parent 1f458eb177
commit 3dfef4a376
4 changed files with 72 additions and 6 deletions

View file

@ -2,6 +2,7 @@
const { EventEmitter } = require('events')
const binding = process.atomBinding('web_frame')
const { deprecate } = require('electron')
class WebFrame extends EventEmitter {
constructor (context) {
@ -47,6 +48,23 @@ class WebFrame extends EventEmitter {
get routingId () {
return binding._getRoutingId(this.context)
}
// Deprecations
// TODO(nitsakh): Remove in 6.0
setIsolatedWorldSecurityOrigin (worldId, securityOrigin) {
deprecate.warn('webFrame.setIsolatedWorldSecurityOrigin', 'webFrame.setIsolatedWorldInfo')
binding._setIsolatedWorldSecurityOrigin(this.context, worldId, securityOrigin)
}
setIsolatedWorldContentSecurityPolicy (worldId, csp) {
deprecate.warn('webFrame.setIsolatedWorldContentSecurityPolicy', 'webFrame.setIsolatedWorldInfo')
binding._setIsolatedWorldContentSecurityPolicy(this.context, worldId, csp)
}
setIsolatedWorldHumanReadableName (worldId, name) {
deprecate.warn('webFrame.setIsolatedWorldHumanReadableName', 'webFrame.setIsolatedWorldInfo')
binding._setIsolatedWorldHumanReadableName(this.context, worldId, name)
}
}
// Populate the methods.