├── .github └── workflows │ └── auto-publish.yml ├── .pr-preview.json ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── index.html ├── tidyconfig.txt ├── timestamp-diagram.svg └── w3c.json /.github/workflows/auto-publish.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | pull_request: {} 4 | push: 5 | branches: [gh-pages] 6 | jobs: 7 | main: 8 | name: Build, Validate and Deploy 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v2 12 | - uses: w3c/spec-prod@v2 13 | with: 14 | W3C_ECHIDNA_TOKEN: ${{ secrets.W3C_TR_TOKEN }} 15 | W3C_WG_DECISION_URL: https://lists.w3.org/Archives/Public/public-web-perf/2021Apr/0005.html 16 | W3C_BUILD_OVERRIDE: | 17 | shortName: navigation-timing-2 18 | specStatus: WD 19 | -------------------------------------------------------------------------------- /.pr-preview.json: -------------------------------------------------------------------------------- 1 | { 2 | "src_file": "index.html", 3 | "type": "respec" 4 | } 5 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | All documentation, code and communication under this repository are covered by the [W3C Code of Ethics and Professional Conduct](https://www.w3.org/Consortium/cepc/). 4 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributions to this repository are intended to become part of Recommendation-track documents governed by the 2 | [W3C Patent Policy](https://www.w3.org/Consortium/Patent-Policy-20040205/) and 3 | [Software and Document License](https://www.w3.org/Consortium/Legal/copyright-software). To make substantive contributions to specifications, you must either participate 4 | in the relevant W3C Working Group or make a non-member patent licensing commitment. 5 | 6 | For our editing test-driven process, see [CONTRIBUTING.md](https://github.com/w3c/web-performance/blob/gh-pages/CONTRIBUTING.md). 7 | 8 | If you are not the sole contributor to a contribution (pull request), please identify all 9 | contributors in the pull request comment. 10 | 11 | To add a contributor (other than yourself, that's automatic), mark them one per line as follows: 12 | 13 | ``` 14 | +@github_username 15 | ``` 16 | 17 | If you added a contributor by mistake, you can remove them in a comment with: 18 | 19 | ``` 20 | -@github_username 21 | ``` 22 | 23 | If you are making a pull request on behalf of someone else but you had no part in designing the 24 | feature, you can remove yourself with the above syntax. 25 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | All documents in this Repository are licensed by contributors 2 | under the 3 | [W3C Software and Document License](http://www.w3.org/Consortium/Legal/copyright-software). 4 | 5 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Navigation Timing 2 | ================= 3 | 4 | This specification defines an interface for web applications to access the complete timing information for navigation of a document. 5 | 6 | * Editors draft: https://w3c.github.io/navigation-timing/ 7 | * Navigation Timing Level 2: https://www.w3.org/TR/navigation-timing-2/ 8 | * Navigation Timing Level 1: https://www.w3.org/TR/navigation-timing/ 9 | 10 | See also [Web performance README](https://github.com/w3c/web-performance/blob/gh-pages/README.md) 11 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Navigation Timing Level 2 8 | 9 | 18 | 19 | 94 | 95 | 96 |
97 |

98 | This specification defines an interface for web applications to access 99 | the complete timing information for navigation of a document. 100 |

101 |
102 |
103 |

104 | Navigation Timing 2 replaces the first version of [[NAVIGATION-TIMING]] 105 | and includes the following changes: 106 |

107 | 142 |
143 |
144 |

145 | Introduction 146 |

147 |

148 | Accurately measuring performance characteristics of web applications is 149 | an important aspect of making web applications faster. While 150 | JavaScript-based mechanisms, such as the one described in 151 | [[JSMEASURE]], can provide comprehensive instrumentation for user 152 | latency measurements within an application, in many cases, they are 153 | unable to provide a complete or detailed end-to-end latency picture. 154 | For example, the following JavaScript shows a naive attempt to measure 155 | the time it takes to fully load a page: 156 |

157 |
 158 |         <html>
 159 |         <head>
 160 |         <script type="text/javascript">
 161 |         var start = new Date().getTime();
 162 |         function onLoad() {
 163 |           var now = new Date().getTime();
 164 |           var latency = now - start;
 165 |           alert("page loading time: " + latency);
 166 |         }
 167 |         </script>
 168 |         </head>
 169 |         <body onload="onLoad()">
 170 |         <!- Main page body goes from here. -->
 171 |         </body>
 172 |         </html>
 173 |       
174 |

175 | The above script calculates the time it takes to load the page 176 | after the first bit of JavaScript in the head is executed, but 177 | it does not give any information about the time it takes to get the 178 | page from the server, or the initialization lifecycle of the page. 179 |

