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
;
16 * A load group maintains a collection of nsIRequest objects.
18 [scriptable
, uuid(afb57ac2
-bce5
-4ee3
-bb34
-385089a9ba5c
)]
19 interface nsILoadGroup
: nsIRequest
22 * The group observer is notified when requests are added to and removed
23 * from this load group. The groupObserver is weak referenced.
25 attribute nsIRequestObserver groupObserver
;
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.
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
36 attribute nsIRequest defaultLoadRequest
;
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.
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
47 void addRequest
(in nsIRequest aRequest
,
48 in nsISupports aContext
);
51 * Removes a request from the group. If this is a foreground request
52 * then the groupObserver's onStopRequest will be called.
54 * By the time this call ends, aRequest will have been removed from the
55 * loadgroup, even if this function throws an exception.
57 void removeRequest
(in nsIRequest aRequest
,
58 in nsISupports aContext
,
62 * Returns the requests contained directly in this group.
63 * Enumerator element type: nsIRequest.
65 readonly attribute nsISimpleEnumerator requests
;
68 * Returns the count of "active" requests (ie. requests without the
69 * LOAD_BACKGROUND bit set).
71 readonly attribute
unsigned long activeCount
;
74 * Notification callbacks for the load group.
76 attribute nsIInterfaceRequestor notificationCallbacks
;
79 * Connection information for managing things like js/css
80 * connection blocking, and per-tab connection grouping
82 readonly attribute nsILoadGroupConnectionInfo connectionInfo
;
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
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.)
95 attribute nsLoadFlags defaultLoadFlags
;
99 // Forward-declare mozilla::net::SpdyPushCache
107 [ptr] native SpdyPushCachePtr
(mozilla
::net
::SpdyPushCache
);
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.
114 [uuid(fdc9659c
-b597
-4ac0
-9c9e
-14b04dbb682f
)]
115 interface nsILoadGroupConnectionInfo
: nsISupports
118 * Number of active blocking transactions associated with this load group
120 readonly attribute
unsigned long blockingTransactionCount
;
123 * Increase the number of active blocking transactions associated
124 * with this load group by one.
126 void addBlockingTransaction
();
129 * Decrease the number of active blocking transactions associated
130 * with this load group by one. The return value is the number of remaining
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
140 [noscript
] attribute SpdyPushCachePtr spdyPushCache
;