From 77f637b750b923ddb852ac26c8902f94f0dfb453 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Mon, 10 Dec 2018 13:16:08 -0500 Subject: [PATCH 1/2] Limit report delivery per page --- index.src.html | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/index.src.html b/index.src.html index fda2cad..a1ac3c1 100644 --- a/index.src.html +++ b/index.src.html @@ -636,6 +636,13 @@

Media Type

The media type used when POSTing reports to a specified endpoint is `application/reports+json`. +

Report Count

+ + Each environment settings object has a report count, which + is a map from report type (string) to non-negative + integer. report count is used to track how many reports of + each report type have been generated in the current page. +

Queue |data| as |type| for |endpoint group| on |settings|

@@ -645,7 +652,14 @@

optional {{URL}} (|url|), the following algorithm will create a report, and add it to reporting cache's queue for future delivery. - 1. Let |report| be a new report object with its values initialized as + 1. If |settings|'s report count contains an entry + with key |type|, then increment that entry. Otherwise, + create an entry in |settings|'s report count + with key |type| and value 1. + + 2. If |settings|'s report count[|type|] is greater than 100, return. + + 3. Let |report| be a new report object with its values initialized as follows: : [=report/body=] @@ -661,22 +675,22 @@

: [=report/attempts=] :: 0 - 2. If |url| was not provided by the caller, let |url| be |settings|'s + 4. If |url| was not provided by the caller, let |url| be |settings|'s creation URL. - 3. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}} + 5. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}} to `null`. - 4. Set |report|'s [=report/url=] to the result of executing the URL + 6. Set |report|'s [=report/url=] to the result of executing the URL serializer on |url| with the exclude fragment flag set. - 5. Append |report| to the reporting cache. + 7. Append |report| to the reporting cache. - 6. Let |environment| be |settings|'s realm execution context's + 8. Let |environment| be |settings|'s realm execution context's realm's ECMAScript global environment. - 7. Execute [[#notify-observers]] with |environment| and |report|. + 9. Execute [[#notify-observers]] with |environment| and |report|. Note: reporting observers can only observe reports from the same environment settings object. From 7122d3fa71a1c7d66cd926ffd48412d294a16a46 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Tue, 5 Feb 2019 14:56:13 -0500 Subject: [PATCH 2/2] Limit reporting api under saveData --- index.src.html | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/index.src.html b/index.src.html index a1ac3c1..3dd32f7 100644 --- a/index.src.html +++ b/index.src.html @@ -129,6 +129,9 @@

Reporting API

text: session; url: dfn-session text: success; url: dfn-success text: trying; url: dfn-try +spec: netinfo; urlPrefix: https://wicg.github.io/netinfo + type: dfn + text: saveData; url: savedata-attribute
 {
@@ -651,15 +654,8 @@ 

(|endpoint group|), an environment settings object (|settings|), and an optional {{URL}} (|url|), the following algorithm will create a report, and add it to reporting cache's queue for future delivery. - - 1. If |settings|'s report count contains an entry - with key |type|, then increment that entry. Otherwise, - create an entry in |settings|'s report count - with key |type| and value 1. - - 2. If |settings|'s report count[|type|] is greater than 100, return. - 3. Let |report| be a new report object with its values initialized as + 1. Let |report| be a new report object with its values initialized as follows: : [=report/body=] @@ -675,22 +671,30 @@

: [=report/attempts=] :: 0 - 4. If |url| was not provided by the caller, let |url| be |settings|'s + 2. Let |environment| be |settings|'s realm execution context's + realm's ECMAScript + global environment. + + 3. Execute [[#notify-observers]] with |environment| and |report|. + + 4. If |settings|'s report count contains an entry + with key |type|, then increment that entry. Otherwise, + create an entry in |settings|'s report count + with key |type| and value 1. + + 5. If |settings|'s report count[|type|] is greater than 100 and the + current saveData preference is true, return. + + 6. If |url| was not provided by the caller, let |url| be |settings|'s creation URL. - 5. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}} + 7. Set |url|'s {{URL/username}} to the empty string, and its {{URL/password}} to `null`. - 6. Set |report|'s [=report/url=] to the result of executing the URL + 8. Set |report|'s [=report/url=] to the result of executing the URL serializer on |url| with the exclude fragment flag set. - 7. Append |report| to the reporting cache. - - 8. Let |environment| be |settings|'s realm execution context's - realm's ECMAScript - global environment. - - 9. Execute [[#notify-observers]] with |environment| and |report|. + 9. Append |report| to the reporting cache. Note: reporting observers can only observe reports from the same environment settings object.