mozilla / web-ext

A command line tool to help build, run, and test web extensions
Mozilla Public License 2.0
2.67k stars 334 forks source link

feat: allow port option when run with target chromium #3188

Open dever23b opened 2 months ago

dever23b commented 2 months ago

This suggestion allows us to create a dependable debug workflow to attach an IDE to the browser that gets spawned with the run command.

By default, the underlying chrome-launcher flow will choose a random debugging port when launching the browser. This is not ideal for those of us hoping to attach our IDE/other debugging tool to the browser. Ideally, we launch the browser with a predictable port that we can configure into our debugging flow. The underlying chrome-launcher actually already supports this; however, web-ext does not currently provide any way to pass the required option through. This PR bridges that gap.

dever23b commented 2 months ago

Oh, I apologize-- I got ahead of myself and failed to check that other PR. I see your concern regarding a potential to attach to an instance that doesn't have the extension loaded. Good thinking!

I can try to work on a mitigation for that. Since I haven't gotten started yet, I don't know if what I'm asking for might be more effort than it's worth to write, but are you hard set on aborting if the port is in use? I'm wondering if it would be permissible to attach to an existing instance on that port, if I could find a way to verify that the existing instance was launched with the same --load-extension parameter.

dever23b commented 1 month ago

Alright, sorry for the abundance of commits. I didn't realize that this PR would cause everything to automatically sync from my fork.

I believe the current state meets your stated concerns, @Rob--W. Would you mind giving this another review?