mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Fix missing remote object error when calling remote function created in preload script (#15444)
* fix: report wrong context error based on contextId * fix: destroyed remote renderer warning is now async
This commit is contained in:
committed by
John Kleinschmidt
parent
b2e1a93177
commit
a8f2646ba6
@@ -270,9 +270,12 @@ function metaToPlainObject (meta) {
|
||||
}
|
||||
|
||||
function handleMessage (channel, handler) {
|
||||
ipcRenderer.on(channel, (event, passedContextId, ...args) => {
|
||||
ipcRenderer.on(channel, (event, passedContextId, id, ...args) => {
|
||||
if (passedContextId === contextId) {
|
||||
handler(...args)
|
||||
handler(id, ...args)
|
||||
} else {
|
||||
// Message sent to an un-exist context, notify the error to main process.
|
||||
ipcRenderer.send('ELECTRON_BROWSER_WRONG_CONTEXT_ERROR', contextId, passedContextId, id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user