Skip to content

Commit 43bcc75

Browse files
committed
The common atttribute of PerformanceEntry should be initialized rather than inherited
Other specs should initialize startTime/entry/name/endTime rather than provide overrides for them.
1 parent f6a67dc commit 43bcc75

File tree

1 file changed

+25
-24
lines changed

1 file changed

+25
-24
lines changed

index.html

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -322,50 +322,51 @@ <h2>The <dfn>PerformanceEntry</dfn> interface</h2>
322322
[Default] object toJSON();
323323
};</pre>
324324
<dl>
325-
<dt><dfn>id</dfn></dt>
326-
<dd>
327-
This attribute MUST return the value of <a>this</a>'s <a>id</a>.
328-
</dd>
329325
<dt><dfn>name</dfn></dt>
330326
<dd>
331-
This attribute MUST return an identifier for this
332-
<a>PerformanceEntry</a> object. This identifier does not have to be
333-
unique.
327+
This attribute must return the value it is initialized to. It represents an identifier for
328+
this <a>PerformanceEntry</a> object. This identifier does not have to be unique.
334329
</dd>
335330
<dt><dfn>entryType</dfn></dt>
336331
<dd>
337-
This attribute MUST return the type of the interface represented by
338-
this <a>PerformanceEntry</a> object.
332+
This attribute must return the value it is initialized to.
333+
339334
<p class="note">All `entryType` values are defined in the
340335
relevant<a href=
341336
"https://w3c.github.io/timing-entrytypes-registry/#registry">registry</a>.
342337
Examples include: <code>"mark"</code> and <code>"measure"</code>
343338
[[USER-TIMING-2]], <code>"navigation"</code> [[NAVIGATION-TIMING-2]],
344-
<code>"resource"</code> [[RESOURCE-TIMING-2]],
345-
<!-- TODO: add long task spec reference -->
346-
and <code>"longtask"</code>.</p>
339+
and <code>"resource"</code> [[RESOURCE-TIMING-2]].</p>
347340
</dd>
348341
<dt><dfn>startTime</dfn></dt>
349-
<dd>This attribute MUST return the time value of the first recorded
350-
timestamp of this performance metric. If the startTime concept doesn't
351-
apply, a performance metric may choose to return a `startTime` of
352-
<code>0</code>.</dd>
342+
<dd>This attribute must return the value it is initialized to. It represents the time value of
343+
the first recorded timestamp of this performance metric. Its initial value is <code>0</code>.</dd>
353344
<dt><dfn>duration</dfn></dt>
354345
<dd>
355-
This attribute MUST return the time value of the duration of the entire
356-
event being recorded by this <a>PerformanceEntry</a>. Typically, this
357-
would be the time difference between the last recorded timestamp and
358-
the first recorded timestamp of this <a>PerformanceEntry</a>. If the
359-
duration concept doesn't apply, a performance metric may choose to
360-
return a `duration` of <code>0</code>.
346+
The getter steps for the <a>duration</a> attribute are to return 0 if <a>this</a>'s <a>endTime</a>
347+
is 0; otherwise <a>this</a>'s <a>endTime</a> - <a>this</a>'s <a>startTime</a>.
361348
</dd>
362349
<dt><dfn>navigationId</dfn></dt>
363350
<dd>
364-
This attribute MUST return the value of <a>this</a>'s <a>navigationId</a>.
351+
This attribute MUST return the value of it is initialized to.
365352
</dd>
366353
</dl>
367354
<p>When <dfn>toJSON</dfn> is called, run [[WebIDL]]'s <a>default toJSON
368355
steps</a>.</p>
356+
357+
<p>A <a>PerformanceEntry</a> has a {{DOMHighResTimeStamp}} <dfn for="PerformanceEntry">endTime</dfn>,
358+
initially 0.
359+
360+
<p>To <dfn class="export">initialize a <a>PerformanceEntry</a></dfn> <var>entry</var> given a {{DOMHighResTimeStamp}} <var>startTime</var>,
361+
a <code>DOMString</code> <var>entryType</var>, a <code>DOMString</code> name, and an optional {{DOMHighResTimeStamp}} <var>endTime</var> (default <code>0</code>):
362+
363+
<ol>
364+
<li>Assert: <var>entryType</var> is defined in the <a href="https://w3c.github.io/timing-entrytypes-registry/#registry">entry type registry</a>.
365+
<li>Set <var>entry</var>'s <a>startTime</a> to <var>startTime</var>.
366+
<li>Set <var>entry</var>'s <a>entryType</a> to <var>entryType</var>.
367+
<li>Set <var>entry</var>'s <a>name</a> to <var>name</var>.
368+
<li>Set <var>entry</var>'s <a>endTime</a> to <var>endTime</var>.
369+
</ol>
369370
</section>
370371
<section data-link-for="PerformanceObserver" data-dfn-for=
371372
"PerformanceObserver">
@@ -380,7 +381,7 @@ <h2>The <dfn>PerformanceObserver</dfn> interface</h2>
380381
<li>A <a>PerformanceEntryList</a> object called the <dfn>observer
381382
buffer</dfn> that is initially empty.
382383
</li>
383-
<li>A <code>DOMString</code> <dfn>observer type</dfn> which is initially
384+
<li>A <code>DOMS<tring</code> <dfn>observer type</dfn> which is initially
384385
<code>"undefined"</code>.</li>
385386
<li>A boolean <dfn>requires dropped entries</dfn> which is initially set to false.</li>
386387
</ul>

0 commit comments

Comments
 (0)