Add more specification about navigation type to handle meta-refresh, location.reload() and
authorZhiheng Wang
Wed, 30 Mar 2011 00:13:34 -0700
changeset 148d4e16b2fd2b7
parent 147 4c8ea471561f
child 149 4584dfd36212
Add more specification about navigation type to handle meta-refresh, location.reload() and
script initiated navigation.
specs/NavigationTiming/Overview.html
     1.1 --- a/specs/NavigationTiming/Overview.html	Tue Mar 29 17:56:50 2011 -0700
     1.2 +++ b/specs/NavigationTiming/Overview.html	Wed Mar 30 00:13:34 2011 -0700
     1.3 @@ -38,7 +38,7 @@
     1.4  <div class="head">
     1.5  <h1>Navigation Timing</h1>
     1.6  
     1.7 -<h2 class="no-num no-toc" id="working-draft-march-18-2011">Editor's Draft March 18, 2011</h2>
     1.8 +<h2 class="no-num no-toc" id="working-draft-march-29-2011">Editor's Draft March 29, 2011</h2>
     1.9  <dl>
    1.10    <dt>This version:</dt>
    1.11      <dd><a
    1.12 @@ -50,9 +50,9 @@
    1.13      <dd><a
    1.14        href="http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html">http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html</a></dd>
    1.15    <dt>Previous versions:</dt>
    1.16 +    <dd><a href="https://dvcs.w3.org/hg/webperf/raw-file/4c8ea471561f/specs/NavigationTiming/Overview.html">https://dvcs.w3.org/hg/webperf/raw-file/4c8ea471561f/specs/NavigationTiming/Overview.html</a></dd>
    1.17      <dd><a href="http://dvcs.w3.org/hg/webperf/raw-file/56c1641068e8/specs/NavigationTiming/Overview.html">http://dvcs.w3.org/hg/webperf/raw-file/56c1641068e8/specs/NavigationTiming/Overview.html</a></dd>
    1.18      <dd><a href="http://dvcs.w3.org/hg/webperf/raw-file/1780071321d7/specs/NavigationTiming/Overview.html">http://dvcs.w3.org/hg/webperf/raw-file/1780071321d7/specs/NavigationTiming/Overview.html</a></dd>
    1.19 -    <dd><a href="https://dvcs.w3.org/hg/webperf/raw-file/565bce32396d/specs/NavigationTiming/Overview.html">https://dvcs.w3.org/hg/webperf/raw-file/565bce32396d/specs/NavigationTiming/Overview.html</a></dd>
    1.20    <dt>Editors:</dt>
    1.21      <dd class="vcard"><span class="fn">Zhiheng Wang</span> (<span
    1.22        class="org">Google Inc.</span>) &lt;<a
    1.23 @@ -166,8 +166,8 @@
    1.24  </p>
    1.25  
    1.26  <div class="example">
    1.27 -<p>For example, the following Javascript shows the time it take to fully load
    1.28 -a page: </p>
    1.29 +<p>For example, the following Javascript shows a naive attempt to
    1.30 +measure the time it takes to fully load a page:</p>
    1.31  <pre>&lt;html&gt;
    1.32  &lt;head&gt;
    1.33  &lt;script type="text/javascript"&gt;
    1.34 @@ -574,12 +574,15 @@
    1.35  href="#nt-navigation-info-type">navigation type</a> values. </p>
    1.36  <dl>
    1.37    <dt><dfn id="nt-navigation-info-type-navigate">TYPE_NAVIGATE</dfn>:
    1.38 -    navigation started by clicking on a link or entering the URL in the user
    1.39 -    agent's address bar.</dt>
    1.40 +    Navigation started by clicking on a link, or entering the URL in the user
    1.41 +    agent's address bar, or initializing through a script operation other than the
    1.42 +    <a href="http://dev.w3.org/html5/spec/Overview.html#dom-location-reload">location.reload()</a> mothod.</dt>
    1.43    <dt><dfn id="nt-navigation-info-type-reload">TYPE_RELOAD</dfn>: Navigation through
    1.44 -    the reload operation.</dt>
    1.45 +    the reload operation or the
    1.46 +    <a href="http://dev.w3.org/html5/spec/Overview.html#dom-location-reload">location.reload()</a>
    1.47 +    method.</dt>
    1.48    <dt><dfn id="nt-navigation-info-type-back-forward">TYPE_BACK_FORWARD</dfn>: Navigation
    1.49 -  through a forward or backward operation.</dt>
    1.50 +  through a <a href="http://dev.w3.org/html5/spec/Overview.html#traverse-the-history">history traversal</a> operation.</dt>
    1.51    <dt><dfn id="nt-navigation-info-type-reserved">TYPE_RESERVED</dfn>: Any navigation
    1.52    types not defined by values above.</dt>
    1.53  </dl>
    1.54 @@ -588,7 +591,7 @@
    1.55  <p>Client-side redirects, such as those using <a href="http://dev.w3.org/html5/spec/semantics.html#attr-meta-http-equiv-refresh">the Refresh pragma directive</a>,
    1.56  are not considered HTTP redirects <a href="http://dev.w3.org/html5/spec/fetching-resources.html#concept-http-equivalent-codes">or equivalent</a> by this spec.
    1.57  In those cases, the <a href="#nt-navigation-info-type">type</a> attribute should return appropriate value,
    1.58 -such as <a href="#nt-navigation-info-type-navigate">TYPE_NAVIGATE</a>, as if in non-redirect navigation.</p>
    1.59 +such as <a href="#nt-navigation-info-type-navigate">TYPE_RELOAD</a>, as if in non-redirect navigation.</p>
    1.60  </div>
    1.61  
    1.62  <h4><code><dfn id="nt-navigation-info-redirect-count">redirectCount</dfn></code> attribute </h4>
    1.63 @@ -699,14 +702,30 @@
    1.64      to unload</a> the previous <a
    1.65      href="http://dev.w3.org/html5/spec/infrastructure.html#document">document</a>,
    1.66      record the current time as <a
    1.67 -    href="#nt-navigation-start">navigationStart</a> and record the current navigation type in
    1.68 -    <a href="#nt-navigation-info-type">window.performance.navigation.type</a>
    1.69 -    if it has not been set.</li>
    1.70 +    href="#nt-navigation-start">navigationStart</a>.</li>
    1.71 +  <li> Record the current navigation type in <a href="#nt-navigation-info-type">window.performance.navigation.type</a>
    1.72 +    if it has not been set:
    1.73 +    <ol style="list-style-type:lower-alpha;">
    1.74 +    <li>If the navigation was started by clicking on a link, or entering the URL in the user
    1.75 +        agent's address bar, or initializing through a script operation other than the
    1.76 +        <a href="http://dev.w3.org/html5/spec/Overview.html#dom-location-reload">location.reload()</a> mothod,
    1.77 +        let the navigation type be <a href="#nt-navigation-info-type-navigate">TYPE_NAVIGATE</a>.</li>
    1.78 +    <li>If the navigation was started either as a result of a
    1.79 +        <a href="http://dev.w3.org/html5/spec/Overview.html#attr-meta-http-equiv-refresh">meta refresh</a>,
    1.80 +        or the <a href="http://dev.w3.org/html5/spec/Overview.html#dom-location-reload">location.reload()</a>
    1.81 +        method, or other equiverlant actions, let the navigation type
    1.82 +        be <a href="#nt-navigation-info-type-reload">TYPE_RELOAD</a>.</li>
    1.83 +    <li>If the navigation was started as a result of
    1.84 +        <a href="http://dev.w3.org/html5/spec/Overview.html#traverse-the-history">history traversal</a>,
    1.85 +        let the navigation type be <a href="#nt-navigation-info-type-back-forward">TYPE_BACK_FORWARD</a>.</li>
    1.86 +    <li>Otherwise, let the navigation type be <a href="#nt-navigation-info-type-navigate">TYPE_RESERVED</a>.</li>
    1.87 +    </ol>
    1.88 +  </li>
    1.89    <li>If the current document and the previous document are from different 
    1.90      <a href="http://dev.w3.org/html5/spec/origin-0.html#origin">origins</a>,
    1.91      set both <a href="#nt-unload-end">unloadEventStart</a> and 
    1.92      <a href="#nt-unload-end">unloadEventEnd</a> to 0 then go to step
    1.93 -    <a href="#step-fetch-start">5</a>. Otherwise, record <a href="#nt-unload-end">unloadEventStart</a>
    1.94 +    <a href="#step-fetch-start">6</a>. Otherwise, record <a href="#nt-unload-end">unloadEventStart</a>
    1.95      as the time immediately before the unload event.</li>
    1.96    <li>Immediately after the unload event is completed,
    1.97      record the current time as <a href="#nt-unload-end">unloadEventEnd</a>.</li>
    1.98 @@ -726,9 +745,9 @@
    1.99    <li>If the resource is fetched from the <a
   1.100      href="http://dev.w3.org/html5/spec/offline.html#relevant-application-cache">relevant
   1.101      application cache</a> or local resources, go to step <a
   1.102 -    href="#step-request-start">12</a>.</li>
   1.103 +    href="#step-request-start">13</a>.</li>
   1.104    <li>If no domain lookup is required, go to step <a
   1.105 -    href="#step-connect-start">10</a>. Otherwise, immediately before a user
   1.106 +    href="#step-connect-start">11</a>. Otherwise, immediately before a user
   1.107      agent starts the domain name lookup, record the time as 
   1.108      <a href="#nt-domain-lookup-start">domainLookupStart</a>. </li>
   1.109    <li>Record the time as <a href="#nt-domain-lookup-end">domainLookupEnd</a>
   1.110 @@ -746,7 +765,7 @@
   1.111      after the connection to the server or the proxy is established. A user agent may
   1.112      need multiple retries before this time. If a connection can not be
   1.113      established, abort the rest of the steps. </li>
   1.114 -  <li>In step <a href="#step-connect-start">10</a>, a user agent should also
   1.115 +  <li>In step <a href="#step-connect-start">11</a>, a user agent should also
   1.116      carry out these additional steps:
   1.117      <ol>
   1.118      <li>If the scheme of the current document is HTTPS, the user agent must
   1.119 @@ -764,7 +783,7 @@
   1.120    <li id="step-response-end">Record the time as <a
   1.121      href="#nt-response-end">responseEnd</a> immediately after receiving the
   1.122      last byte of the response.
   1.123 -    <p>Return to step <a href="#step-connect-start">10</a> if the user agent
   1.124 +    <p>Return to step <a href="#step-connect-start">11</a> if the user agent
   1.125      fails to send the request or receive the entire response, and needs to
   1.126      reopen the connection.</p>
   1.127  
   1.128 @@ -789,7 +808,7 @@
   1.129          <a href="#nt-unload-start">unloadEventStart</a>,
   1.130          <a href="#nt-unload-end">unloadEventStart</a> and 
   1.131          <a href="#nt-navigation-info-redirect-count">redirectCount</a> to 0. Then,
   1.132 -        return to step <a href="#step-fetch-start">5</a> with the new resource.</li>
   1.133 +        return to step <a href="#step-fetch-start">6</a> with the new resource.</li>
   1.134        <li>Increment window.performance.navigation.redirectCount by 1.</li>
   1.135        <li>If the value of window.performance.navigation.redirectStart is
   1.136          not set, let it be the value of <a href="#nt-fetch-start">fetchStart</a>.</li>
   1.137 @@ -801,7 +820,7 @@
   1.138          <a href="#nt-redirect-end">redirectEnd</a>, 
   1.139          <a href="#nt-unload-start">unloadEventStart</a> and
   1.140          <a href="#nt-unload-end">unloadEventEnd</a>.</li>
   1.141 -      <li>Return to step <a href="#step-fetch-start">5</a> with the new resource.</li>
   1.142 +      <li>Return to step <a href="#step-fetch-start">6</a> with the new resource.</li>
   1.143      </ol>
   1.144    </li>
   1.145    <li>Record the time as <a href="#nt-dom-loading">domLoading</a> immediately