Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "nsIRequest.idl"
8 interface nsISimpleEnumerator;
9 interface nsIRequestObserver;
10 interface nsIInterfaceRequestor;
11 interface nsILoadGroupConnectionInfo;
13 typedef unsigned long nsLoadFlags;
15 /**
16 * A load group maintains a collection of nsIRequest objects.
17 */
18 [scriptable, uuid(afb57ac2-bce5-4ee3-bb34-385089a9ba5c)]
19 interface nsILoadGroup : nsIRequest
20 {
21 /**
22 * The group observer is notified when requests are added to and removed
23 * from this load group. The groupObserver is weak referenced.
24 */
25 attribute nsIRequestObserver groupObserver;
27 /**
28 * Accesses the default load request for the group. Each time a number
29 * of requests are added to a group, the defaultLoadRequest may be set
30 * to indicate that all of the requests are related to a base request.
31 *
32 * The load group inherits its load flags from the default load request.
33 * If the default load request is NULL, then the group's load flags are
34 * not changed.
35 */
36 attribute nsIRequest defaultLoadRequest;
38 /**
39 * Adds a new request to the group. This will cause the default load
40 * flags to be applied to the request. If this is a foreground
41 * request then the groupObserver's onStartRequest will be called.
42 *
43 * If the request is the default load request or if the default load
44 * request is null, then the load group will inherit its load flags from
45 * the request.
46 */
47 void addRequest(in nsIRequest aRequest,
48 in nsISupports aContext);
50 /**
51 * Removes a request from the group. If this is a foreground request
52 * then the groupObserver's onStopRequest will be called.
53 *
54 * By the time this call ends, aRequest will have been removed from the
55 * loadgroup, even if this function throws an exception.
56 */
57 void removeRequest(in nsIRequest aRequest,
58 in nsISupports aContext,
59 in nsresult aStatus);
61 /**
62 * Returns the requests contained directly in this group.
63 * Enumerator element type: nsIRequest.
64 */
65 readonly attribute nsISimpleEnumerator requests;
67 /**
68 * Returns the count of "active" requests (ie. requests without the
69 * LOAD_BACKGROUND bit set).
70 */
71 readonly attribute unsigned long activeCount;
73 /**
74 * Notification callbacks for the load group.
75 */
76 attribute nsIInterfaceRequestor notificationCallbacks;
78 /**
79 * Connection information for managing things like js/css
80 * connection blocking, and per-tab connection grouping
81 */
82 readonly attribute nsILoadGroupConnectionInfo connectionInfo;
84 /**
85 * The set of load flags that will be added to all new requests added to
86 * this group. Any existing requests in the load group are not modified,
87 * so it is expected these flags will be added before requests are added
88 * to the group - typically via nsIDocShell::defaultLoadFlags on a new
89 * docShell.
90 * Note that these flags are *not* added to the default request for the
91 * load group; it is expected the default request will already have these
92 * flags (again, courtesy of setting nsIDocShell::defaultLoadFlags before
93 * the docShell has created the default request.)
94 */
95 attribute nsLoadFlags defaultLoadFlags;
96 };
98 %{C++
99 // Forward-declare mozilla::net::SpdyPushCache
100 namespace mozilla {
101 namespace net {
102 class SpdyPushCache;
103 }
104 }
105 %}
107 [ptr] native SpdyPushCachePtr(mozilla::net::SpdyPushCache);
109 /**
110 * Used to maintain state about the connections of a load group and
111 * how they interact with blocking items like HEAD css/js loads.
112 */
114 [uuid(fdc9659c-b597-4ac0-9c9e-14b04dbb682f)]
115 interface nsILoadGroupConnectionInfo : nsISupports
116 {
117 /**
118 * Number of active blocking transactions associated with this load group
119 */
120 readonly attribute unsigned long blockingTransactionCount;
122 /**
123 * Increase the number of active blocking transactions associated
124 * with this load group by one.
125 */
126 void addBlockingTransaction();
128 /**
129 * Decrease the number of active blocking transactions associated
130 * with this load group by one. The return value is the number of remaining
131 * blockers.
132 */
133 unsigned long removeBlockingTransaction();
135 /* reading this attribute gives out weak pointers to the push
136 * cache. The nsILoadGroupConnectionInfo implemenation owns the cache
137 * and will destroy it when overwritten or when the load group
138 * ends.
139 */
140 [noscript] attribute SpdyPushCachePtr spdyPushCache;
141 };