New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing remote object error when calling remote function created in preload script #15444
Conversation
Manually backported as in above links. |
@zcbenz There is a consistent test failure here
|
I have fixed the failing test. There is a slight change that, the warning is now printed asynchronously after the renderer process checked the |
w = new BrowserWindow({ | ||
show: false, | ||
webPreferences: { | ||
preload: preload |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: preload: preload
can just be preload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Release Notes Persisted
|
Thanks for this fix @zcbenz and props for the quick review @codebytere and @jkleinsc ! This fix really helps me out :) 👍 |
Description of Change
Previously we were using
sender.getProcessId()
to determine whether the context of a remote function still lives. But sincesender.getProcessId()
may still return the ID of previous page when the new page is still loading, we will wrongly report "missing remote object error" when the remote function is created in preload script.This PR removes the check of
sender.getProcessId()
in the main process, and instead checks thecontextId
in the renderer process which is reliable.Close #14965.
Checklist
npm test
passesRelease Notes
Notes: Fix missing remote object error when calling remote function created in preload script