sendBeacon and being synchronous

I started an implementation in Gecko.  One of the things I noticed was that we might need to do nontrivial work on the main thread (before returning to js) to fully implement the api.  For example, section 4.3.12 requires us to serialize the document into a string.  We need to do this before returning so that we can throw QuotaExceededError if the size of the document is greater than 10kb.  This means that were going to have to walk the DOM writing out a string for up to 10kb in length before control is returned to the script.  This is probably not a good thing.

Another case that might be trouble is section 4.3.11.  In this, we are capping the per-beacon limit to 10KB again.  However, we may also want to have a total limit (of 64KB?) and a per-beacon limit of 10KB.  If we do that, we will need to check some global of outstanding beacons.  I would worry that well need to lock.  Maybe not.  But still, well need to do this before returning.

I know I am coming to the party late, but has there been any thought into an asynchronous API?

One other things (from Boris)  
	Sections 4.3.11 and 4.3.12 are out of order.  You first must convert/serialize the object before checking its length.
	|Let mime type be "application/xml" or "text/html" if Document is an HTML document| > this is unreadable.  It should be text.html if the document is HTML, otherwise application/xml.  Right?


Received on Tuesday, 12 November 2013 03:09:20 UTC