Skip to content

Commit e3dad26

Browse files
committed
Limit report delivery per page
1 parent 0889dc1 commit e3dad26

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

index.src.html

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,13 @@ <h3 id="media-type">Media Type</h3>
639639
The media type used when POSTing reports to a specified endpoint is
640640
`application/reports+json`.
641641

642+
<h3 id="report-count">Report Count</h3>
643+
644+
Each <a>environment settings object</a> has a <dfn>report count</dfn>, which
645+
is a <a spec=infra>map</a> from <a>report type</a> (string) to non-negative
646+
integer. <a>report count</a> is used to track how many <a>reports</a> of
647+
each <a>report type</a> have been generated in the current page.
648+
642649
<h3 id="queue-report" algorithm>
643650
Queue |data| as |type| for |endpoint group| on |settings|
644651
</h3>
@@ -648,7 +655,14 @@ <h3 id="queue-report" algorithm>
648655
optional {{URL}} (|url|), the following algorithm will create a <a>report</a>,
649656
and add it to <a>reporting cache</a>'s queue for future delivery.
650657

651-
1. Let |report| be a new <a>report</a> object with its values initialized as
658+
1. If |settings|'s <a>report count</a> contains an entry
659+
with <a spec=infra>key</a> |type|, then increment that entry. Otherwise,
660+
create an entry in |settings|'s <a>report count</a>
661+
with <a spec=infra>key</a> |type| and <a spec=infra>value</a> 1.
662+
663+
2. If |settings|'s <a>report count</a>[|type|] is greater than 100, return.
664+
665+
3. Let |report| be a new <a>report</a> object with its values initialized as
652666
follows:
653667

654668
: [=report/body=]
@@ -664,22 +678,22 @@ <h3 id="queue-report" algorithm>
664678
: [=report/attempts=]
665679
:: 0
666680

667-
2. If |url| was not provided by the caller, let |url| be |settings|'s
681+
4. If |url| was not provided by the caller, let |url| be |settings|'s
668682
<a>creation URL</a>.
669683

670-
3. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}}
684+
5. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}}
671685
to `null`.
672686

673-
4. Set |report|'s [=report/url=] to the result of executing the <a>URL
687+
6. Set |report|'s [=report/url=] to the result of executing the <a>URL
674688
serializer</a> on |url| with the <em>exclude fragment flag</em> set.
675689

676-
5. Append |report| to the <a>reporting cache</a>.
690+
7. Append |report| to the <a>reporting cache</a>.
677691

678-
6. Let |environment| be |settings|'s <a>realm execution context</a>'s
692+
8. Let |environment| be |settings|'s <a>realm execution context</a>'s
679693
<a spec=ecmascript>realm</a>'s <a spec=ecmascript lt=realm>ECMAScript
680694
global environment</a>.
681695

682-
7. Execute [[#notify-observers]] with |environment| and |report|.
696+
9. Execute [[#notify-observers]] with |environment| and |report|.
683697

684698
Note: <a>reporting observers</a> can only observe reports from the
685699
same <a>environment settings object</a>.

0 commit comments

Comments
 (0)