Skip to content

Commit 77f637b

Browse files
committed
Limit report delivery per page
1 parent 6465ac1 commit 77f637b

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
@@ -636,6 +636,13 @@ <h3 id="media-type">Media Type</h3>
636636
The media type used when POSTing reports to a specified endpoint is
637637
`application/reports+json`.
638638

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

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

651665
: [=report/body=]
@@ -661,22 +675,22 @@ <h3 id="queue-report" algorithm>
661675
: [=report/attempts=]
662676
:: 0
663677

664-
2. If |url| was not provided by the caller, let |url| be |settings|'s
678+
4. If |url| was not provided by the caller, let |url| be |settings|'s
665679
<a>creation URL</a>.
666680

667-
3. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}}
681+
5. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}}
668682
to `null`.
669683

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

673-
5. Append |report| to the <a>reporting cache</a>.
687+
7. Append |report| to the <a>reporting cache</a>.
674688

675-
6. Let |environment| be |settings|'s <a>realm execution context</a>'s
689+
8. Let |environment| be |settings|'s <a>realm execution context</a>'s
676690
<a spec=ecmascript>realm</a>'s <a spec=ecmascript lt=realm>ECMAScript
677691
global environment</a>.
678692

679-
7. Execute [[#notify-observers]] with |environment| and |report|.
693+
9. Execute [[#notify-observers]] with |environment| and |report|.
680694

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

0 commit comments

Comments
 (0)