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
feat: add WebContents.opener and webContents.fromFrame() #35140
feat: add WebContents.opener and webContents.fromFrame() #35140
Conversation
So if an iframe opens a child window. |
|
I feel like there must be a way to validate that a RFH is controlled by a particular security origin! Perhaps SiteInstance is the way here? I feel like going through |
Is this no longer needed now that we have |
Yeah, let's close unless we find another use case for it. |
Yeah, let's close unless we find another use case for it. |
Isn't my issue that would have been fixed by this a use case? The origin from what I can tell by that PR is just the URL (unless I misinterpreted something). |
Ah yes, sorry about that. I believe the API surface is small enough that there's little risk in introducing it. @nornagon lmk you're thoughts on still merging this to address the linked issue. |
* `frame` WebFrameMain | ||
|
||
Returns `WebContents` | undefined - A WebContents instance with the given WebFrameMain, or | ||
`undefined` if there is no WebContents associated with the given WebFrameMain. |
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... in what situation is there no WebContents for a WebFrameMain?
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.
More accurately, this is for when the WebContents has been destroyed while the frame reference is held around. One of the tests in this PR checks this.
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.
Yeah this seems reasonable in that case. API LGTM
256a199
to
0c7c22a
Compare
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.
API LGTM
Release Notes Persisted
|
I have automatically backported this PR to "21-x-y", please check out #35819 |
Description of Change
closes #24807
Adds the ability to get the window opener of a WebContents.
I'd like to also add
WebFrameMain.opener
, but there's no public API for this in render_frame_host.hChecklist
npm test
passesRelease Notes
Notes:
WebContents.opener
to access window opener.webContents.fromFrame(frame)
to get the WebContents corresponding to a WebFrameMain instance.