Name Description Size
child-transport.js A transport for the debugging protocol that uses nsIMessageManagers to exchange packets with servers running in child processes. In the parent process, |mm| should be the nsIMessageSender for the child process. In a child process, |mm| should be the child process message manager, which sends packets to the parent. |prefix| is a string included in the message names, to distinguish multiple servers running in the same child process. This transport exchanges messages named 'debug:<prefix>:packet', where <prefix> is |prefix|, whose data is the protocol packet. 3883
js-window-actor-transport.js DevTools transport relying on JS Window Actors. This is an experimental transport. It is only used when using the JS Window Actor based frame connector. In that case this transport will be used to communicate between the DevToolsServer living in the parent process and the DevToolsServer living in the process of the target frame. This is intended to be a replacement for child-transport.js which is a message-manager based transport. 1748
local-transport.js An adapter that handles data transfers between the devtools client and server when they both run in the same process. It presents the same API as DebuggerTransport, but instead of transmitting serialized messages across a connection it merely calls the packet dispatcher of the other side. @param other LocalDebuggerTransport The other endpoint for this debugger connection. @see DebuggerTransport 6260 575
packets.js Packets contain read / write functionality for the different packet types supported by the debugging protocol, so that a transport can focus on delivery and queue management without worrying too much about the specific packet types. They are intended to be "one use only", so a new packet should be instantiated for each incoming or outgoing packet. A complete Packet type should expose at least the following: * read(stream, scriptableStream) Called when the input stream has data to read * write(stream) Called when the output stream is ready to write * get done() Returns true once the packet is done being read / written * destroy() Called to clean up at the end of use 12245
stream-utils.js This helper function (and its companion object) are used by bulk senders and receivers to read and write data in and out of other streams. Functions that make use of this tool are passed to callers when it is time to read or write bulk data. It is highly recommended to use these copier functions instead of the stream directly because the copier enforces the agreed upon length. Since bulk mode reuses an existing stream, the sender and receiver must write and read exactly the agreed upon amount of data, or else the entire transport will be left in a invalid state. Additionally, other methods of stream copying (such as NetUtil.asyncCopy) close the streams involved, which would terminate the debugging transport, and so it is avoided here. Overall, this *works*, but clearly the optimal solution would be able to just use the streams directly. If it were possible to fully implement nsIInputStream / nsIOutputStream in JS, wrapper streams could be created to enforce the length and avoid closing, and consumers could use familiar stream utilities like NetUtil.asyncCopy. The function takes two async streams and copies a precise number of bytes from one to the other. Copying begins immediately, but may complete at some future time depending on data size. Use the returned promise to know when it's complete. @param input nsIAsyncInputStream The stream to copy from. @param output nsIAsyncOutputStream The stream to copy to. @param length Integer The amount of data that needs to be copied. @return Promise The promise is resolved when copying completes or rejected if any (unexpected) errors occur. 8208
tests 1
transport.js An adapter that handles data transfers between the devtools client and server. It can work with both nsIPipe and nsIServerSocket transports so long as the properly created input and output streams are specified. (However, for intra-process connections, LocalDebuggerTransport, below, is more efficient than using an nsIPipe pair with DebuggerTransport.) @param input nsIAsyncInputStream The input stream. @param output nsIAsyncOutputStream The output stream. Given a DebuggerTransport instance dt: 1) Set dt.hooks to a packet handler object (described below). 2) Call dt.ready() to begin watching for input packets. 3) Call dt.send() / dt.startBulkSend() to send packets. 4) Call dt.close() to close the connection, and disengage from the event loop. A packet handler is an object with the following methods: - onPacket(packet) - called when we have received a complete packet. |packet| is the parsed form of the packet --- a JavaScript value, not a JSON-syntax string. - onBulkPacket(packet) - called when we have switched to bulk packet receiving mode. |packet| is an object containing: * actor: Name of actor that will receive the packet * type: Name of actor's method that should be called on receipt * length: Size of the data to be read * stream: This input stream should only be used directly if you can ensure that you will read exactly |length| bytes and will not close the stream when reading is complete * done: If you use the stream directly (instead of |copyTo| below), you must signal completion by resolving / rejecting this deferred. If it's rejected, the transport will be closed. If an Error is supplied as a rejection value, it will be logged via |dumpn|. If you do use |copyTo|, resolving is taken care of for you when copying completes. * copyTo: A helper function for getting your data out of the stream that meets the stream handling requirements above, and has the following signature: @param output nsIAsyncOutputStream The stream to copy to. @return Promise The promise is resolved when copying completes or rejected if any (unexpected) errors occur. This object also emits "progress" events for each chunk that is copied. See stream-utils.js. - onClosed(reason) - called when the connection is closed. |reason| is an optional nsresult or object, typically passed when the transport is closed due to some error in a underlying stream. See ./packets.js and the Remote Debugging Protocol specification for more details on the format of these packets. 16673
websocket-transport.js 1738
worker-transport.js A transport that uses a WorkerDebugger to send packets from the main thread to a worker thread. 2769