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