Skip to content

Commit

Permalink
Incorporating some of @annevk's feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewest committed Jun 5, 2018
1 parent 6d98667 commit 98f7c12
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 75 deletions.
59 changes: 31 additions & 28 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ A request generated by a <{picture}> element would result in a request containin
HTTP request header:

```
Sec-Metadata: destination=image, site=cross-site, target=subresource
Sec-Metadata: destination="image", site="cross-site"
```

A top-level navigation from `https://example.com` to `https://example.com/` caused by a user's click
on an in-page link would result in a request containing the following HTTP request header:

```
Sec-Metadata: cause=user-activated, destination=document, site=same-origin, target=top-level
Sec-Metadata: cause="user-activated", destination="document", site="same-origin", target="top-level"
```

Framework {#framework}
Expand All @@ -112,10 +112,11 @@ unknown members, and members whose value is invalid.

[=Navigation requests=] will contain a dictionary member whose key is
"<dfn dict-member for="Sec-Metadata">`cause`</dfn>", and whose value is an
<a for="structured header" grammar>`identifier`</a>. Other kinds of requests will not contain a
<a for="structured header" grammar>`string`</a>. Other kinds of requests will not contain a
{{Sec-Metadata/cause}} member.

Valid {{Sec-Metadata/cause}} values are `user-activated` and `forced`.
Valid {{Sec-Metadata/cause}} values are `user-activated` and `forced`, representing whether or not
a given request was [=triggered by user activation=].

<div algorithm="get cause">

Expand All @@ -138,9 +139,8 @@ To <dfn abstract-op local-lt="get cause">obtain the `cause` value</dfn> for a [=
### The `destination` Member ### {#destination-member}

All requests will contain a dictionary member whose key is
"<dfn dict-member for="Sec-Metadata">`destination`</dfn>", and whose value is either an empty
<a for="structured header" grammar>`string`</a>, or an
<a for="structured header" grammar>`identifier`</a> representing the [=request=]'s
"<dfn dict-member for="Sec-Metadata">`destination`</dfn>", and whose value is a
<a for="structured header" grammar>`string`</a> representing the [=request=]'s
[=request/destination=].

Valid {{Sec-Metadata/destination}} values include all valid [=request=] [=request/destination=]
Expand All @@ -158,20 +158,20 @@ values (the empty string, "`audio`", "`audioworklet`", "`document`", "`embed`",
Sec-Metadata: ..., destination="", ...

// `<img>`'s destination is "image"
Sec-Metadata: ..., destination=image, ...
Sec-Metadata: ..., destination="image", ...

// `new Worker()`'s destination is "worker"
Sec-Metadata: ..., destination=worker, ...
Sec-Metadata: ..., destination="worker", ...

// Navigations' destinations are "document"
Sec-Metadata: ..., destination=document, ...
Sec-Metadata: ..., destination="document", ...
</pre>

### The `site` Member ### {#site-member}

All requests will contain a dictionary member whose key is
"<dfn dict-member for="Sec-Metadata">`site`</dfn>", and whose value is an
<a for="structured header" grammar>`identifier`</a> representing the relationship between the
<a for="structured header" grammar>`string`</a> representing the relationship between the
[=request=]'s [=request/origin=] and the [=url/origins=] for the [=URLs=] in the [=request=]'s
[=request/url list=].

Expand All @@ -196,26 +196,29 @@ Valid {{Sec-Metadata/site}} values are `same-origin`, `same-site`, and `cross-si

### The `target` Member ### {#target-member}

All requests will contain a dictionary member whose key is
[=Navigation requests=] will contain a dictionary member whose key is
"<dfn dict-member for="Sec-Metadata">`target`</dfn>", and whose value is an
<a for="structured header" grammar>`identifier`</a> representing the context in which the request
will be used.
<a for="structured header" grammar>`string`</a> representing the context in which the request
will be used. Other kinds of requests will not contain a {{Sec-Metadata/target}} member.

Valid {{Sec-Metadata/target}} values are `top-level`, `nested`, and `subresource`.

<div algorithm="get target">

To <dfn abstract-op local-lt="get target">obtain the `target` value</dfn> for a [=request=] (|r|),
return the value corresponding to the first matching statement below:
run the steps below:

1. If |r| is a [=navigation request=]:

1. If |r|'s [=request/reserved client=] is an [=environment=] whose [=target browsing context=]
is a [=top-level browsing context=], return `top-level`.

: |r|'s [=request/reserved client=] is an [=environment=] whose [=target browsing context=] is a
[=top-level browsing context=]
:: `top-level`
: |r|'s [=request/reserved client=] is an [=environment=] whose [=target browsing context=] is a
[=nested browsing context=]
:: `nested`
: Otherwise
:: `subresource`
2. Assert: |r|'s [=request/reserved client=] is an [=environment=] whose [=target browsing
context=] is a [=nested browsing context=].

3. Return `nested`.

2. Return `null`.

</div>

Expand All @@ -233,20 +236,20 @@ To <dfn abstract-op>set the `Sec-Metadata` header for a request</dfn>, given a [
1. Append an item to |header| whose key is {{Sec-Metadata/cause}}, and whose value is the
result of [$get cause|obtaining the cause value$] for |r|.

2. Append an item to |header| whose key is {{Sec-Metadata/target}}, and whose value is the
result of [$get target|obtaining the target value$] for |r|.

3. Append an item to |header| whose key is {{Sec-Metadata/destination}}, and whose value is the
result of [$get destination|obtaining the destination value$] for |r|.

4. Append an item to |header| whose key is {{Sec-Metadata/site}}, and whose value is the result
of [$get site|obtaining the site value$] for |r|.

5. Append an item to |header| whose key is {{Sec-Metadata/target}}, and whose value is the
result of [$get target|obtaining the target value$] for |r|.

6. Let |value| be the result of serializing |header|.
5. Let |value| be the result of serializing |header|.

ISSUE(httpwg/http-extensions#627): I don't see an actual serialization algorithm in [[!I-D.ietf-httpbis-header-structure]].

7. [=header list/Set=] &#96;<a http-header>`Sec-Metadata`</a>&#96;/|value| in |r|'s [=request/header list=].
6. [=header list/Set=] &#96;<a http-header>`Sec-Metadata`</a>&#96;/|value| in |r|'s [=request/header list=].
</ol>
</div>

Expand Down
Loading

0 comments on commit 98f7c12

Please sign in to comment.