Browser debugging protocols:
Articles etc:
Chrome for Android
- Implements the Remote Debugging Protocol over a WebSocket connection
iOS 6 & Safari Web Inspector
- iOS 6 & Safari seem to communicate via the
ubd
process, which is the Ubiquity daemon. - The port that's consistently listed my machine is 64880.
- This conneciton exists when Safari is active, even when no remote debugging is taking place.
- Another connection seems to be set up when remote debugging another tab.
Opera Mini & Dragonfly
- Opening
opera:debug
on Opera Mini iOS fails, seems to not be implemented. - The Opera Mobile Emulator works.
- Dragonkeeper acts as proxy between a host & client, designed to make developing Dragonfly itself easier.
- Got it to work so I could watch traffic between the emulator and the client. The docs for doing so don't mention that you don't have to have a second instance of Opera, but can use the emulator too.
General
- Found this Remote Debugging talk very useful for understanding where we stand now.
- Discovered the [WebDriver API] and the BTTWG – perhaps any tool that pollyfills the above should conform to this spec.
Dragonfly & Dragonkeeper
- Looked into code to see what Dragonkeeper is doing with data to & from a device.
- Running dragonkeeper with -df gives a pretty-printed output nice output of what's being sent
- http://localhost:8002/services is being hit repeatedly hit until the device returns an xml list of services: http://i.phuu.net/KAX1
Firefox Beta
- Documentation
- An actor in an entity on the server (device) that can interact with the client (debugger) via a JSON protocol.
- The protocol consists of JSON packets:
- Client to server:
{ "to": actor, "type": type, ... }
- Server to client:
{ "from": actor, ... }
- Client to server:
- A grip is a JSON representation of some value on the server
- The nightly Beta release APK for the emulator
adb install [path to above]
adb forward tcp:6000 tcp:6000
- Enable
devtools.debugger.remote-enabled
in client Firefox - Disable
devtools.debugger.force-local
& enabledevtools.debugger.remote-enabled
in FF Beta on the device - Restart all Firefoxes
- Open Tools > Web Developer > Remote Debugging & connect. Click OK on the device.
- If in Nightly, go Tools > W D > Connect
In Firefox, open:
- jar:file:///Applications/FirefoxNightly.app/Contents/MacOS/omni.ja!/
This file manages the connect page:
- jar:file:///Applications/FirefoxNightly.app/Contents/MacOS/omni.ja!/chrome/browser/content/browser/devtools/connect.js
Debug Clients JSM:
- jar:file:///Applications/FirefoxNightly.app/Contents/MacOS/omni.ja!/modules/devtools/dbg-client.jsm
- Websocket client threw errors from the http parser
request('http://localhost:6002').pipe(process.stdout);
also threw
The flow in FF:
connect.js
creates a transport by runningdebuggerSocketConnect
in dgb-client.js- this creates
s
(an nsISocketTransport) using socketTransportService.createTransport - it's passed the default socket type, a hostname and port, returning an instance of nsISocketTransport
- then a
transport
(DebuggerTransport) is created froms.openInputStream
ands.openOutputStream
of the nsISocketTransport, inherited from the nsITransport - the transport is an non-blocking i/o stream handler
- this creates
Connected!
Used node's net
module to open a socket on the 6002 port. It works!