refactor: implement isRemoteModuleEnabled via getLastWebPreferences() (#19220)
This commit is contained in:
parent
04debd5890
commit
01fdb80f7c
9 changed files with 13 additions and 30 deletions
|
@ -241,11 +241,16 @@ const unwrapArgs = function (sender, frameId, contextId, args) {
|
|||
return args.map(metaToValue)
|
||||
}
|
||||
|
||||
const isRemoteModuleEnabledImpl = function (contents) {
|
||||
const webPreferences = contents.getLastWebPreferences() || {}
|
||||
return !!webPreferences.enableRemoteModule
|
||||
}
|
||||
|
||||
const isRemoteModuleEnabledCache = new WeakMap()
|
||||
|
||||
const isRemoteModuleEnabled = function (contents) {
|
||||
if (!isRemoteModuleEnabledCache.has(contents)) {
|
||||
isRemoteModuleEnabledCache.set(contents, contents._isRemoteModuleEnabled())
|
||||
isRemoteModuleEnabledCache.set(contents, isRemoteModuleEnabledImpl(contents))
|
||||
}
|
||||
|
||||
return isRemoteModuleEnabledCache.get(contents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue