Re: [PerformanceTimeline] API/WebIDL related feedback (was: Unclear what getEntries and company return)

On Thu, Aug 22, 2013 at 1:30 PM, David Bruant <bruant.d@gmail.com> wrote:

>  Le 22/08/2013 20:37, James Simonsen a écrit :
>
> On Wed, Aug 21, 2013 at 7:41 PM, Boris Zbarsky <bzbarsky@mit.edu> wrote:
>
>
>> This ambiguity seems like a hard blocker to actually proceeding with our
>> implementation.
>>
>> 2)  It's not quite clear to me what the "contains a copy" language means.
>>  Does this mean that this predicate:
>>
>>   performance.getEntries()[0] == performance.getEntries()[0]
>>
>> tests false if getEntries returns a nonempty list?  That is, each time
>> the list is returned it has to contain brand-new objects?  If this is in
>> fact the intent, it's rather surprising; given that the objects only have
>> readonly properties it seems like it would be better to return existing
>> objects.  If we _do_ want to return brand-new objects every time, it seems
>> like we should simply return dictionaries instead: then we get the
>> new-object behavior for free and script gets non-magical objects to work
>> with.
>
>
>  Blink doesn't create copies. It'd be silly to. I think we should just
> update the spec.
>
> Maybe it should just be .entries, then (instead of .getEntries() )?
>

The entries themselves are not copies, but you get a new list every time.
We don't want the list to change after you've called getEntries(). You're
getting a snapshot.


> I'm not sure I quite understand the difference between entryType and name.
>

The type refers to the source of the entry. If it's a network resource, the
type is "resource." If it's from a User Timing mark, it's "mark."

The name is the name of that specific resource or mark. For resources, it's
the URL.

I'm not sure I see the benefit of the getEntriesByType and getEntriesByName
> methods since what they do can be done very easily in JS:
>
>   var fooEntries = performance.entries.filter(function(e){return e.name=== "foo"}) // ES5
>   var fooEntries = performance.entries.filter(e => e.name === "foo") //
> ES6
>

Good point, but it's probably too late to change it.

James

Received on Thursday, 22 August 2013 20:56:18 UTC