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

Proposal: Allow specifying frameId for devtools.inspectedWindow.eval api #389

Open
scurker opened this issue May 10, 2023 · 1 comment
Open
Labels
proposal Proposal for a change or new feature supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari

Comments

@scurker
Copy link

scurker commented May 10, 2023

Background

We recently ran into a limitation with the devtools.inspectedWindow.eval api where we need to target specific frames in order to send a inspect command within context of the devtools api to inspect a specific element. This works in most cases as we are able to specify a unique url to target the frame:

browser.devtools.inspectedWindow.eval(`inspect(document.querySelector("${selector}"))`, {
  frameURL: targetFrameURL,
  useContentScriptContext: true
})

However, we ran into a limitation where there are identical frames with the same url within context of the page, and have no way to uniquely send commands to distinct frames with identical urls with this api. Normally, we utilize browser.tabs.sendMessage with specifying the frameId of the desired frame, but we need access to the devtools api in order to call inspect.

Proposal

Similar to browser.tabs.sendMessage, browser.devtools.inspectedWindow.eval should support specifying frameId in order to target distinct frames without relying on the frame url:

browser.devtools.inspectedWindow.eval(`...`, {
  frameId: targetFrameId,
  useContentScriptContext: true
})
@bershanskiy
Copy link
Member

Also same goes for documentId (which is a stronger way of targeting a context: the same frame hosting the same document).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal Proposal for a change or new feature supportive: chrome Supportive from Chrome supportive: firefox Supportive from Firefox supportive: safari Supportive from Safari
Projects
None yet
Development

No branches or pull requests

4 participants