sokolovstas / SublimeWebInspector

Web Inspector allow you debug Javascript right in the editor
http://sokolovstas.github.com/SublimeWebInspector
MIT License
2.35k stars 93 forks source link

Support for Firefox? #116

Open gc-alexlong opened 8 years ago

gc-alexlong commented 8 years ago

I notice that Firefox will handle JavaScript errors differently than Chrome sometimes. I was wondering if adding support for Firefox as a browser debugging option would be possible. I tried opening Firefox, enabling remote debugging in its developer settings, then listened on port 9222. Then in Sublime Text, I run command for Web Inspector. Firefox prompts me to allow the connection, but that's as far as I get. After clicking "ok", Web Inspector doesn't recognize/connect to Firefox. I would like it if Web Inspector could also work with Firefox.

danmoseley commented 8 years ago

If Firefox supports the protocol, it could likely be done. We already have a similar issue for Edge: https://github.com/sokolovstas/SublimeWebInspector/issues/93.

From experience (working on the Visual Studio tools that speak the Chrome protocol), all the protocol providers have their own little quirks. Even between versions of the same browser. So it would need a little debugging and tweaking of the code.

Interested in giving it a shot? I'd take PR's.

gc-alexlong commented 8 years ago

I tried researching it but feel a bit over my head. I'll continue reading up on it.

danmoseley commented 8 years ago

The essence of the work would be 1) Hook up a debugger (the Visual Studio Python debugger seems to be the best -- I put instructions in https://github.com/sokolovstas/SublimeWebInspector/issues/113 -- and set debug mode and/or web socket tracing 2) Attempt to connect, look for obvious issues such as garbage response, exceptions thrown, etc 3) Make a change to SWI to accommodate Firefox without breaking Chrome eg handle the different message parameter. This may need a) Do the same against Chrome and compare the traffic, or b) Trace Firefox running against itself, which clearly works, and compare the traffic 4) Repeat 5) Before finishing, make sure Chrome still works.

danmoseley commented 8 years ago

If you do this, you've added a major feature that a lot of people would find interesting, and most of the work is in the setup, figuring out how to trace etc.