180 |

181 | This specification defines the {{PerformanceNavigationTiming}} 182 | interface which participates in the [[PERFORMANCE-TIMELINE-2]] to store 183 | and retrieve high resolution performance metric data related to the 184 | navigation of a document. As the {{PerformanceNavigationTiming}} 185 | interface uses [[HR-TIME]], all time values are measured with respect 186 | to the [=environment settings object/time origin=] of the entry's 187 | [=relevant settings object=]. 188 |

189 |

190 | For example, if we know that the response end occurs 100ms after the 191 | start of navigation, the {{PerformanceNavigationTiming}} data could 192 | look like so: 193 |

194 |
 195 |       startTime:           0.000  // start time of the navigation request
 196 |       responseEnd:       100.000  // high resolution time of last received byte
 197 |       
198 |

199 | The following script shows how a developer can use the 200 | {{PerformanceNavigationTiming}} interface to obtain accurate timing 201 | data related to the navigation of the document: 202 |

203 |
 204 |         <script>
 205 |         function showNavigationDetails() {
 206 |           // Get the first entry
 207 |           const [entry] = performance.getEntriesByType("navigation");
 208 |           // Show it in a nice table in the developer console
 209 |           console.table(entry.toJSON());
 210 |         }
 211 |         </script>
 212 |         <body onload="showNavigationDetails()">
 213 |       
214 |
215 |
216 |

217 | Terminology 218 |

219 |

220 | The construction "a Foo object", where Foo is 221 | actually an interface, is sometimes used instead of the more accurate 222 | "an object implementing the interface Foo. 223 |

224 |

225 | The term current document refers to the document associated 226 | with the Window object's newest 227 | Document object. 228 |

229 |

230 | Throughout this work, all time values are measured in milliseconds 231 | since the start of navigation of the document. For example, the start 232 | of navigation of the document occurs at time 0. The term current 233 | time refers to the number of milliseconds since the start of 234 | navigation of the document until the current moment in time. This 235 | definition of time is based on [[HR-TIME]] specification. 236 |

237 |
238 |
239 |

240 | Navigation Timing 241 |

242 |
243 |

244 | Relation to the {{PerformanceEntry}} interface 245 |

246 |

247 | {{PerformanceNavigationTiming}} interface extends the following 248 | attributes of {{PerformanceEntry}} interface: 249 |

250 | 263 |

264 | A user agent implementing {{PerformanceNavigationTiming}} would need 265 | to include "navigation" in supportedEntryTypes 267 | for Window 268 | contexts. This allows developers to detect support for Navigation 269 | Timing. 270 |

271 |
272 |
273 |

274 | Relation to the PerformanceResourceTiming interface 275 |

276 |

277 | {{PerformanceNavigationTiming}} interface extends the following 278 | attributes of the PerformanceResourceTiming 280 | interface: 281 |

282 | 336 |

337 | Only the current document resource is included in the 338 | performance timeline; there is only one 339 | {{PerformanceNavigationTiming}} object in the performance timeline. 340 |

341 |
342 |
344 |

345 | The PerformanceNavigationTiming interface 346 |

347 |
348 |

349 | Checking and retrieving contents from the HTTP cache [[RFC7234]] is 351 | part of the fetching process. It's covered by the 354 | requestStart, 356 | responseStart and 358 | responseEnd attributes. 359 |

360 |
361 |
 362 |         [Exposed=Window]
 363 |         interface PerformanceNavigationTiming : PerformanceResourceTiming {
 364 |             readonly        attribute DOMHighResTimeStamp  unloadEventStart;
 365 |             readonly        attribute DOMHighResTimeStamp  unloadEventEnd;
 366 |             readonly        attribute DOMHighResTimeStamp  domInteractive;
 367 |             readonly        attribute DOMHighResTimeStamp  domContentLoadedEventStart;
 368 |             readonly        attribute DOMHighResTimeStamp  domContentLoadedEventEnd;
 369 |             readonly        attribute DOMHighResTimeStamp  domComplete;
 370 |             readonly        attribute DOMHighResTimeStamp  loadEventStart;
 371 |             readonly        attribute DOMHighResTimeStamp  loadEventEnd;
 372 |             readonly        attribute NavigationTimingType type;
 373 |             readonly        attribute unsigned short       redirectCount;
 374 |             readonly        attribute DOMHighResTimeStamp  criticalCHRestart;
 375 |             readonly        attribute NotRestoredReasons?  notRestoredReasons;
 376 |             [Default] object toJSON();
 377 |         };
 378 |         
