Skip to content

Commit

Permalink
Integrate with service worker timing (#143)
Browse files Browse the repository at this point in the history
* Service worker timing

* Fix reference

* nit

* Update index.html

Co-authored-by: Marcos Cáceres <[email protected]>

* Use cite for superclass

* Update index.html

Co-authored-by: Marcos Cáceres <[email protected]>

* Update index.html

Co-authored-by: Marcos Cáceres <[email protected]>

* Update index.html

Co-authored-by: Marcos Cáceres <[email protected]>

* Update index.html

Co-authored-by: Marcos Cáceres <[email protected]>

* Use 'prototype' as prose for superclass

Co-authored-by: Marcos Cáceres <[email protected]>
  • Loading branch information
noamr and marcoscaceres authored May 18, 2021
1 parent ab8c184 commit 606cf02
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,23 +305,20 @@ <h3>
"RESOURCE-TIMING-2#dom-performanceresourcetiming">PerformanceResourceTiming</dfn></code>
interface:
</p>
<ul data-dfn-for="PerformanceResourceTiming">
<li>The <dfn>initiatorType</dfn> attribute MUST return the
{{DOMString}} "<code>navigation</code>".
<ul>
<li>The `workerStart` getter steps are to perform the following steps:
<ol>
<li>Let |workerTiming| be |this|'s [=PerformanceNavigationTiming/service worker timing=].
<li>If |workerTiming| is null, then return |this|'s prototype's `workerStart`.
<li>Return |workerTiming|'s [=service worker timing info/start time=].
</ol>
</li>
<li>The <dfn id='dom-PerformanceNavigationTiming-workerStart'><code>
workerStart</code></dfn> attribute MUST return the time immediately
before the user agent <a data-cite=
"service-workers#run-service-worker">ran the worker</a> (if the
<a>current document</a> has an <a data-cite=
"service-workers#dfn-containing-service-worker-registration">active
service worker registration</a> [[SERVICE-WORKERS]]) required to
service the request, or if the worker was already available, the
time immediately before the user agent <a data-cite=
"service-workers#fetchevent">fired an event named `fetch`</a> at
the <a data-cite="service-workers#dfn-active-worker">active
worker</a>. Otherwise, if there is no active worker this attribute
MUST return zero.
<li>The `fetchStart` getter steps are to perform the following steps:
<ol>
<li>Let |workerTiming| be |this|'s [=PerformanceNavigationTiming/service worker timing=].
<li>If |workerTiming| is null, then return |this|'s prototype's `fetchStart`.
<li>Return |workerTiming|'s [=service worker timing info/fetch event dispatch time=].
</ol>
</li>
</ul>
<p class="note">
Expand Down Expand Up @@ -370,7 +367,6 @@ <h3>
[=document load timing info=] <a data-dfn-for="PerformanceResourceTiming">
<dfn>document load timing</dfn></a>.


<p>A <a>PerformanceNavigationTiming</a> has an associated
[=document unload timing info=] <a data-dfn-for="PerformanceNavigationTiming">
<dfn>previous document unload timing</dfn></a>.
Expand All @@ -381,6 +377,9 @@ <h3>
<p>A <a>PerformanceNavigationTiming</a> has an associated
{{NavigationType}} <a data-dfn-for="PerformanceNavigationTiming"><dfn>navigation type</dfn></a>.

<p>A {{PerformanceNavigationTiming}} has an associated null or [=service worker timing info=]
<dfn data-dfn-for="PerformanceNavigationTiming">service worker timing</dfn>.

</p>
<p data-dfn-for='PerformanceNavigationTiming'>
The <dfn>unloadEventStart</dfn> getter steps are to return |this|'s
Expand Down Expand Up @@ -546,14 +545,15 @@ <h2>Creating a navigation timing entry</h2>
<p data-dfn-for="Document">Each [=document=] has an associated <dfn>navigation timing entry</dfn>, initially unset.

<p>To <dfn export="">create the navigation timing entry</dfn> for {{Document}} |document|,
given a [=fetch timing info=] |fetchTiming|, a number |redirectCount|, and a
{{NavigationType}} |navigationType|, do the following:
given a [=fetch timing info=] |fetchTiming|, a number |redirectCount|, a
{{NavigationType}} |navigationType|, and a null or [=service worker timing info=] |serviceWorkerTiming|,
do the following:
<ol>
<li>Let |global| be |document|'s [=relevant global object=].</li>
<li>Let |navigationTimingEntry| be a new {{PerformanceNavigationTiming}} object in |global|'s
[=global object/realm=].
<li><a data-cite="RESOURCE-TIMING-2#dfn-setup-the-resource-timing-entry">Setup the resource
timing entry=] for |navigationTimingEntry| given "<code>navigation</code>", |document|'s
timing entry</a> for |navigationTimingEntry| given "<code>navigation</code>", |document|'s
<a data-cite="HTML#the-document's-address">address</a>, and |fetchTiming|.
<li>Set |navigationTimingEntry|'s <a data-for="PerformanceNavigationTiming">document load
timing</a> to |document|'s [=Document/load timing info=]
Expand All @@ -563,6 +563,8 @@ <h2>Creating a navigation timing entry</h2>
count</a> to |redirectCount|.
<li>Set |navigationTimingEntry|'s <a data-for="PerformanceNavigationTiming">navigation
type</a> to |navigationType|.
<li>Set |navigationTimingEntry|'s [=PerformanceNavigationTiming/service worker timing=]
to |serviceWorkerTiming|.
<li>Set |document|'s <span>navigation timing entry</span> to |navigationTimingEntry|.
<li>add |navigationTimingEntry| to |global|'s
<a data-cite='performance-timeline-2#dfn-performance-entry-buffer'>performance entry buffer</a>.
Expand Down

0 comments on commit 606cf02

Please sign in to comment.