Source code

Revision control

Other Tools

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/. */
6
7
#include "nsISupports.idl"
8
9
%{C++
10
namespace mozilla {
11
namespace net {
12
class ChannelDiverterChild;
13
}
14
}
15
%}
16
17
[ptr] native ChannelDiverterChild(mozilla::net::ChannelDiverterChild);
18
19
interface nsIStreamListener;
20
21
/**
22
* A channel implementing this interface allows diverting from an
23
* nsIStreamListener in the child process to one in the parent.
24
*/
25
[uuid(7a9bf52d-f828-4b31-b8df-b40fdd37d007)]
26
interface nsIDivertableChannel : nsISupports
27
{
28
/**
29
* CHILD ONLY.
30
* Called by Necko client in child process during OnStartRequest to divert
31
* nsIStreamListener and nsIRequest callbacks to the parent process.
32
*
33
* The process should look like the following:
34
*
35
* 1) divertToParent is called in the child process. It can only be called
36
* during OnStartRequest().
37
*
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).
45
*
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
51
* to it.
52
*
53
* @return ChannelDiverterChild IPDL actor to be passed to parent process by
54
* client IPDL message, e.g. PClient.DivertUsing(PDiverterChild).
55
*
56
* @throws exception if the channel was canceled early. Throws status code of
57
* canceled channel.
58
*/
59
ChannelDiverterChild divertToParent();
60
61
/**
62
* nsUnknownDecoder delays calling OnStartRequest until it gets enough data
63
* to decide about the content type (until OnDataAvaiable is called). In a
64
* OnStartRequest DivertToParent can be called but some OnDataAvailables are
65
* already called and therefore can not be diverted to parent.
66
*
67
* nsUnknownDecoder will call UnknownDecoderInvolvedKeepData in its
68
* OnStartRequest function and when it calls OnStartRequest of the next
69
* listener it will call UnknownDecoderInvolvedOnStartRequestCalled. In this
70
* function Child process will decide to discarge data if it is not diverting
71
* to parent or keep them if it is diverting to parent.
72
*/
73
void unknownDecoderInvolvedKeepData();
74
75
void unknownDecoderInvolvedOnStartRequestCalled();
76
77
readonly attribute bool divertingToParent;
78
};