379 | 380 |

A PerformanceNavigationTiming has an associated 381 | [=document load timing info=] 382 | document load timing. 383 | 384 |

A PerformanceNavigationTiming has an associated 385 | [=document unload timing info=] 386 | previous document unload timing. 387 | 388 |

A PerformanceNavigationTiming has an associated 389 | number redirect count. 390 | 391 |

A PerformanceNavigationTiming has an associated 392 | {{NavigationTimingType}} navigation type. 393 | 394 |

A PerformanceNavigationTiming has an associated 395 | {{DOMHighResTimeStamp}} `Critical-CH` restart time. 396 | 397 |

A PerformanceNavigationTiming has an associated 398 | {{NotRestoredReasons}} not restored reasons. 399 | 400 |

A {{PerformanceNavigationTiming}} has an associated null or [=service worker timing info=] 401 | service worker timing. 402 |

403 | 404 |

405 | The unloadEventStart getter steps are to return |this|'s 406 | [=previous document unload timing=]'s [=document unload timing info/unload event start 407 | time=]. 408 |

If the previous document and the current document have the same 409 | origin, this timestamp is measured immediately 410 | before the user agent starts the unload event 412 | of the previous document. If there is no previous document or the 413 | previous document has a different origin than the current document, this attribute will return 415 | zero. 416 |

417 |

418 | The unloadEventEnd getter steps are to return |this|'s 419 | [=previous document unload timing=]'s 420 | [=document unload timing info/unload event end time=]. 421 |

If the previous document and the current document have the same 422 | origin, this timestamp is measured immediately 423 | after the user agent handles the unload event 425 | of the previous document. If there is no previous document or the 426 | previous document has a different origin than the current document, this attribute will return 428 | zero. 429 |

430 |

431 | The domInteractive getter steps are to return 432 | |this|'s [=document load timing=]'s [=document load timing info/DOM interactive time=].

433 | 434 |

This timestamp is measured before the user agent sets the 435 | current document readiness to 436 | "interactive". 437 |

438 |

439 | The domContentLoadedEventStart getter steps are to return |this|'s 440 | [=document load timing=]'s 441 | [=document load timing info/DOM content loaded event start time=].

442 |

443 |

This timestamp is measured before the user agent dispatches the 444 | DOMContentLoaded 445 | event. 446 |

447 |

448 | The domContentLoadedEventEnd getter steps are to return 449 | |this|'s [=document load timing=]'s 450 | [=document load timing info/DOM content loaded event end time=].

451 |

This timestamp is measured after the user agent completes handling of the 452 | DOMContentLoaded 453 | event. 454 |

455 |

456 | The domComplete getter steps are to return 457 | |this|'s [=document load timing=]'s [=document load timing info/DOM complete time=]. 458 |

This timestamp is measured before the user agent sets the 459 | current document readiness to 460 | "complete". See document readiness for a precise 462 | definition. 463 |

464 |

465 | The loadEventStart getter steps are to return 466 | |this|'s [=document load timing=]'s [=document load timing info/load event start time=].

467 |

468 |

This timestamp is measured before the user agent dispatches the 469 | [=Window/load=] event for the document. 470 |

471 |

472 | The loadEventEnd getter steps are to return 473 | |this|'s [=document load timing=]'s [=document load timing info/load event end time=].

474 |

475 |

This timestamp is measured after the user agent completes handling the 476 | [=Window/load=] event for the document. 477 |

478 |

479 | The type getter steps are to run the |this|'s [=navigation type=]. 480 |

481 |
482 |

483 | Client-side redirects, such as those using the Refresh pragma 485 | directive, are not considered HTTP redirects by this spec. In those 487 | cases, the type 488 | attribute SHOULD return appropriate value, such as 489 | reload if reloading the 490 | current page, or navigate if 491 | navigating to a new URL. 492 |

493 |
494 |

495 | The redirectCount getter steps are to return |this|'s 496 | redirect count.

497 |

498 |

499 | The criticalCHRestart getter steps are to return |this|'s 500 | `Critical-CH` restart time.

501 |

502 |
503 |

504 | If |criticalCHRestart| is not 0 it will be before all other timestamps except for 505 | |navigationStart|, |unloadEventStart|, and |unloadEventEnd|. This is because it marks 506 | the moment the redirection part of the navigation was restarted. 507 |

508 |
509 |

510 | The notRestoredReasons getter steps are to return |this|'s 511 | not restored reasons.

512 |

513 | The toJSON() method runs the [=default toJSON steps=] for [=this=]. 514 |

