1. Introduction
This section is informative.
2. Model
A trial#trialReferenced in:2. Model2.2. The meta element3. Integration with HTML is something that can be enabled or disabled.
define trial and other terminology better.
A trial token#trial-tokenReferenced in:2. Model2.1. The Origin-Trial HTTP Response Header Field2.2. The meta element3. Integration with HTML (2)3.1. Initialize a Document's trial token list3.2. Initialize a WorkerGlobalScope's trial token list is a string in a user agent defined format. A trial token is somehow associated with a trial.
2.1. The Origin-Trial HTTP Response Header Field
The Origin-Trial#origin-trialReferenced in:2.1. The Origin-Trial HTTP Response Header Field (2)3.1. Initialize a Document's trial token list3.2. Initialize a WorkerGlobalScope's trial token list HTTP response header field can be used to deliver trial tokens from a server to a client. The header’s value is represented by the following ABNF:
Origin-Trial = 1#serialized-trial-token
serialized-trial-token#grammardef-serialized-trial-tokenReferenced in:2.1. The Origin-Trial HTTP Response Header Field3.1. Initialize a Document's trial token list3.2. Initialize a WorkerGlobalScope's trial token list = token | quoted-string
Origin-Trial: some-token, some|other|token Origin-Trial: yet_another_token
When the user agent receives a Origin-Trial header field, it MUST process it as described in §3 Integration with HTML.
2.2. The meta element
A Document may specify trial tokens via one or more HTML meta elements whose http-equiv attributes are an ASCII case-insensitive match for the string "Origin-Trial". For example:
Authors are strongly encouraged to place meta elements as early in the dcument as
possible, because tokens in meta elements are not taken into account for content which precedes
them. In particular, note that script executed before the meta element will not have access
to trials enabled by tokens in the meta element.
Another option would be to not process meta elements that occur after the first script tag. But that won’t be enough, since link can allow script execution via its load and error events as well, as one example of another way to execute javascript.
Note: Modifications to a meta element after the element has been parsed will be ignored.
3. Integration with HTML
The Document and WorkerGlobalScope objects have a trial token list#trial-token-listReferenced in:3. Integration with HTML3.1. Initialize a Document's trial token list (2) (3)3.2. Initialize a WorkerGlobalScope's trial token list (2) (3) (4) (5) (6) (7)3.3. Processing of a meta tag, which holds
all the trial tokens which are active fo a given context. This list is empty unless otherwise
specified.
A trial trial is enabled in a specific context if any of the trial tokens in context’s trial token list is associated with trial.
3.1. Initialize a Document's trial token list
This algorithm should be executed during the initialising a new Document object algorithm.
Given a Document (document) and a response (response), the user
agent performs the following steps in order to initialize document’s trial token
list:
-
If response’s url’s scheme is a local scheme:
this is about blob URLs, about:blank, and similar. We should define what to do here. It might make sense to inherit tokens from the creating document, similar to how CSP policies etc are inherited.
-
For each serialized-trial-token serializedToken resulting from parsing the Origin-Trial headers in response’s header list:
-
Add the trial token represented by serializedToken to document’s trial token list.
-
3.2. Initialize a WorkerGlobalScope's trial token list
This algorithm shuold be executed as part of the run a worker algorithm.
Given a WorkerGlobalScope (global), response (response) and
possible WorkerGlobalScope parentWorker the user agent performs the
following steps in order to initialize global’s trial token list:
-
If global is a
DedicatedWorkerGlobalScopeinstance:-
If global has a parentWorker, set global’s trial token list to a copy of parentWorker’s trial token list.
-
Else set global’s trial token list to a copy of global’s responsible document’s trial token list.
-
-
Else:
-
For each serialized-trial-token serializedToken resulting from parsing the Origin-Trial headers in response’s header list:
-
Add the trial token represented by serializedToken to global’s trial token list.
-
-
does this need special handling for about:blank, blob: urls etc?
3.3. Processing of a meta tag
When a meta element is inserted into a document, if its http-equiv attribute
is present and represents a Origin-Trial, the user agent must run the following algorithm:
-
If the
metaelement is not a child of aheadelement, abort these steps. -
If the
metaelement has nocontentattribute, abort these steps. -
If the
metaelement was created by script, abort these step.need to define what "created by script" means, and what is/isn’t supported
-
Add the value of the
contentattribute to theDocument's trial token list.
