Re: Resource timing spec unclear about setResourceTimingBufferSize and onresourcebufferfull

Hi Valentin,

Re:
First of all, setResourceTimingBufferSize [1] says that "If the maxSize
parameter is less than the number of elements currently stored in the
buffer, no elements in the buffer are to be removed. The maxSize parameter
will apply only after the clearResourceTimings method is called."

Yes the language is vague. The last sentence is misleading. We can remove
it. So the new text will be:
"If the maxSize parameter is less than the number of elements currently
stored in the buffer, no elements in the buffer are to be removed."

In this situation, the buffer has more elements than maxSize. No new
elements can be inserted but you have more than maxSize elements. Once the
user calls clearResourceTimings method, new elements upto maxSize can be
inserted.

On your second question, onresourcebufferfull is called immediately after
the buffer becomes full. If you set maxSize after that that causes the
buffer to exceed or make the buffer full, I think we should not call
onresourcebufferfull. We can make it explicit in the spec, by further
updating this sentence:
"If the maxSize parameter is less than the number of elements currently
stored in the buffer, no elements in the buffer are to be removed. In this
case, the buffer is considered to be full but the user agent MUST not fire
the resourcetimingbufferfull event."

Boris, in your example, once you call setResourceTimingBufferSize(50), the
buffer should be considered full. In step 20, you will discard the new
object. I think your confusion is also related to the misleading statement
that Valentin pointed out, which we will remove.

Please let me know if the change I suggested above will address your
concerns.

On 5/4/14, 2:17 PM, Valentin Gosu wrote:

> This makes it seem as the new maxSize will only apply after
> clearResourceTimings is called. Point 20 of the processing model [2]
> does specify that setResourceTimingBufferSize may be called in the event
> handler for onresourcebufferfull to extend the primary buffer, but I
> feel that the first reference is vague/misleading.

It's worse than that.  Since the spec never clearly defines what "primary
buffer is full", UAs are left guessing what to actually do in this step.
 If the buffer currently contains 100 entries and there is a
setResourceTimingBufferSize(50) call, is the buffer full in step 20?  Or
does the "50" only take effect when clearResourceTimings is called, and
until then the previous value of 150 continues to be the size at which the
buffer is full?

I think what the spec could really use here is some clear assigning to a
member slot of some sort in setResourceTimingBufferSize() and then a clear
definition of how that member slot is or is not used in step 20.

-Boris

Received on Wednesday, 7 May 2014 17:40:31 UTC