515 |
516 |

517 | NavigationTimingType enum 518 |

519 |
 520 |             enum NavigationTimingType {
 521 |                 "navigate",
 522 |                 "reload",
 523 |                 "back_forward",
 524 |                 "prerender"
 525 |             };
 526 |           
527 |

528 | The values are defined as follows: 529 |

530 |
531 |
532 | navigate 533 |
534 |
535 | Navigation where the 536 | history handling behavior 537 | is set to 538 | "default" 539 | or "replace" 540 | and the navigation was not initiated by a prerender hint [[RESOURCE-HINTS]]. 542 |
543 |
544 | reload 545 |
546 |
547 | Navigation where the [=navigable=] was reloaded. 549 |
550 |
551 | back_forward 552 |
553 |
554 | Navigation that's applied from history. 556 |
557 |
558 | prerender 559 |
560 |
561 | Navigation initiated by a prerender hint [[RESOURCE-HINTS]]. 563 |
564 |
565 |

566 | The format of the above enumeration value is inconsistent with the 567 | [=enumeration|WebIDL recommendation for 568 | formatting of enumeration values=]. Unfortunately, we are unable 569 | to change it due to backwards compatibility issues with shipped 570 | implementations. [[WebIDL]] 571 |

572 |
573 |
574 |
575 |
576 |

577 | Process 578 |

579 |
580 |

581 | Processing Model 582 |

583 |
584 |
585 | This figure illustrates the timing attributes defined by the 586 | {{PerformanceNavigationTiming}} interface. Attributes in 587 | parenthesis indicate that they may not be available for navigations 588 | involving documents from different origins. 590 |
591 | 592 | Navigation Timing attributes 594 |
595 |
596 |
597 |
598 |

Creating a navigation timing entry

599 |

Each [=document=] has an associated navigation timing entry, initially unset. 600 | 601 |

To create the navigation timing entry for {{Document}} |document|, 602 | given a [=fetch timing info=] |fetchTiming|, a number |redirectCount|, a 603 | {{NavigationTimingType}} |navigationType|, a null or [=service worker timing info=] |serviceWorkerTiming|, 604 | a DOMString |cacheMode|, a {{DOMHighResTimeStamp}} |criticalCHRestart|, and a [=response body info=] |bodyInfo|, do the following: 605 |

    606 |
  1. Let |global| be |document|'s [=relevant global object=].
  2. 607 |
  3. Let |navigationTimingEntry| be a new {{PerformanceNavigationTiming}} object in |global|'s 608 | [=global object/realm=]. 609 |
  4. Setup the resource 610 | timing entry for |navigationTimingEntry| given "navigation", |document|'s 611 | {{Document/URL}}, |fetchTiming|, |cacheMode|, and |bodyInfo|. 612 |
  5. Set |navigationTimingEntry|'s document load 613 | timing to |document|'s [=Document/load timing info=] 614 |
  6. Set |navigationTimingEntry|'s previous 615 | document unload timing to |document|'s [=Document/previous document unload timing=]. 616 |
  7. Set |navigationTimingEntry|'s redirect 617 | count to |redirectCount|. 618 |
  8. Set |navigationTimingEntry|'s navigation 619 | type to |navigationType|. 620 |
  9. Set |navigationTimingEntry|'s [=PerformanceNavigationTiming/service worker timing=] 621 | to |serviceWorkerTiming|. 622 |
  10. Set |document|'s navigation timing entry to |navigationTimingEntry|. 623 |
  11. Set |navigationTimingEntry|'s `Critical-CH` restart time 624 | to |criticalCHRestart|. 625 |
  12. Set |navigationTimingEntry|'s [=PerformanceNavigationTiming/not restored reasons=] 626 | to the result of creating a 627 | NotRestoredReasons object given |document|'s [=Document/not restored reasons=].
  13. 628 |
  14. add |navigationTimingEntry| to |global|'s 629 | performance entry buffer. 630 |
631 | 632 |

To queue the navigation timing entry for {{Document}} |document|, 633 | queue |document|'s 634 | [=navigation timing entry=]. 635 |

636 | 637 |
638 |

639 | Privacy Considerations 640 |

641 |
642 |

643 | Information disclosure 644 |

645 |

646 | There is the potential for disclosing an end-user's browsing and 647 | activity history by using carefully crafted timing attacks. For 648 | instance, the unloading time reveals how long the previous page takes 649 | to execute its unload handler, which could be used to infer the 650 | user's login status. These attacks have been mitigated by enforcing 651 | the [=same origin=] check algorithm when unloading a document, as detailed in 652 | the HTML spec. 653 |

