Fix missing remote object error when calling remote function created in preload script (3-0-x) (#15445)
* fix: report wrong context error based on contextId * fix: destroyed remote renderer warning is now async
This commit is contained in:
parent
7b0959ed2b
commit
5c853b681c
5 changed files with 52 additions and 20 deletions
|
@ -279,6 +279,7 @@ function metaToException (meta) {
|
|||
ipcRenderer.on('ELECTRON_RENDERER_CALLBACK', (event, passedContextId, id, args) => {
|
||||
if (passedContextId !== contextId) {
|
||||
// The invoked callback belongs to an old page in this renderer.
|
||||
ipcRenderer.send('ELECTRON_BROWSER_WRONG_CONTEXT_ERROR', contextId, passedContextId, id)
|
||||
return
|
||||
}
|
||||
callbacksRegistry.apply(id, metaToValue(args))
|
||||
|
@ -288,6 +289,7 @@ ipcRenderer.on('ELECTRON_RENDERER_CALLBACK', (event, passedContextId, id, args)
|
|||
ipcRenderer.on('ELECTRON_RENDERER_RELEASE_CALLBACK', (event, passedContextId, id) => {
|
||||
if (passedContextId !== contextId) {
|
||||
// The freed callback belongs to an old page in this renderer.
|
||||
ipcRenderer.send('ELECTRON_BROWSER_WRONG_CONTEXT_ERROR', contextId, passedContextId, id)
|
||||
return
|
||||
}
|
||||
callbacksRegistry.remove(id)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue