-
Notifications
You must be signed in to change notification settings - Fork 16.3k
fix: BrowserWindow add the same BrowserView #48053
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
base: main
Are you sure you want to change the base?
Conversation
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.
Please add a test for this! Also, could you please open a simple bug report and link it to this PR?
OK |
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
|
||
const ownerWindow = browserView.ownerWindow; | ||
if (ownerWindow && ownerWindow !== this) { | ||
ownerWindow.removeBrowserView(browserView); |
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.
hm, think something might've gotten a little messed up here!
3db2c09
to
21ad54f
Compare
|
if (this._browserViews.includes(browserView)) { | ||
return; | ||
} |
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.
This introduces a breaking change to the z-order of BrowserView
s: Previously, calling addBrowserView
would make the view the top-most view.
This is so useful that it's documented for the successor API.
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.
addBrowserView
did not have this feature originally, so I kept it consistent with the original implementation.
After the BrowserView module was refactored in electron 30, some behaviors changed implicitly, including the 'z-order change' you mentioned.(Refactored implementation)
I think this adjustment should be consistent with the original version. What do you think?
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.
@nikwen strictly speaking we broke it in the above linked PR without documenting a change so it's not a breaking change in this case - i'm fine with potentially breaking it but it should go through a cycle then and we've deprecated BrowserView already so there's not really a point imo
Description of Change
Closes #48057
Fixed addBrowserView to prevent unnecessary removal and re-adding of the same BrowserView.
Checklist
npm test
passesRelease Notes
Notes: Fixed addBrowserView to prevent unnecessary removal and re-adding of the same BrowserView.