这是indexloc提供的服务,不要输入任何密码
Skip to content

feat: webFrameMain.fromFrameToken #47850

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

samuelmaddock
Copy link
Member

@samuelmaddock samuelmaddock commented Jul 21, 2025

Description of Change

Follow up to #47616

Adds webFrameMain.fromFrameToken(processId, frameToken) which should be the defacto method of looking up frames based on the current chromium architecture.

Checklist

Release Notes

Notes: Added webFrameMain.fromFrameToken(processId, frameToken) to get a WebFrameMain instance from its frame token.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Jul 21, 2025
@samuelmaddock samuelmaddock marked this pull request as ready for review July 21, 2025 21:04
@samuelmaddock samuelmaddock added the semver/minor backwards-compatible functionality label Jul 21, 2025
Comment on lines +75 to +76
Returns `WebFrameMain | undefined` - A frame with the given process and frame token,
or `undefined` if there is no WebFrameMain associated with the given IDs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Returns `WebFrameMain | undefined` - A frame with the given process and frame token,
or `undefined` if there is no WebFrameMain associated with the given IDs.
Returns `WebFrameMain | null` - A frame with the given process and frame token,
or `null` if there is no WebFrameMain associated with the given IDs.

Not blocking, but we had some discussion on Slack regarding undefined vs null for these kinds of APIs and I think consensus was heading towards returning null for the not found case.

### `webFrameMain.fromFrameToken(processId, frameToken)`

* `processId` Integer - An `Integer` representing the internal ID of the process which owns the frame.
* `frameToken` string - A `string` representing the unique frame token in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs: i like the additional description we have on the webFrame.findFrameByToken API description:

Frame tokens can be retrieved from WebFrame instances (webFrame.frameToken) and can also be retrieved from WebFrameMain instances using webFrameMain.frameToken.

ref https://github.com/electron/electron/blob/9a979477b339b14d0a9f1dcce5d715e0121037ea/docs/api/web-frame.md#webframefindframebytokenframetoken

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/requested 🗳 new-pr 🌱 PR opened recently semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants