|
@@ -264,10 +264,20 @@ const callFunction = function (event, contextId, func, caller, args) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+const isRemoteModuleEnabledCache = new WeakMap()
|
|
|
+
|
|
|
+const isRemoteModuleEnabled = function (contents) {
|
|
|
+ if (!isRemoteModuleEnabledCache.has(contents)) {
|
|
|
+ isRemoteModuleEnabledCache.set(contents, contents._isRemoteModuleEnabled())
|
|
|
+ }
|
|
|
+
|
|
|
+ return isRemoteModuleEnabledCache.get(contents)
|
|
|
+}
|
|
|
+
|
|
|
const handleRemoteCommand = function (channel, handler) {
|
|
|
ipcMainInternal.on(channel, (event, contextId, ...args) => {
|
|
|
let returnValue
|
|
|
- if (!event.sender._isRemoteModuleEnabled()) {
|
|
|
+ if (!isRemoteModuleEnabled(event.sender)) {
|
|
|
event.returnValue = null
|
|
|
return
|
|
|
}
|
|
@@ -506,7 +516,7 @@ ipcMainInternal.on('ELECTRON_BROWSER_SANDBOX_LOAD', function (event) {
|
|
|
|
|
|
event.returnValue = {
|
|
|
preloadScripts: preloadPaths.map(path => getPreloadScript(path)),
|
|
|
- isRemoteModuleEnabled: event.sender._isRemoteModuleEnabled(),
|
|
|
+ isRemoteModuleEnabled: isRemoteModuleEnabled(event.sender),
|
|
|
isWebViewTagEnabled: guestViewManager.isWebViewTagEnabled(event.sender),
|
|
|
process: {
|
|
|
arch: process.arch,
|