You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
'paint' event not triggered when using useSharedTexture in window opened by setWindowOpenHandler #46853
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a bug report that matches the one I want to file, without success.
Electron Version
34.5.1
What operating system(s) are you using?
macOS
Operating System Version
macOS Monterey 12.7.6
What arch are you using?
x64
Last Known Working Electron version
No response
Expected Behavior
Expect the new window, opened from renderer through setWindowOpenHandler with overrideBrowserWindowOptions or createWindow, to trigger the 'paint' event.
Actual Behavior
'paint' event is not triggered, as if the useSharedTexture option (thank you @reitowo!) wasn't taken into account.
Use case
I want to create or consume canvases in the visible window (think of incoming WebRTC streams, drawable canvas, etc.) and to 'clone' them (drawImage) at their real size in an OSR window. Then, in the 'paint' event I would be able to publish the frame handle to my node native addon (node-syphon).
Unfortunately, the Electron team is small and does not have the capacity to work with testcases with third-party dependencies (e.g. Vue). For one of us to be able to take a look, could you please publish a vanilla JS testcase gist with Electron Fiddle? (If you run into problems with publishing gists, it's usually related to authentication. Try removing the GitHub auth token and creating a new one.)
Applying the blocked/need-repro label until this is resolved. Thanks!
Hello @benoitlahoz. 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-reproNeeds a test case to reproduce the bug
label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
Thank you.
I tested on v36 with same problem.
I went to the issues you mention, but it really looks like the 'offscreen' option object is not handled in this case.
I may miss something though 🙃🤨
I found paint event also doesn't work, even without sharedTexture enabled. By tracing, I found WebContents::WebContents was called only once (where the offscreen was considered), while BrowserWindow called twice.
In electron_api_web_contents.cc:4555gin::Handle<WebContents> WebContents::CreateFromWebPreferences it will read from (web_preferences.GetHidden("webContents", &web_contents) to use the existing webContents object instead of constructing a new one with parameters. @codebytere
I'm not sure if this logic can be tampered with, this bug is not specifically related to OSR. Many things was decided at the constructor of WebContents, update the preference later doesn't change that. If possible, we may invalidating webContents cache when these settings changed, but I don't even know if this is a "caching" logic.
Activity
benoitlahoz commentedon Apr 29, 2025
Update: tested with v36.0.0, with same results.
nikwen commentedon Apr 29, 2025
Thanks for reporting!
Unfortunately, the Electron team is small and does not have the capacity to work with testcases with third-party dependencies (e.g. Vue). For one of us to be able to take a look, could you please publish a vanilla JS testcase gist with Electron Fiddle? (If you run into problems with publishing gists, it's usually related to authentication. Try removing the GitHub auth token and creating a new one.)
Applying the
blocked/need-reprolabel until this is resolved. Thanks!electron-issue-triage commentedon Apr 29, 2025
Hello @benoitlahoz. 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-reproNeeds a test case to reproduce the bug
label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.
benoitlahoz commentedon Apr 29, 2025
Thank you for your message @nikwen.
I reproduced the issue in Fiddle, here is the gist: https://gist.github.com/benoitlahoz/2b61d73397e1db0e7fa51873757f312d
It's the first time I do it, I hope everything is OK.
I can also create a repo from the Fiddle output (very powerful indeed).
Thank you.
nikwen commentedon Apr 29, 2025
Thanks!
You might be running into #32001, which was addressed on macOS in #46615.
Can you check if the latest v35 or v36 builds fix the issue on macOS?
benoitlahoz commentedon Apr 29, 2025
Thank you.
I tested on v36 with same problem.
I went to the issues you mention, but it really looks like the 'offscreen' option object is not handled in this case.
I may miss something though 🙃🤨
nikwen commentedon Apr 29, 2025
Thanks for testing! That's helpful info. (Sorry for asking again after you had already specified that earlier.)
codebytere commentedon May 1, 2025
@reitowo would you be able to take a look?
reitowo commentedon May 2, 2025
I found paint event also doesn't work, even without sharedTexture enabled. By tracing, I found WebContents::WebContents was called only once (where the offscreen was considered), while BrowserWindow called twice.
In
electron_api_web_contents.cc:4555gin::Handle<WebContents> WebContents::CreateFromWebPreferencesit will read from(web_preferences.GetHidden("webContents", &web_contents)to use the existingwebContentsobject instead of constructing a new one with parameters. @codebytereI'm not sure if this logic can be tampered with, this bug is not specifically related to OSR. Many things was decided at the constructor of
WebContents, update the preference later doesn't change that. If possible, we may invalidatingwebContentscache when these settings changed, but I don't even know if this is a "caching" logic.benoitlahoz commentedon Jul 9, 2025
Any news on this one @reitowo ?
reitowo commentedon Aug 5, 2025
Should be resolved by the referencing PR.
codebytere commentedon Aug 5, 2025
Closed in #47868