1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include
"nsISupports.idl"
12 class ChannelDiverterChild
;
17 [ptr] native ChannelDiverterChild
(mozilla
::net
::ChannelDiverterChild
);
19 interface nsIStreamListener
;
22 * A channel implementing this interface allows diverting from an
23 * nsIStreamListener in the child process to one in the parent.
25 [uuid(4430e0d0
-ff70
-45f5
-99dc
-b5fd06943fc1
)]
26 interface nsIDivertableChannel
: nsISupports
30 * Called by Necko client in child process during OnStartRequest to divert
31 * nsIStreamListener and nsIRequest callbacks to the parent process.
33 * The process should look like the following:
35 * 1) divertToParent is called in the child process. It can only be called
36 * during OnStartRequest().
38 * 2) The ChannelDiverterChild that is returned is an IPDL object. It should
39 * be passed via some other IPDL method of the client's choosing to the
40 * parent. On the parent the ChannelDiverterParent's divertTo() function
41 * should be called with an nsIStreamListener that will then receive the
42 * OnStartRequest/OnDataAvailable/OnStopRequest for the channel. The
43 * ChannelDiverterParent can then be deleted (which will also destroy the
44 * ChannelDiverterChild in the child).
46 * After divertToParent() has been called, NO further function calls
47 * should be made on the channel. It is a dead object for all purposes.
48 * The reference that the channel holds to the listener in the child is
49 * released is once OnStartRequest completes, and no other
50 * nsIStreamListener calls (OnDataAvailable, OnStopRequest) will be made
53 * @return ChannelDiverterChild IPDL actor to be passed to parent process by
54 * client IPDL message, e.g. PClient.DivertUsing(PDiverterChild).
56 * @throws exception if the channel was canceled early. Throws status code of
59 ChannelDiverterChild divertToParent
();