-
Notifications
You must be signed in to change notification settings - Fork 0
Developer tools student project
Background information: Firefox supports remote developer tools - ie. communicating with an arbitrary server that implements a protocol for exposing information about web content. Servo implements a very basic developer tools server that currently supports executing JS remotely and investigating the DOM tree in the document inspector. We want to expand these capabilities by allowing remote modification of the DOM tree, better JS console integration (exposing historical and real-time exceptions), and enabling server->client messages that are not responses to client->server messages.
Initial step: Build Servo, run it on a webpage with the --devtools
argument, connect to it from a recent version of Firefox (see docs about configuring Firefox for this), and experiment with the document inspector and web consoles. Quit Servo and note that it hangs; fix this by sending a ServerExitMsg
in constellation.rs
inside handle_exit
(look at the members of Constellation
to find the proper channel for communicating with the devtools). In addition, store a list of accepted connections in the main devtools server code (look for the code that spawns a task to handle the new stream), and close all of the connections right before exiting. Rebuild, run the devtools server and connect to it again, then watch it quit successfully.
- Make the constellation send the devtools server the
ServerExitMsg
on shutdown - Make the main devtools loop in
devtools/lib.rs
store a vector of all accepted connection streams. Before exiting, iterate over the connections and close them. - Move all devtools-related event handling from script_task.rs into a separate devtools.rs
- Implement the
modifyAttributes
client->server message that updates the attribute names and values for a DOM node (add a handler in the devtools inspector actor; make it send a message to the script task; have the script task handle it appropriately) - Make
Console::Log
cause a message to be sent to the devtools server. This will require finding the window that owns the console object, and using its page to send a message on the devtools channel. - Make the
getCachedMessages
message synchronously fetch (nonexistent) cached messages from the script task - Create a new JS error reporter that logs the error (e.g.) and notifies the script task about the error (use
JS_GetGlobalObject
andglobal_object_for_js_object
to get access to the rightWindow
to reach the script task) - Make the script task recognize when to buffer messages and when to send them directly to devtools (use the
startListeners
/stopListeners
messages from Firefox to trigger this behaviour) - Add support for separated client reading and writing - create a hashtable of pipeline IDs to actor names, and store a clone of the TCPStream in the console actor
- Implement the
consoleAPICall
message from server->client when a JS error is reported from the script task. When a message arrives with a pipeline ID, find the tab actor in the hashtable, get the console actor, and have it send a message to the client with the error details.