654 |

655 | The relaxed same 657 | origin policy doesn't provide sufficient protection against 658 | unauthorized visits across documents. In shared hosting, an untrusted 659 | third party is able to host an HTTP server at the same IP address but 660 | on a different port. 661 |

662 |
663 |
664 |

665 | Cross-directory access 666 |

667 |

668 | Different pages sharing one host name, for example contents from 669 | different authors hosted on sites with user generated content are 670 | considered from the same origin because there is no feature to 671 | restrict the access by pathname. Navigating between these pages 672 | allows a latter page to access timing information of the previous 673 | one, such as timing regarding redirection and unload event. 674 |

675 |
676 |
677 |
678 |

679 | Security Considerations 680 |

681 |

682 | The {{PerformanceNavigationTiming}} interface exposes timing 683 | information about the previous document to the current document. 684 | To limit the access to {{PerformanceNavigationTiming}} attributes which 685 | include information on the previous document, the 686 | previous document 687 | unloading algorithm enforces the same origin policy 688 | and attributes related to the previous document are set to zero. 689 |

690 |
691 |

692 | Detecting proxy servers 693 |

694 |

695 | In case a proxy is deployed between the user agent and the web 696 | server, the time interval between the connectStart 698 | and the connectEnd 700 | attributes indicates the delay between the user agent and the proxy 701 | instead of the web server. With that, web server can potentially 702 | infer the existence of the proxy. For SOCKS proxy, this time interval 703 | includes the proxy authentication time and time the proxy takes to 704 | connect to the web server, which obfuscate the proxy detection. In 705 | case of an HTTP proxy, the user agent might not have any knowledge 706 | about the proxy server at all so it's not always feasible to mitigate 707 | this attack. 708 |

709 |
710 |
711 |
712 |

713 | Obsolete 714 |

715 |

716 | This section defines attributes and interfaces previously introduced in 717 | [[NAVIGATION-TIMING]] Level 1 and are kept here for backwards 718 | compatibility. Authors should not use the following interfaces and are 719 | strongly advised to use the new 720 | {{PerformanceNavigationTiming}} interface—see summary 721 | of changes and improvements. 722 |

723 |
724 |

725 | The PerformanceTiming interface 726 |

727 |
 728 | [Exposed=Window]
 729 | interface PerformanceTiming {
 730 |   readonly attribute unsigned long long navigationStart;
 731 |   readonly attribute unsigned long long unloadEventStart;
 732 |   readonly attribute unsigned long long unloadEventEnd;
 733 |   readonly attribute unsigned long long redirectStart;
 734 |   readonly attribute unsigned long long redirectEnd;
 735 |   readonly attribute unsigned long long fetchStart;
 736 |   readonly attribute unsigned long long domainLookupStart;
 737 |   readonly attribute unsigned long long domainLookupEnd;
 738 |   readonly attribute unsigned long long connectStart;
 739 |   readonly attribute unsigned long long connectEnd;
 740 |   readonly attribute unsigned long long secureConnectionStart;
 741 |   readonly attribute unsigned long long requestStart;
 742 |   readonly attribute unsigned long long responseStart;
 743 |   readonly attribute unsigned long long responseEnd;
 744 |   readonly attribute unsigned long long domLoading;
 745 |   readonly attribute unsigned long long domInteractive;
 746 |   readonly attribute unsigned long long domContentLoadedEventStart;
 747 |   readonly attribute unsigned long long domContentLoadedEventEnd;
 748 |   readonly attribute unsigned long long domComplete;
 749 |   readonly attribute unsigned long long loadEventStart;
 750 |   readonly attribute unsigned long long loadEventEnd;
 751 |   [Default] object toJSON();
 752 | };
 753 | 
754 |

755 | All time values defined in this section are measured in milliseconds 756 | since midnight of . 758 |

759 |
760 |
761 | navigationStart 762 |
763 |
764 |

765 | This attribute must return the time immediately after the user 766 | agent finishes prompting 768 | to unload the previous document. If there is no previous 769 | document, this attribute must return the time the current 770 | document is created. 771 |

772 |

773 | This attribute is not defined for 774 | {{PerformanceNavigationTiming}}. Instead, authors can use 775 | {{Performance/timeOrigin}} to obtain an equivalent timestamp. 776 |

777 |
778 |
779 | unloadEventStart 780 |
781 |
782 |

