Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 : */
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/. */
8 include protocol PNecko;
9 include InputStreamParams;
10 include URIParams;
12 include protocol PBlob; //FIXME: bug #792908
14 include "mozilla/net/NeckoMessageUtils.h";
16 using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
17 using class nsHttpHeaderArray from "nsHttpHeaderArray.h";
18 using class nsHttpResponseHead from "nsHttpResponseHead.h";
19 using struct nsHttpAtom from "nsHttp.h";
20 using mozilla::net::NetAddr from "mozilla/net/DNS.h";
22 namespace mozilla {
23 namespace net {
25 //-------------------------------------------------------------------
26 protocol PHttpChannel
27 {
28 manager PNecko;
30 parent:
31 // Note: channels are opened during construction, so no open method here:
32 // see PNecko.ipdl
34 SetPriority(uint16_t priority);
36 SetCacheTokenCachedCharset(nsCString charset);
38 UpdateAssociatedContentSecurity(int32_t broken,
39 int32_t no);
40 Suspend();
41 Resume();
43 Cancel(nsresult status);
45 // Reports approval/veto of redirect by child process redirect observers
46 Redirect2Verify(nsresult result, RequestHeaderTuples changedHeaders,
47 OptionalURIParams apiRedirectTo);
49 // For document loads we keep this protocol open after child's
50 // OnStopRequest, and send this msg (instead of __delete__) to allow
51 // partial cleanup on parent.
52 DocumentChannelCleanup();
54 // This might have to be sync. If this fails we must fail the document load
55 // to avoid endless loop.
56 //
57 // Explanation: the document loaded was loaded from the offline cache. But
58 // the cache group id (the manifest URL) of the cache group it was loaded
59 // from is different then the manifest the document refers to in the html
60 // tag. If we detect this during the cache selection algorithm, we must not
61 // load this document from the offline cache group it was just loaded from.
62 // Marking the cache entry as foreign in its cache group will prevent
63 // the document to load from the bad offline cache group. After it is marked,
64 // we reload the document to take the effect. If we fail to mark the entry
65 // as foreign, we will end up in the same situation and reload again and
66 // again, indefinitely.
67 MarkOfflineCacheEntryAsForeign();
69 // Divert OnDataAvailable to the parent.
70 DivertOnDataAvailable(nsCString data,
71 uint64_t offset,
72 uint32_t count);
74 // Divert OnStopRequest to the parent.
75 DivertOnStopRequest(nsresult statusCode);
77 // Child has no more events/messages to divert to the parent.
78 DivertComplete();
80 __delete__();
82 child:
83 OnStartRequest(nsresult channelStatus,
84 nsHttpResponseHead responseHead,
85 bool useResponseHead,
86 nsHttpHeaderArray requestHeaders,
87 bool isFromCache,
88 bool cacheEntryAvailable,
89 uint32_t cacheExpirationTime,
90 nsCString cachedCharset,
91 nsCString securityInfoSerialization,
92 NetAddr selfAddr,
93 NetAddr peerAddr,
94 int16_t redirectCount);
96 // Combines a single OnDataAvailable and its associated OnProgress &
97 // OnStatus calls into one IPDL message
98 OnTransportAndData(nsresult channelStatus,
99 nsresult transportStatus,
100 uint64_t progress,
101 uint64_t progressMax,
102 nsCString data,
103 uint64_t offset,
104 uint32_t count);
106 OnStopRequest(nsresult channelStatus);
108 OnProgress(uint64_t progress, uint64_t progressMax);
110 OnStatus(nsresult status);
112 // Used to cancel child channel if we hit errors during creating and
113 // AsyncOpen of nsHttpChannel on the parent.
114 FailedAsyncOpen(nsresult status);
116 // Called to initiate content channel redirect, starts talking to sinks
117 // on the content process and reports result via Redirect2Verify above
118 Redirect1Begin(uint32_t newChannelId,
119 URIParams newUri,
120 uint32_t redirectFlags,
121 nsHttpResponseHead responseHead);
123 // Called if redirect successful so that child can complete setup.
124 Redirect3Complete();
126 // Associte the child with an application ids
127 AssociateApplicationCache(nsCString groupID,
128 nsCString clientID);
130 // Parent has been suspended for diversion; no more events to be enqueued.
131 FlushedForDiversion();
133 // Child should resume processing the ChannelEventQueue, i.e. diverting any
134 // OnDataAvailable and OnStopRequest messages in the queue back to the parent.
135 DivertMessages();
137 // Tell child to delete channel (all IPDL deletes must be done from child to
138 // avoid races: see bug 591708).
139 DeleteSelf();
140 };
143 } // namespace net
144 } // namespace mozilla