w3c / beacon

Beacon
https://w3c.github.io/beacon/
Other
46 stars 22 forks source link

maximum data size rules still seem ambiguous #42

Closed dbaron closed 7 years ago

dbaron commented 7 years ago

The sendBeacon() spec specifies that UAs must enforce a maximum data size, but it doesn't say what that data size is or how they should enforce it.

If someone were to write a new implementation of sendBeacon(), they'd want the information that's in #38 about the actual limits that are enforced -- otherwise sendBeacon() calls that sites expect to work might not work in that implementation.

I'd think that the information you need to build a working implementation ought to be in the spec.

igrigorik commented 7 years ago

The enforcement is defined in Fetch API, and we decided earlier not to duplicate it in two places. In Beacon we say:

Requests initiated via the Beacon API automatically set the keepalive flag, and developers can similarly set the same flag manually when using the Fetch API. All requests with this flag set share the same in-flight quota restrictions that is enforced within the Fetch API.

In Fetch API, section 4.5, step 9.5:

If the sum of contentLengthValue and inflightKeepaliveBytes is greater than 64 kibibytes, then return a network error.

Is this not enough, from you perspective?

dbaron commented 7 years ago

Normatively referencing fetch is great.

But given that, the conformance text such as:

The user agent MUST restrict the maximum data size to ensure that beacon requests are able to complete quickly and in a timely manner.

seems like it should instead be an informative reference, and this text:

If the amount of data that can be queued to be sent by keepalive enabled requests is exceeded by the size of transmittedData, set the return value to false and terminate these steps.

should reference the location of the definition of the amount of data that can be queued.