783 | If the previous document and the current document have the same 784 | origin, this attribute 785 | must return the time immediately before the user agent starts the 786 | unload event 788 | of the previous document. If there is no previous document or the 789 | previous document has a different origin than the current document, this 791 | attribute must return zero. 792 |

793 |
794 |
795 | unloadEventEnd 796 |
797 |
798 |

799 | If the previous document and the current document have the same 800 | same origin, this attribute 801 | must return the time immediately after the user agent finishes 802 | the unload event 804 | of the previous document. If there is no previous document or the 805 | previous document has a different origin than the current document or the 807 | unload is not yet completed, this attribute must return zero. 808 |

809 |

810 | If there are HTTP 811 | redirects when navigating and not all the redirects are from 812 | the same origin, both 813 | {{PerformanceTiming.unloadEventStart}} and 814 | {{PerformanceTiming.unloadEventEnd}} must return zero. 815 |

816 |
817 |
818 | redirectStart 819 |
820 |
821 |

822 | If there are HTTP 823 | redirects when navigating and if all the redirects are from 824 | the same origin, this 825 | attribute must return the starting time of the fetch 827 | that initiates the redirect. Otherwise, this attribute must 828 | return zero. 829 |

830 |
831 |
832 | redirectEnd 833 |
834 |
835 |

836 | If there are HTTP 837 | redirects when navigating and all redirects are from the same 838 | origin, this attribute 839 | must return the time immediately after receiving the last byte of 840 | the response of the last redirect. Otherwise, this attribute must 841 | return zero. 842 |

843 |
844 |
845 | fetchStart 846 |
847 |
848 |

849 | If the new resource is to be fetched 851 | using a "GET" request 852 | method, fetchStart must return the time immediately before 853 | the user agent starts checking the [[RFC7234|HTTP cache]]. Otherwise, it must 854 | return the time when 855 | the user agent starts fetching the 857 | resource. 858 |

859 |
860 |
861 | domainLookupStart 862 |
863 |
864 |

865 | This attribute must return the time immediately before the user 866 | agent starts the domain name lookup for the current document. If 867 | a persistent 869 | connection [[RFC2616]] is used or the current document is 870 | retrieved from the [[RFC7234|HTTP cache]] or local resources, this attribute must 871 | return the same value as {{PerformanceTiming.fetchStart}}. 872 |

873 |
874 |
875 | domainLookupEnd 876 |
877 |
878 |

879 | This attribute must return the time immediately after the user 880 | agent finishes the domain name lookup for the current document. 881 | If a persistent 883 | connection [[RFC2616]] is used or the current document is 884 | retrieved from the [[RFC7234|HTTP cache]] or local resources, this attribute must 885 | return the same value as {{PerformanceTiming.fetchStart}}. 886 |

887 |
888 |

889 | Checking and retrieving contents from the 891 | HTTP cache [[RFC2616]] is part of the fetching 893 | process. It's covered by the 894 | {{PerformanceTiming.requestStart}}, 895 | {{PerformanceTiming.responseStart}} and 896 | {{PerformanceTiming.responseEnd}} attributes. 897 |

898 |
899 |

900 | In case where the user agent already has the domain information 901 | in cache, domainLookupStart and domainLookupEnd represent the 902 | times when the user agent starts and ends the domain data 903 | retrieval from the cache. 904 |

905 |
906 |
907 | connectStart 908 |
909 |
910 |

911 | This attribute must return the time immediately before the user 912 | agent start establishing the connection to the server to retrieve 913 | the document. If a persistent 915 | connection [[RFC2616]] is used or the current document is 916 | retrieved from the [[RFC7234|HTTP cache]] or local resources, this attribute must 917 | return value of {{PerformanceTiming.domainLookupEnd}}. 918 |

919 |
920 |
921 | connectEnd 922 |
923 |
924 |

925 | This attribute must return the time immediately after the user 926 | agent finishes establishing the connection to the server to 927 | retrieve the current document. If a persistent 929 | connection [[RFC2616]] is used or the current document is 930 | retrieved from the [[RFC7234|HTTP cache]] or local resources, this attribute must 931 | return the value of {{PerformanceTiming.domainLookupEnd}}. 932 |

933 |

934 | If the transport connection fails and the user agent reopens a 935 | connection, {{PerformanceTiming.connectStart}} and 936 | {{PerformanceTiming.connectEnd}} should return the corresponding 937 | values of the new connection. 938 |

939 |

940 | {{PerformanceTiming.connectEnd}} must include the time interval 941 | to establish the transport connection as well as other time 942 | interval such as SSL handshake and SOCKS authentication. 943 |

944 |
945 |
946 | secureConnectionStart 947 |
948 |
949 |

