Source code

Revision control

Other Tools

1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
#include "nsISupports.idl"
6
7
/**
8
* nsIClassOfService.idl
9
*
10
* Used to express class dependencies and characteristics - complimentary to
11
* nsISupportsPriority which is used to express weight
12
*
13
* Channels that implement this interface may make use of this
14
* information in different ways.
15
*/
16
17
[scriptable, uuid(1ccb58ec-5e07-4cf9-a30d-ac5490d23b41)]
18
interface nsIClassOfService : nsISupports
19
{
20
attribute unsigned long classFlags;
21
22
void clearClassFlags(in unsigned long flags);
23
void addClassFlags(in unsigned long flags);
24
25
// All these flags have a (de)prioritization effect.
26
27
// In the HTTP/1 world the priority is considered for all requests inside a so
28
// called 'Request Context' which is a context common to all sub-resources
29
// belonging to a single top level window (RequestContextService). Requests
30
// marked with the Leader flag are blocking (preventing from being sent to the
31
// server) all other resource loads except those marked with the Unblocked
32
// flag. Other classes run in parallel - neither being blocked nor blocking.
33
// The Leader flag is used only for <head> blocking resources (sync and
34
// defer javascript resources and stylesheets.) Purpose is to deliver these
35
// first-paint and domcontentloaded blocking resources as soon as possbile.
36
37
// In the HTTP/2 world it's different. Priorities are done only per HTTP/2
38
// session, normally we have one session per one origin (including origin
39
// attributes!) Requests are dispatched (sent) immediately on an HTTP/2
40
// session. Each session has artificial streams (groups) relating to the class
41
// of service flags (Leader, Other, Background, Speculative, Follower,
42
// UrgentStart), each such a stream is given a different weight (only way to
43
// give a stream a priority in HTTP/2) reflecting the desired request group
44
// priority. Actual request streams are then dependent on these artificial
45
// streams (groups). nsISupportsPriority of each request is passed as a weight
46
// on the HTTP/2 stream to prioritize streams in the same group. A stream can
47
// also be dependent on other stream. We have dependency of Followers on
48
// Leaders, hence everything set the Follower flag should be processed by the
49
// server after Leaders. Same for Speculative being dependent on Background. The
50
// tree is created and used here:
53
// For detailed description of how HTTP/2 server should handle the priorities
54
// and dependencies see:
56
// Please note that the dependecies and weights we are sending to the server
57
// are only suggestions, the server may completely ignore it.
58
59
// Leaders (should) block all other resources except Unblocked. This flag
60
// also priortizes HTTP cache reading queue by blocking all other cache
61
// requests.
62
const unsigned long Leader = 1 << 0;
63
// The Follower flag is currently unused!
64
const unsigned long Follower = 1 << 1;
65
// The Speculative flag is currently unused!
66
const unsigned long Speculative = 1 << 2;
67
// The Background flag is currently only used for Beacon.
68
const unsigned long Background = 1 << 3;
69
// Requests marked with this flag are not blocked by Leaders. This is mainly
70
// used for probing-like XMLHttpRequests that may block delivery of head
71
// blocking resources, e.g. CSS files tailored for the UA.
72
const unsigned long Unblocked = 1 << 4;
73
// Throttleable flag allows response throttling of the resource load. Note
74
// that this functionality is currently disabled.
75
const unsigned long Throttleable = 1 << 5;
76
// UrgentStart makes the request temporarily extend HTTP/1 connection
77
// parallelism limits. Used mainly for navigational requests (top level html)
78
// and any request considered coming from a user interaction to make reaction
79
// of the browser as fast as possible and not blocked.
80
const unsigned long UrgentStart = 1 << 6;
81
// Specifically disables throttling under any circumstances, used for media
82
// responses mainly.
83
const unsigned long DontThrottle = 1 << 7;
84
// Enforce tailing on this load; any of Leader, Unblocked, UrgentStart,
85
// TailForbidden overrule this flag (disable tailing.)
86
const unsigned long Tail = 1 << 8;
87
// Tailing may be engaged regardless if the load is marked Unblocked when some
88
// other conditions are met later, like when the load is found to be a
89
// tracker.
90
const unsigned long TailAllowed = 1 << 9;
91
// Tailing not allowed under any circumstances or combination of flags.
92
const unsigned long TailForbidden = 1 << 10;
93
};