Open Bug 1840132 Opened 1 year ago Updated 1 year ago

Implement browser.debugger API to let extensions use WebDriver BiDi

Categories

(WebExtensions :: Developer Tools, enhancement)

enhancement

Tracking

(Not tracked)

People

(Reporter: gregp, Unassigned)

References

Details

(Whiteboard: [design-decision-needed][wecg])

This would be incompatible with the CDP-backed chrome.debugger api, so it should probably be in the browser namespace only.

It would need some limitations, e.g. extensions probably shouldn't be able to use script.evaluate.

We could also have more fine-grained permissions. Maybe putting each module behind its own permission and having specific permissions for receiving events and sending commands. Something like debugger.network/debugger.network.commands

The capabilities of browser and chrome namespaces should be equivalent.

While bug 1316741 already tracks the debugger API, I'm not closing this bug yet because the unique part of it is the request to support WebDriver BiDi, which is the long-term cross-browser protocol for automation.

See Also: → 1316741
See Also: → 1433724

The capabilities of browser and chrome namespaces should be equivalent.

There is precedent for incompatible APIs only being available in the browser namespace
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities#proxy_api

Edit: Actually this documentation might be wrong. I just tested and the proxy api is available in the chrome namespace ?

(In reply to Gregory Pappas [:gregp] from comment #2)

There is precedent for incompatible APIs only being available in the browser namespace
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Chrome_incompatibilities#proxy_api

Edit: Actually this documentation might be wrong. I just tested and the proxy api is available in the chrome namespace ?

That documentation is wrong. I filed https://github.com/mdn/content/issues/27512 to fix it.

Hi Gregory, what do you have in mind with the WebDriver BiDi support? It's not clear to me yet. Note that this protocol is not enabled by default, but needs a specific command line argument to get it working. And we do not want to have it running in day to day profiles but just for automation and testing. Maybe you can shed more details?

Flags: needinfo?(gp3033)

My interpretation is as follows:

  1. Someone wanted the ability to retrieve console log messages in an extension, at bug 1433724.
  2. I mentioned alternatives and that Chrome already supports such functionality through the chrome.debugger extension API that connects through CDP, at https://bugzilla.mozilla.org/show_bug.cgi?id=1433724#c5
  3. You commented that WebDriver BiDi should be used instead of CDP - https://bugzilla.mozilla.org/show_bug.cgi?id=1433724#c6
  4. Now we're here - a feature request to expose the WebDriver BiDi protocol through the browser.debugger protocol (note: browser and chrome are aliases of each other, the namespace of extension APIs).
Whiteboard: [design-decision-needed][wecg]

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #4)

Hi Gregory, what do you have in mind with the WebDriver BiDi support? It's not clear to me yet.

I'm not sure of what you're asking, sorry. Are you asking which WebDriver Bidi functionality would be exposed?

Flags: needinfo?(gp3033)

Oh I would like to know an end-user scenario for what such an API would be helpful. We already imagined that webext can benefit from BiDi but here I'm unclear also security wise.

Gregory, can you please provide a use case, what would this enable an extension to do that's not already possible using the existing devtools APIs?

Flags: needinfo?(gp3033)

What would this enable an extension to do that's not already possible using the existing devtools APIs?

  • Access console logs without a content script (bug 1433724)

Note that the WebDriver BiDi implementation in Firefox is still new, so a lot of functionality that is not possible with the existing devtools APIs will eventually become available in the future as more of the specification gets implemented.

Flags: needinfo?(gp3033)
You need to log in before you can comment on or make changes to this bug.