950 | This attribute is optional. User agents that don't have this 951 | attribute available must set it as undefined. When this attribute 952 | is available, if the scheme [[URL]] of the current page 954 | is "https", this attribute must return the time immediately 955 | before the user agent starts the handshake process to secure the 956 | current connection. If this attribute is available but HTTPS is 957 | not used, this attribute must return zero. 958 |

959 |
960 |
961 | requestStart 962 |
963 |
964 |

965 | This attribute must return the time immediately before the user 966 | agent starts requesting the current document from the server, or 967 | from the [[RFC7234|HTTP cache]] or from local resources. 968 |

969 |

970 | If the transport connection fails after a request is sent and the 971 | user agent reopens a connection and resend the request, 972 | {{PerformanceTiming.requestStart}} should return the 973 | corresponding values of the new request. 974 |

975 |
976 |

977 | This interface does not include an attribute to represent the 978 | completion of sending the request, e.g., requestEnd. 979 |

980 |
    981 |
  • Completion of sending the request from the user agent does 982 | not always indicate the corresponding completion time in the 983 | network transport, which brings most of the benefit of having 984 | such an attribute. 985 |
  • 986 |
  • Some user agents have high cost to determine the actual 987 | completion time of sending the request due to the HTTP layer 988 | encapsulation. 989 |
  • 990 |
991 |
992 |
993 |
994 | responseStart 995 |
996 |
997 |

998 | This attribute must return the time immediately after the user 999 | agent receives the first byte of the response from the server, or 1000 | from the [[RFC7234|HTTP cache]] or from local resources. 1001 |

1002 |
1003 |
1004 | responseEnd 1005 |
1006 |
1007 |

1008 | This attribute must return the time immediately after the user 1009 | agent receives the last byte of the current document or 1010 | immediately before the transport connection is closed, whichever 1011 | comes first. The document here can be received either from the 1012 | server, the [[RFC7234|HTTP cache]] or from local resources. 1013 |

1014 |
1015 |
1016 | domLoading 1017 |
1018 |
1019 |

1020 | This attribute must return the time immediately before the user 1021 | agent sets the current document 1023 | readiness to "loading". 1025 |

1026 |

1027 | Due to differences in when a Document object is created in 1028 | existing user agents, the value returned by the 1029 | domLoading is implementation specific and should not 1030 | be used in meaningful metrics. 1031 |

1032 |
1033 |
1034 | domInteractive 1035 |
1036 |
1037 |

1038 | This attribute must return the time immediately before the user 1039 | agent sets the current document 1041 | readiness to "interactive". 1043 |

1044 |
1045 |
1046 | domContentLoadedEventStart 1047 |
1048 |
1049 |

1050 | This attribute must return the time immediately before the user 1051 | agent fires the 1052 | DOMContentLoaded event at the Document. 1054 |

1055 |
1056 |
1057 | domContentLoadedEventEnd 1058 |
1059 |
1060 |

1061 | This attribute must return the time immediately after the 1062 | document's DOMContentLoaded event completes. 1064 |

1065 |
1066 |
1067 | domComplete 1068 |
1069 |
1070 |

1071 | This attribute must return the time immediately before the user 1072 | agent sets the current document 1074 | readiness to "complete". 1076 |

1077 |

1078 | If the current document 1080 | readiness changes to the same state multiple times, 1081 | {{PerformanceTiming.domLoading}}, 1082 | {{PerformanceTiming.domInteractive}}, 1083 | {{PerformanceTiming.domContentLoadedEventStart}}, 1084 | {{PerformanceTiming.domContentLoadedEventEnd}} and 1085 | {{PerformanceTiming.domComplete}} must return the time of the 1086 | first occurrence of the corresponding document readiness 1088 | change. 1089 |

1090 |
1091 |
1092 | loadEventStart 1093 |
1094 |
1095 |

1096 | This attribute must return the time immediately before the load 1097 | event of the current document is fired. It must return zero when 1098 | the load event is not fired yet. 1099 |

1100 |
1101 |
1102 | loadEventEnd 1103 |
1104 |
1105 |

1106 | This attribute must return the time when the load event of the 1107 | current document is completed. It must return zero when the load 1108 | event is not fired or is not completed. 1109 |

1110 |
1111 |
1112 | toJSON() 1113 |
1114 |
1115 | Runs the [=default toJSON steps=] for [=this=]. 1116 |
1117 |
1118 |
1119 |
1120 |

1121 | The PerformanceNavigation interface 1122 |

