Skip to content
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]: BrowserWindow.fromWebContents does not work with WebContentsView WebContents #42060

Closed
3 tasks done
neobyteUK opened this issue May 7, 2024 · 2 comments
Closed
3 tasks done
Labels

Comments

@neobyteUK
Copy link

Preflight Checklist

Electron Version

30.0.2

What operating system are you using?

Windows

Operating System Version

Windows 10 22H2 19045.2491

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

Calling BrowserWindow.fromWebContents(web) where web is the WebContents of a BrowserView that belongs to a BrowserWindow currently returns the associated BrowserWindow.

As such, I would expect calling BrowserWindow.fromWebContents(web) where web is the WebContents of a WebContentsView that belongs to a BrowserWindow to return the associated BrowserWindow.

Actual Behavior

Calling BrowserWindow.fromWebContents(web) where web is the WebContents of a WebContentsView that belongs to a BrowserWindow does not return the associated BrowserWindow.

Testcase Gist URL

https://gist.github.com/neobyteUK/ea714d9f6493fb2dbcc1870b27eaaf2d

Additional Information

Code is so small to replicate, have also included screenshot.

image

@electron-issue-triage electron-issue-triage bot added the has-repro-gist Issue can be reproduced with code at https://gist.github.com/ label May 7, 2024
@VerteDinde
Copy link
Member

Hey @neobyteUK, I actually think this is expected behavior - we can consider changing this as a feature in the future, but as of right now, I don't think we expect that the BrowserWindow value is returned here

@codebytere
Copy link
Member

Closing in agreement with above - when a WebContents belongs to a WebContentsView, it may or may not be attached to a BrowserWindow. Event when the WebContentsView is attached, its webContents are not strictly owned by the BrowserWindow.

@codebytere codebytere closed this as not planned Won't fix, can't repro, duplicate, stale May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👍 Does Not Block Stable
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

3 participants