Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* vim: set sw=2 ts=8 et tw=80 ft=cpp : */
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
5
* License, v. 2.0. If a copy of the MPL was not distributed with this
6
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
8
include protocol PNecko;
9
include protocol PStreamFilter;
10
include InputStreamParams;
11
include URIParams;
12
include PBackgroundSharedTypes;
13
include NeckoChannelParams;
14
include IPCServiceWorkerDescriptor;
15
include IPCStream;
16
17
include "mozilla/net/NeckoMessageUtils.h";
18
19
using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
20
using mozilla::net::NetAddr from "mozilla/net/DNS.h";
21
using struct mozilla::net::ResourceTimingStruct from "mozilla/net/TimingStruct.h";
22
using refcounted class nsIReferrerInfo from "mozilla/dom/ReferrerInfoUtils.h";
23
24
namespace mozilla {
25
namespace net {
26
27
//-------------------------------------------------------------------
28
refcounted protocol PHttpChannel
29
{
30
manager PNecko;
31
32
parent:
33
// Note: channels are opened during construction, so no open method here:
34
// see PNecko.ipdl
35
36
async SetClassOfService(uint32_t cos);
37
38
async SetCacheTokenCachedCharset(nsCString charset);
39
40
async Suspend();
41
async Resume();
42
43
async Cancel(nsresult status);
44
45
// Reports approval/veto of redirect by child process redirect observers
46
async Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
47
uint32_t sourceRequestBlockingReason,
48
ChildLoadInfoForwarderArgs targetLoadInfoForwarder,
49
uint32_t loadFlags, nsIReferrerInfo referrerInfo,
50
URIParams? apiRedirectTo,
51
CorsPreflightArgs? corsPreflightArgs,
52
bool chooseAppcache);
53
54
// For document loads we keep this protocol open after child's
55
// OnStopRequest, and send this msg (instead of __delete__) to allow
56
// partial cleanup on parent.
57
async DocumentChannelCleanup(bool clearCacheEntry);
58
59
// This might have to be sync. If this fails we must fail the document load
60
// to avoid endless loop.
61
//
62
// Explanation: the document loaded was loaded from the offline cache. But
63
// the cache group id (the manifest URL) of the cache group it was loaded
64
// from is different then the manifest the document refers to in the html
65
// tag. If we detect this during the cache selection algorithm, we must not
66
// load this document from the offline cache group it was just loaded from.
67
// Marking the cache entry as foreign in its cache group will prevent
68
// the document to load from the bad offline cache group. After it is marked,
69
// we reload the document to take the effect. If we fail to mark the entry
70
// as foreign, we will end up in the same situation and reload again and
71
// again, indefinitely.
72
async MarkOfflineCacheEntryAsForeign();
73
74
// Divert OnDataAvailable to the parent.
75
async DivertOnDataAvailable(nsCString data,
76
uint64_t offset,
77
uint32_t count);
78
79
// Divert OnStopRequest to the parent.
80
async DivertOnStopRequest(nsresult statusCode);
81
82
// Child has no more events/messages to divert to the parent.
83
async DivertComplete();
84
85
// Child has detected a CORS check failure, so needs to tell the parent
86
// to remove any matching entry from the CORS preflight cache.
87
async RemoveCorsPreflightCacheEntry(URIParams uri,
88
PrincipalInfo requestingPrincipal);
89
90
// After receiving this message, the parent calls SendDeleteSelf, and makes
91
// sure not to send any more messages after that.
92
async DeletingChannel();
93
94
// Called to get the input stream when altData was delivered.
95
async OpenOriginalCacheInputStream();
96
97
// Called to get the input stream when altData is available.
98
async OpenAltDataCacheInputStream(nsCString aType);
99
100
// Tell the parent the amount bytes read by child for the e10s back pressure
101
// flow control
102
async BytesRead(int32_t count);
103
104
async __delete__();
105
106
child:
107
async OnStartRequest(nsresult channelStatus,
108
nsHttpResponseHead responseHead,
109
bool useResponseHead,
110
nsHttpHeaderArray requestHeaders,
111
ParentLoadInfoForwarderArgs loadInfoForwarder,
112
bool isFromCache,
113
bool isRacing,
114
bool cacheEntryAvailable,
115
uint64_t cacheEntryId,
116
int32_t cacheFetchCount,
117
uint32_t cacheExpirationTime,
118
nsCString cachedCharset,
119
nsCString securityInfoSerialization,
120
NetAddr selfAddr,
121
NetAddr peerAddr,
122
int16_t redirectCount,
123
uint32_t cacheKey,
124
nsCString altDataType,
125
int64_t altDataLength,
126
bool deliveringAltData,
127
bool applyConversion,
128
bool isResolvedByTRR,
129
ResourceTimingStruct timing,
130
bool allRedirectsSameOrigin);
131
132
// Used to cancel child channel if we hit errors during creating and
133
// AsyncOpen of nsHttpChannel on the parent.
134
async FailedAsyncOpen(nsresult status);
135
136
// Called to initiate content channel redirect, starts talking to sinks
137
// on the content process and reports result via Redirect2Verify above
138
async Redirect1Begin(uint32_t registrarId,
139
URIParams newOriginalUri,
140
uint32_t newLoadFlags,
141
uint32_t redirectFlags,
142
ParentLoadInfoForwarderArgs loadInfoForwarder,
143
nsHttpResponseHead responseHead,
144
nsCString securityInfoSerialization,
145
uint64_t channelId,
146
NetAddr oldPeerAddr,
147
ResourceTimingStruct timing);
148
149
// Called if redirect successful so that child can complete setup.
150
async Redirect3Complete();
151
152
// Associate the child with an application ids
153
async AssociateApplicationCache(nsCString groupID,
154
nsCString clientID);
155
156
// Report a security message to the console associated with this
157
// channel.
158
async ReportSecurityMessage(nsString messageTag, nsString messageCategory);
159
160
// This message is sent to a child that has been redirected to another process.
161
// As a consequence, it should cleanup the channel listeners and remove the
162
// request from the loadGroup.
163
async CancelRedirected();
164
165
// Tell child to delete channel (all IPDL deletes must be done from child to
166
// avoid races: see bug 591708).
167
async DeleteSelf();
168
169
// Tell the child to issue a deprecation warning.
170
async IssueDeprecationWarning(uint32_t warning, bool asError);
171
172
// When CORS blocks the request in the parent process, it doesn't have the
173
// correct window ID, so send the message to the child for logging to the web
174
// console.
175
async LogBlockedCORSRequest(nsString message, nsCString category);
176
177
async LogMimeTypeMismatch(nsCString messageName,
178
bool warning,
179
nsString url,
180
nsString contentType);
181
182
async AttachStreamFilter(Endpoint<PStreamFilterParent> aEndpoint);
183
184
// See ADivertableParentChannel::CancelDiversion
185
async CancelDiversion();
186
187
async OriginalCacheInputStreamAvailable(IPCStream? stream);
188
189
async AltDataCacheInputStreamAvailable(IPCStream? stream);
190
191
both:
192
// After receiving this message, the parent also calls
193
// SendFinishInterceptedRedirect, and makes sure not to send any more messages
194
// after that. When receiving this message, the child will call
195
// Send__delete__() and complete the steps required to finish the redirect.
196
async FinishInterceptedRedirect();
197
198
async SetPriority(int16_t priority);
199
};
200
201
202
} // namespace net
203
} // namespace mozilla