1123 |
1124 | [Exposed=Window]
1125 | interface PerformanceNavigation {
1126 |   const unsigned short TYPE_NAVIGATE = 0;
1127 |   const unsigned short TYPE_RELOAD = 1;
1128 |   const unsigned short TYPE_BACK_FORWARD = 2;
1129 |   const unsigned short TYPE_RESERVED = 255;
1130 |   readonly attribute unsigned short type;
1131 |   readonly attribute unsigned short redirectCount;
1132 |   [Default] object toJSON();
1133 | };
1134 | 
1135 |
1136 |
1137 | TYPE_NAVIGATE 1138 |
1139 |
1140 |

1141 | Navigation where the 1142 | history handling behavior 1143 | is set to 1144 | "default" or 1145 | "replace". 1146 |

1147 |
1148 |
1149 | TYPE_RELOAD 1150 |
1151 |
1152 |

1153 | Navigation where the 1154 | history handling behavior 1155 | is set to 1156 | "reload". 1157 |

1158 |
1159 |
1160 | TYPE_BACK_FORWARD 1161 |
1162 |
1163 |

1164 | Navigation where the 1165 | history handling behavior 1166 | is set to 1167 | "entry update". 1168 |

1169 |
1170 |
1171 | TYPE_RESERVED 1172 |
1173 |
1174 |

1175 | Any navigation types not defined by values above. 1176 |

1177 |
1178 |
1179 | type 1180 |
1181 |
1182 |

1183 | This attribute must return the type of the last non-redirect 1184 | navigation 1185 | in the current browsing context. It must have one of the 1186 | following navigation type values. 1188 |

1189 |

1190 | Client-side redirects, such as those using the Refresh 1192 | pragma directive, are not considered HTTP redirects by this spec. In those 1194 | cases, the type 1195 | attribute should return appropriate value, such as 1196 | TYPE_RELOAD if reloading the current page, or 1197 | TYPE_NAVIGATE if navigating to a new URL. 1198 |

1199 |
1200 |
1201 | redirectCount 1202 |
1203 |
1204 |

1205 | This attribute must return the number of redirects since the last 1206 | non-redirect navigation under the current browsing context. If 1207 | there is no redirect or there is any redirect that is not from 1208 | the same origin as the 1209 | destination document, this attribute must return zero. 1210 |

1211 |
1212 |
1213 | toJSON() 1214 |
1215 |
1216 | Runs the [=default toJSON steps=] for [=this=]. 1217 |
1218 |
1219 |
1220 |
1221 |

1222 | Extensions to the Performance interface 1223 |

1224 |
1225 |         [Exposed=Window]
1226 |         partial interface Performance {
1227 |           [SameObject]
1228 |           readonly attribute PerformanceTiming timing;
1229 |           [SameObject]
1230 |           readonly attribute PerformanceNavigation navigation;
1231 |         };
1232 |         
1233 |

1234 | The Performance interface is defined in 1235 | [[PERFORMANCE-TIMELINE-2]]. 1236 |

1237 |
1238 |
1239 | timing 1240 |
1241 |
1242 |

1243 | The timing attribute represents the timing 1244 | information related to the browsing contexts since the last 1245 | non-redirect navigation. This attribute is defined by the 1246 | PerformanceTiming interface. 1247 |

1248 |
1249 |
1250 | navigation 1251 |
1252 |
1253 |

1254 | The navigation attribute is defined by the 1255 | PerformanceNavigation interface. 1256 |

1257 |
1258 |
1259 |
1260 |
1261 |
1262 |
1263 |

1264 | Acknowledgments 1265 |

1266 |

1267 | Thanks to Anne Van Kesteren, Arvind Jain, Boris Zbarsky, Jason Weber, 1268 | Jonas Sicking, James Simonsen, Karen Anderson, Nic Jansma, Philippe Le 1269 | Hegaret, Steve Souders, Todd Reifsteck, Tony Gentilcore, William Chan 1270 | and Zhiheng Wang for their contributions to this work. 1271 |

1272 |
1273 | 1274 | 1275 | -------------------------------------------------------------------------------- /tidyconfig.txt: -------------------------------------------------------------------------------- 1 | char-encoding: utf8 2 | indent: yes 3 | wrap: 80 4 | tidy-mark: no 5 | -------------------------------------------------------------------------------- /w3c.json: -------------------------------------------------------------------------------- 1 | { 2 | "group": 45211, 3 | "contacts": [ 4 | "plehegar" 5 | ], 6 | "shortName": "navigation-timing", 7 | "policy": "open", 8 | "repo-type": "rec-track" 9 | } --------------------------------------------------------------------------------