-
Notifications
You must be signed in to change notification settings - Fork 15k
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
[Bug]: <webView>.methods not available in preload script #41814
Comments
This seems to work on this project: https://github.com/ddupont808/GPT-4V-Act/blob/7b0cbfd561e5d4e2f524b299559e4fdbc067fccd/preload.js#L36-L39 |
Hello @charlie632. Thanks for reporting this and helping to make Electron better! Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use. Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests. Now adding the
blocked/need-repro
|
Thanks! Here is the gist https://gist.github.com/charlie632/406270a2f91c0aafc5472d52d4ecea32 |
Hello! https://github.com/ddupont808/GPT-4V-Act/blob/7b0cbfd561e5d4e2f524b299559e4fdbc067fccd/main.js#L82 |
Thanks for submitting this issue! I believe this is intended behaviour and that you need to either 1) expose the views api via contextBridge, or 2) (not recommended) turn off contextIsolation (see above comment). Feel free to re-open if needed. |
Preflight Checklist
Electron Version
29.2.0
What operating system are you using?
macOS
Operating System Version
14.1.1 (23B81)
What arch are you using?
arm64 (including Apple Silicon)
Last Known Working Electron version
No response
Expected Behavior
I have this in my index.html:
Calling
webView
from the preload script should workActual Behavior
The callback is called, but the
webview.getWebContentsId
is undefined. All methods described here: https://www.electronjs.org/docs/latest/api/webview-tag#methods are undefined.If the same is run on the renderer process it works as expected.
Testcase Gist URL
https://gist.github.com/charlie632/406270a2f91c0aafc5472d52d4ecea32
Additional Information
No response
The text was updated successfully, but these errors were encountered: