Navigation Timing — ナビゲーションの計時

2012 年 12 月 17 日付 W3C 勧告

このバージョン:
http://www.w3.org/TR/2012/REC-navigation-timing-20121217/
最新バージョン:
http://www.w3.org/TR/navigation-timing/
以前のバージョン:
http://www.w3.org/TR/2012/PR-navigation-timing-20120726/
編集:
Zhiheng Wang (Google Inc.) <>

公式の修正が含まれ得る,この文書の エラッタ も参照願います。 Please refer to the errata for this document, which may include some normative corrections.

翻訳 もご覧ください。 See also translations.

Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.

要約

この仕様は、ウェブアプリケーションからナビゲーション(ページ遷移)と要素に関する計時情報へアクセスするためのインタフェースを規定する。 This specification defines an interface for web applications to access timing information related to navigation and elements.

この文書の位置付け

この節では公開された時点におけるこの文書の位置付けについて述べます。他の文書がこの文書に取って代わる可能性があります。W3C の現在の出版リストとこの文書の最新の状態は http://www.w3.org/TR/ W3C technical reports index にて見られます。 This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

これは W3C 勧告( Recommendation ) "Navigation Timing Specification" です。 勧告候補の段階で 2012 年に作成された, Navigation Timing テストスイート に基づく 実装報告書 が入手できます。 This is the W3C Recommendation for "Navigation Timing Specification". An implementation report, produced during the Candidate Recommendation phase in 2012, is available based on the Navigation Timing test suite.

コメントは、件名の最初の部分を [NavigationTiming] としたメールを public-web-perf@w3.orgアーカイブ) 宛てまで送られるよう願います。 Please send comments to public-web-perf@w3.org (archived) with [NavigationTiming] at the start of the subject line.

この文書は Web Performance Working Group により作成されました。 以前の草案との 差分 も用意されています。 This document is produced by the Web Performance Working Group. A diff document with the previous draft is available.

この文書は W3C メンバ, ソフトウェア開発者達, W3C グループや関心を持つ団体から吟味され、ディレクターにより W3C 勧告として承認されたものです。 これは安定的な文書であり、規範として利用したり,他の文書に引用することができます。 勧告の発行における W3C の役割は、仕様に対する注目を集め,広範囲への普及を促進する所にあります。 これはウェブの相互運用性と機能性を向上させるものです。 This document has been reviewed by W3C Members, by software developers, and by other W3C groups and interested parties, and is endorsed by the Director as a W3C Recommendation. It is a stable document and may be used as reference material or cited from another document. W3C's role in making the Recommendation is to draw attention to the specification and to promote its widespread deployment. This enhances the functionality and interoperability of the Web.

この文書は 5 February 2004 W3C Patent Policy に従事するグループにより作成されました。 W3C はグループの成果物に関連して public list of any patent disclosures を作成し維持管理しています。 そのページには特許開示の手引きも含まれます。 特許に関する実際的知識を持ち、そこに Essential Claim(s) が含まれていると主張する者は W3C Patent Policy 6 節 に従って情報を公開しなければなりません。 This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

1 序論

この節は規定ではない。 This section is non-normative.

利用者が知覚し得る遅延はウェブアプリケーションにとり重要な品質ベンチマークである。 [JSMEASURE] などの,スクリプトに基づく仕組みは、アプリケーション内における利用者遅延の測定のための包括的な手段を提供し得る一方で、多くの局面で,それらはエンドツーエンドにおける遅延の完全な様相を提供できない。 User latency is an important quality benchmark for Web Applications. While script-based mechanisms, such as the one described in [JSMEASURE], can provide comprehensive instrumentation for user latency measurements within an application, in many cases, they are unable to provide a complete end-to-end latency picture.

例えば、次のスクリプトは単純な方法により,ページが完全に読み込まれるまでの時間の測定を試行する: For example, the following script shows a naive attempt to measure the time it takes to fully load a page:

<html>
<head>
<script type="text/javascript">

var start = new Date().getTime();
function onLoad() {
  var now = new Date().getTime();
  var latency = now - start;
  alert("page loading time: " + latency);
}

</script>
</head>
<body onload="onLoad()">
<!- Main page body goes from here. -->
</body>
</html>

スクリプトは head タグ内の JavaScript の最初のビットが実行されたから,ページが読み込まれるまでの時間は算出するが、サーバからページの回収に要した時間についての情報は供さない。 The script calculates the time it takes to load the page after the first bit of JavaScript in the head is executed, but it does not give any information about the time it takes to get the page from the server.

ユーザエクスペリエンスについての完全な情報を得る必要性を解決するため、この文書は PerformanceTiming インタフェースを導入する。 このインタフェースは、アプリケーション内におけるクライアント側の完全な遅延測定を可能にする, JavaScript による仕組みを提供する。 この提案されたインタフェースにより、前の例を,利用者が感知し得るページ読み込み時間を測定するものに仕立て上げられる。 To address the need for complete information on user experience, this document introduces the PerformanceTiming interfaces. This interface allows JavaScript mechanisms to provide complete client-side latency measurements within applications. With the proposed interface, the previous example can be modified to measure a user's perceived page load time.

次のスクリプトは、直近のナビゲーションからページが読み込まれるまでの時間を算出する: The following script calculates how much time to load a page since the most recent navigation.

<html>
<head>
<script type="text/javascript">
function onLoad() {
  var now = new Date().getTime();
  var page_load_time = now - performance.timing.navigationStart;
  alert("User-perceived page loading time: " + page_load_time);
}

</script>
</head>
<body onload="onLoad()">
<!- Main page body goes from here. -->
</body>
</html>

この仕様で提供されるインタフェースは、 UA のいかなる種類の速度性能ベンチマークへの利用も意図するものではない。 The interface provided by this work does not intend to be used as any sort of performance benchmark for user agents.

2 適合性の要件

明示的に規定でないもの( “参考” )と記された節に加え,この仕様におけるすべての図式, 例, 注記は規定ではない。 他のすべては規定である。 All diagrams, examples, and notes in this specification are non-normative, as are all sections explicitly marked non-normative. Everything else in this specification is normative.

この文書におけるキーワード: 「〜しなければ(〜しては)ならない」 = “MUST (NOT)”, 「要求される」= REQUIRED, 「〜すべきである(でない)」 = “SHOULD (NOT)”, 「推奨される」 = “RECOMMENDED”, 「〜してもよい」 = “MAY”, 「任意選択 」 = “OPTIONAL”, は、 [RFC 2119] に則って解釈されるものとする。 可読性のため、この仕様ではこれらの語が大文字化されて出現することはない。 The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this document are to be interpreted as described in RFC 2119. For readability, these words do not appear in all uppercase letters in this specification.

アルゴリズムの中の命令的言い回しによる要件(例えば “先頭部のスペース文字並びを取り除く”, あるいは “false を返してこの手続きを終了” など)は、アルゴリズムを導入する際に利用されているキーワード( “〜しなければならない ”, “〜すべき”, “〜してもよい” )の意味の下で解釈されることになる。 Requirements phrased in the imperative as part of algorithms (such as "strip any leading space characters" or "return false and abort these steps") are to be interpreted with the meaning of the key word ("must", "should", "may", etc) used in introducing the algorithm.

一部の適合性の要件は、属性, メソッド, オブジェクトに対する要件として言及されている。 その種の要件は UA (利用者エージェント)に対する要件として解釈される。 Some conformance requirements are phrased as requirements on attributes, methods or objects. Such requirements are to be interpreted as requirements on user agents.

アルゴリズムまたは特定の手続きとして記される適合性の要件は、最終的な結果が等価になるのであれば,どのように実装されてもよい。(特に、この仕様で定義されるアルゴリズムは追い易くなるように記述されており,パフォーマンスは考慮されていない。) Conformance requirements phrased as algorithms or specific steps may be implemented in any manner, so long as the end result is equivalent. (In particular, the algorithms defined in this specification are intended to be easy to follow, and not intended to be performant.)

この仕様の IDL 片は、 Web IDL 仕様に述べられる,適合 IDL 片に課される要件に従うものとして、解釈されなければならない。 [Web IDL] The IDL fragments in this specification must be interpreted as required for conforming IDL fragments, as described in the Web IDL specification. [Web IDL]

3 語法

Foo をインタフェースとするとき, “Foo インタフェースを実装するオブジェクト” の略記として、語 “Foo オブジェクト” が用いられる。 The construction "a Foo object", where Foo is actually an interface, is sometimes used instead of the more accurate "an object implementing the interface Foo".

語 “ナビゲーション” は navigating (ページ遷移)の動作を指す。 The term "navigation" refers to the act of navigating.

語 “JavaScript” は ECMA-262 を指す。 ECMA-262 を指す公式の語 ECMAScript もあるが、 JavaScript の方が広く知れ渡っているので。 The term "JavaScript" is used to refer to ECMA-262, rather than the official term ECMAScript, since the term JavaScript is more widely known.

この仕様を通して、時刻は 1970 年 1 月 1 日 0 時 0 分 0 秒 (UTC) を起点としてミリ秒単位で計測されたものとする。 注記: Navigation Timing 2 仕様 [Navigation Timing 2] では、代わりにサブミリ秒 【具体的にはミリ秒の 1/1000 】 の解像度による,ナビゲーションに関連する計時情報へのアクセスが可能にされている。 Throughout this work, time is measured in milliseconds since midnight of January 1, 1970 (UTC). Note that the Navigation Timing 2 specification [Navigation Timing 2] allows access to timing information related to navigation using sub-milliseconds resolution instead.

4 ナビゲーションの計時

4.1 概要

この節は規定ではない。 This section is non-normative

この仕様は、 Web アプリケーションに計時関連の情報を提供するインタフェースを導入する。 Web アプリケーションがこれらのインタフェースから供される情報をどのように収集, 記憶, 報告するかについては、この仕様の対象外である。 This specification introduces an interface that provides Web applications with timing-related information. This specification does not cover how Web applications leverage these interfaces to collect, store and report the provided information.

4.2 PerformanceTiming インタフェース

interface PerformanceTiming {
  readonly attribute unsigned long long navigationStart;
  readonly attribute unsigned long long unloadEventStart;
  readonly attribute unsigned long long unloadEventEnd;
  readonly attribute unsigned long long redirectStart;
  readonly attribute unsigned long long redirectEnd;
  readonly attribute unsigned long long fetchStart;
  readonly attribute unsigned long long domainLookupStart;
  readonly attribute unsigned long long domainLookupEnd;
  readonly attribute unsigned long long connectStart;
  readonly attribute unsigned long long connectEnd;
  readonly attribute unsigned long long secureConnectionStart;
  readonly attribute unsigned long long requestStart;
  readonly attribute unsigned long long responseStart;
  readonly attribute unsigned long long responseEnd;
  readonly attribute unsigned long long domLoading;
  readonly attribute unsigned long long domInteractive;
  readonly attribute unsigned long long domContentLoadedEventStart;
  readonly attribute unsigned long long domContentLoadedEventEnd;
  readonly attribute unsigned long long domComplete;
  readonly attribute unsigned long long loadEventStart;
  readonly attribute unsigned long long loadEventEnd;
};
【利用中のブラウザで、このページについて,これらの属性値の (括弧内は navigationStart との差分)/他ページでも利用できるブックマークレット(ブラウザのセキュリティポリシーによっては,アドレスバーからは動作不可)
navigationStart 属性

この属性は、 UA が前の文書の prompting to unload を終了した直後の時刻を返さなければならない。 前の文書が存在しない場合、この属性は fetchStart と同じ値を返さなければならない。 This attribute must return the time immediately after the user agent finishes prompting to unload the previous document. If there is no previous document, this attribute must return the same value as fetchStart.

unloadEventStart 属性

前の文書と現在の文書が同じ生成元 [RFC 6454] に属する場合、この属性は UA が前の文書の unload イベントを開始する直前の時刻を返さなければならない。 前の文書が存在しない,または前の文書が現在の文書と異なる生成元に属する場合、この属性はゼロを返さなければならない。 If the previous document and the current document have the same origin [IETF RFC 6454], this attribute must return the time immediately before the user agent starts the unload event of the previous document. If there is no previous document or the previous document has a different origin than the current document, this attribute must return zero.

unloadEventEnd 属性

前の文書と現在の文書が同じ生成元に属する場合、この属性は UA が前の文書の unload イベントを終了した直後の時刻を返さなければならない。 前の文書が存在しない,または前の文書が現在の文書と異なる生成元に属する,あるいは前の文書の unload が完了していない場合、この属性はゼロを返さなければならない。 If the previous document and the current document have the same same origin, this attribute must return the time immediately after the user agent finishes the unload event of the previous document. If there is no previous document or the previous document has a different origin than the current document or the unload is not yet completed, this attribute must return zero.

ナビゲーションの際に HTTP リダイレクト またはそれに等価なもの 【以下、 “リダイレクト 等” と記す】 があって, かつ その中に互いに異なる生成元に属するリダイレクト がある場合、 unloadEventStartunloadEventEnd はいずれも,ゼロを返さなければならない。 If there are HTTP redirects or equivalent when navigating and not all the redirects or equivalent are from the same origin, both unloadEventStart and unloadEventEnd must return the zero.

redirectStart 属性

ナビゲーションの際に HTTP リダイレクト があって, かつ すべてのリダイレクト が同じ生成元に属する場合、この属性は,そのリダイレクトを始める 取得開始の時刻 を返さなければならない。 他の場合、この属性はゼロを返さなければならない。 If there are HTTP redirects or equivalent when navigating and if all the redirects or equivalent are from the same origin, this attribute must return the starting time of the fetch that initiates the redirect. Otherwise, this attribute must return zero.

redirectEnd 属性

ナビゲーションの際に HTTP リダイレクト があって, かつ すべてのリダイレクト が同じ生成元に属する場合、この属性は,その最後のリダイレクトの応答の最後のバイトを受信した直後の時刻を返さなければならない。 他の場合、この属性はゼロを返さなければならない。 If there are HTTP redirects or equivalent when navigating and all redirects and equivalents are from the same origin, this attribute must return the time immediately after receiving the last byte of the response of the last redirect. Otherwise, this attribute must return zero.

fetchStart 属性

HTTP GET またはそれに等価なもの 【以下、 “HTTP GET 等” と記す】 を用いて新たなリソースが取得された場合、 fetchStart は UA が 関連のアプリケーションキャッシュのチェックを開始する直前の時刻を返さなければならない。 他の場合、 UA がリソースの取得を開始した時刻を返さなければならない。 If the new resource is to be fetched using HTTP GET or equivalent, fetchStart must return the time immediately before the user agent starts checking any relevant application caches. Otherwise, it must return the time when the user agent starts fetching the resource.

domainLookupStart 属性

この属性は、現在の文書のドメイン名検索を開始する直前の時刻を返さなければならない。 持続的接続 [RFC 2616] が利用されている,または 現在の文書が関連のアプリケーションキャッシュや局所リソースから回収されている場合、この属性は fetchStart と同じ値を返さなければならない。 This attribute must return the time immediately before the user agent starts the domain name lookup for the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the same value as fetchStart.

domainLookupEnd 属性

この属性は、 UA が現在の文書に対するドメイン名検索を終了した直後の時刻を返さなければならない。 持続的接続 [RFC 2616] が利用されている,または 現在の文書が関連のアプリケーションキャッシュや局所リソースから回収されている場合、この属性は fetchStart と同じ値を返さなければならない。 This attribute must return the time immediately after the user agent finishes the domain name lookup for the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the same value as fetchStart.

この節は規定ではない。 This section is non-normative.

HTTP キャッシュ [RFC 2616] からの内容のチェックと回収は取得プロセスの一部である。 それは requestStart, responseStart, responseEnd 属性の対象である。 Checking and retrieving contents from the HTTP cache [RFC 2616] is part of the fetching process. It's covered by the requestStart, responseStart and responseEnd attributes.

UA がキャッシュ内にドメイン情報をすでに持っている場合、 domainLookupStartdomainLookupEnd は,それぞれ, UA によるキャッシュからのドメインデータの回収の開始と終了の時刻を表現する。 In case where the user agent already has the domain information in cache, domainLookupStart and domainLookupEnd represent the times when the user agent starts and ends the domain data retrieval from the cache.

connectStart 属性

この属性は、 UA が文書を回収するためのサーバへの接続の確立を開始する直前の時刻を返さなければならない。 持続的接続 [RFC 2616] が利用されている,または 現在の文書が関連のアプリケーションキャッシュや局所リソースから回収されている場合、この属性は domainLookupEnd と同じ値を返さなければならない。 This attribute must return the time immediately before the user agent start establishing the connection to the server to retrieve the document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return value of domainLookupEnd.

connectEnd 属性

この属性は、 UA が文書を回収するためのサーバへの接続の確立を終了した直後の時刻を返さなければならない。 持続的接続 [RFC 2616] が利用されている,または 現在の文書が関連のアプリケーションキャッシュや局所リソースから回収されている場合、この属性は domainLookupEnd と同じ値を返さなければならない。 This attribute must return the time immediately after the user agent finishes establishing the connection to the server to retrieve the current document. If a persistent connection [RFC 2616] is used or the current document is retrieved from relevant application caches or local resources, this attribute must return the value of domainLookupEnd

transport 接続が失敗し, かつ UA が接続を再オープンした場合、 connectStartconnectEnd 新たな接続に対応する値を返すべきである。 If the transport connection fails and the user agent reopens a connection, connectStart and connectEnd should return the corresponding values of the new connection.

connectEnd には、 SSL ハンドシェイクや SOCKS 認証も含めて, transport 接続の確立に要した時間も含まれなければならない。 connectEnd must include the time interval to establish the transport connection as well as other time interval such as SSL handshake and SOCKS authentication.

secureConnectionStart 属性

この属性は UA の任意選択である。 この属性が利用できない UA においては、 undefined にされなければならない。 この属性が利用可能かつ、現在のページの URL スキームHTTPS である場合、この属性は UA が 現在の接続をセキュアにするためのハンドシェイクプロセスを開始する直前の時刻を返さなければならない。 この属性が利用可能にされているが, HTTPS は利用されていない場合、この属性はゼロを返さなければならない. This attribute is optional. User agents that don't have this attribute available must set it as undefined. When this attribute is available, if the scheme of the current page is HTTPS, this attribute must return the time immediately before the user agent starts the handshake process to secure the current connection. If this attribute is available but HTTPS is not used, this attribute must return zero.

requestStart 属性

この属性は、 UA がサーバから, または関連のアプリケーションキャッシュや局所リソースから,現在の文書のリクエストを開始する直前の時刻を返さなければならない。 This attribute must return the time immediately before the user agent starts requesting the current document from the server, or from relevant application caches or from local resources.

リクエストを送信した後に transport 接続が失敗して, UA が接続を再オープンしてリクエストを再送信した場合、 requestStart は,新たなリクエストに対応している値を返すべきである。 If the transport connection fails after a request is sent and the user agent reopens a connection and resend the request, requestStart should return the corresponding values of the new request.

このインタフェースには requestEnd のような類いの,リクエストの送信の完了を表現する属性は含まれていない。 This interface does not include an attribute to represent the completion of sending the request, e.g., requestEnd.

  • UA からのリクエストの送信の完了は、(その種の属性の利点の大半を占める)ネットワーク transport における対応する完了時刻を常に指示するとは限らない。 Completion of sending the request from the user agent does not always indicate the corresponding completion time in the network transport, which brings most of the benefit of having such an attribute.
  • 一部の UA においては、HTTP レイヤのカプセル化のため,リクエストの送信の実際の完了時刻の決定にコストがかかる。 Some user agents have high cost to determine the actual completion time of sending the request due to the HTTP layer encapsulation.
responseStart 属性

この属性は、 UA がサーバからの, または関連のアプリケーションキャッシュや局所リソースからの,応答の最初のバイトを受信した直後の時刻を返さなければならない。 This attribute must return the time immediately after the user agent receives the first byte of the response from the server, or from relevant application caches or from local resources.

responseEnd 属性

この属性は、 UA が 現在の文書の最後のバイトを受信した直後の時刻と, transport 接続が切断される直前の時刻のうち,早い方を返さなければならない。 ここでの文書は、サーバから, および関連のアプリケーションキャッシュや局所リソースから,のいずれから受信されたものも含まれる。 This attribute must return the time immediately after the user agent receives the last byte of the current document or immediately before the transport connection is closed, whichever comes first. The document here can be received either from the server, relevant application caches or from local resources.

domLoading 属性

この属性は、 UA が現在の文書の準備状況(“current document readiness”)を "loading" に設定する直前の時刻を返さなければならない。 This attribute must return the time immediately before the user agent sets the current document readiness to "loading".

domInteractive 属性

この属性は、 UA が現在の文書の準備状況"interactive" に設定する直前の時刻を返さなければならない。 This attribute must return the time immediately before the user agent sets the current document readiness to "interactive".

domContentLoadedEventStart 属性

この属性は、 UA が Document に向けて DOMContentLoaded イベント を発火する直前の時刻を返さなければならない。 This attribute must return the time immediately before the user agent fires the DOMContentLoaded event at the Document.

domContentLoadedEventEnd 属性

この属性は、文書の DOMContentLoaded イベント が完了した直後の時刻を返さなければならない。 This attribute must return the time immediately after the document's DOMContentLoaded event completes.

domComplete 属性

この属性は、 UA が現在の文書の準備状況"complete" に設定する直前の時刻を返さなければならない。 This attribute must return the time immediately before the user agent sets the current document readiness to "complete".

現在の文書の準備状況が複数回にわたり同じ状態に変化した場合、 domLoading, domInteractive, domContentLoadedEventStart, domContentLoadedEventEnd, domComplete は、最初に生じた 現在の文書の準備状況の変化 に対応している時刻を返さなければならない。 If the current document readiness changes to the same state multiple times, domLoading, domInteractive, domContentLoadedEventStart, domContentLoadedEventEnd and domComplete must return the time of the first occurrence of the corresponding document readiness change.

loadEventStart 属性

この属性は、現在の文書に load イベントが発火される直前の時刻を返さなければならない。 load イベントがまだ発火されていないときには、ゼロを返さなければならない。 This attribute must return the time immediately before the load event of the current document is fired. It must return zero when the load event is not fired yet.

loadEventEnd 属性

この属性は、現在の文書の load イベントの発火が完了した時刻を返さなければならない。 load イベントがまだ発火されていない, またはまだ完了していないときには、ゼロを返さなければならない。 This attribute must return the time when the load event of the current document is completed. It must return zero when the load event is not fired or is not completed.

4.3 PerformanceNavigation インタフェース

interface PerformanceNavigation {
  const unsigned short TYPE_NAVIGATE = 0;
  const unsigned short TYPE_RELOAD = 1;
  const unsigned short TYPE_BACK_FORWARD = 2;
  const unsigned short TYPE_RESERVED = 255;
  readonly attribute unsigned short type;
  readonly attribute unsigned short redirectCount;
};
type 属性

この属性は、現在の閲覧文脈における最後の非リダイレクト ナビゲーション の種別を返さなければならない。 次のナビゲーション型 値のいずれかでなければならない: This attribute must return the type of the last non-redirect navigation in the current browsing context. It must have one of the following navigation type values.

TYPE_NAVIGATE

ナビゲーションが[ リンクのクリック, UA のアドレスバーへの URL 入力, フォーム送信, [ 下に挙げる TYPE_RELOADTYPE_BACK_FORWARD に利用されるもの以外の,スクリプト演算を通した初期化 ]]により開始された。 Navigation started by clicking on a link, or entering the URL in the user agent's address bar, or form submission, or initializing through a script operation other than the ones used by TYPE_RELOAD and TYPE_BACK_FORWARD as listed below.

TYPE_RELOAD

再 load 演算または location.reload() メソッドによるナビゲーション。 Navigation through the reload operation or the location.reload() method.

TYPE_BACK_FORWARD

history traversal 演算によるナビゲーション。 Navigation through a history traversal operation.

TYPE_RESERVED

上で定義されない任意のナビゲーション型。 Any navigation types not defined by values above.

Refresh pragma directive を利用する類いの,クライアント側リダイレクトは、この仕様においては HTTP リダイレクト とは見なされない。 それらの場合, type 属性は、現在のページを再 load している場合は TYPE_RELOAD, 新たな URL へのナビゲーションの場合は TYPE_NAVIGATE など,適切な値を返すべきである。 Client-side redirects, such as those using the Refresh pragma directive, are not considered HTTP redirects or equivalent by this spec. In those cases, the type attribute should return appropriate value, such as TYPE_RELOAD if reloading the current page, or TYPE_NAVIGATE if navigating to a new URL.

redirectCount 属性

この属性は、現在の閲覧文脈の下での,最後の非リダイレクトナビゲーションからのリダイレクト回数を返さなければならない。 そのようなリダイレクトが無い場合, または 行き先の文書と同じ生成元に属さないリダイレクトがある場合、この属性はゼロを返さなければならない。 This attribute must return the number of redirects since the last non-redirect navigation under the current browsing context. If there is no redirect or there is any redirect that is not from the same origin as the destination document, this attribute must return zero.

4.4 window.performance 属性

この仕様は、 HTML5 仕様が定義する Window インタフェース [HTML5] を拡張する。 The HTML5 specification defines a Window interface [HTML5], which this specification extends.

interface Performance {
  readonly attribute PerformanceTiming timing;
  readonly attribute PerformanceNavigation navigation;
};

partial interface Window {
  [Replaceable] readonly attribute Performance performance;
};

window.performance 属性は、速度性能に関する属性を保持するための区域を提供する。 The window.performance attribute provides a hosting area for performance related attributes.

timing 属性

timing 属性は、最後の非リダイレクト ナビゲーション以降の閲覧文脈に関連する計時情報を表現する。 この属性は PerformanceTiming インタフェースにて定義される。 The timing attribute represents the timing information related to the browsing contexts since the last non-redirect navigation. This attribute is defined by the PerformanceTiming interface.

navigation 属性

navigation 属性は PerformanceNavigation インタフェースにて定義される。 The navigation attribute is defined by the PerformanceNavigation interface.

5 プロセス

5.1 処理モデル

window.performance.timingwindow.performance.navigation のすべての属性は、(記述の便宜上,下の手続きにて参照されているとしても) 現在の文書の Window オブジェクトが作成される まで、書き込まれるべきでない。 All the attributes in window.performance.timing and window.performance.navigation should not be written to until the Window object of the current document is created, even though their attributes are referred to in the following steps to facilitate description.

UA は window.performance.timingwindow.performance.navigation インタフェースの無効化オプションを利用者に提供してもよい。 これらのインタフェースが無効化されている間は window.performance.timingwindow.performance.navigation も null 値を返さなければならない。 User agents may provide users the option of disabling the window.performance.timing and window.performance.navigation interfaces. When these interfaces are disabled, both window.performance.timing and window.performance.navigation must return a null value.

UA は, window.performance.timingwindow.performance.navigation がこれらのインスタンスに置換されたときは、現在の文書に結び付けられている Window オブジェクト が作成されるまで, PerformanceTiming および PerformanceNavigation インタフェースのインスタンスを維持してもよい。 A user agent may maintain instances of the PerformanceTiming and PerformanceNavigation interfaces until the Window object associated with the current document is created, when window.performance.timing and window.performance.navigation are replaced with these instances.

次の図式は規定ではない。 This illustration is non-normative.

次の図式は、 PerformanceTiming インタフェースと PerformanceNavigation インタフェースに定義される計時属性を(リダイレクトあり/なしの場合も含めて)示したものである。 【と原文には書かれているが PerformanceNavigation についての記述が図のどこにも見当たらない。】 下線付きの属性は、異なる生成元に属する文書を含むナビゲーションでは利用できない。 UA は、2つの計時の間の非標準の時区間を許容するために、その間の内部処理を行ってもよい。 【?】 The following graph illustrates the timing attributes defined by the PerformanceTiming interface and the PerformanceNavigation interface with or without redirect, respectively. Attributes underlined may not be available in navigation involving documents from different origins. User agents may perform internal processing in between timings, which allow for non-normative intervals between timings.

Timing attributes
  1. ナビゲーション が次の理由で中止された場合、 window.performance.timing および window.performance.navigation 属性には変更を加えずに,この手続きを中止する。 If the navigation is aborted for any of the following reasons, abort these steps without changing the attributes in window.performance.timing and window.performance.navigation.

    1. ナビゲーションは sandboxed navigation browsing context flag または sandboxed top-level navigation browsing context flag により中止されたか, または既存の閲覧文脈へのナビゲーションの試みがある。 The navigation is aborted due to the sandboxed navigation browsing context flag or the sandboxed top-level navigation browsing context flag, or a preexist attempt to navigate the browsing context.
    2. ナビゲーションがページ内の 素片識別子 により生じた。 The navigation is caused by fragment identifiers within the page.
    3. 新たなリソースが何らかの種類のインライン内容により処理されている。 The new resource is to be handled by some sort of inline content.
    4. 新たなリソースが閲覧文脈に影響しない仕組みを利用して処理されている。 The new resource is to be handled using a mechanism that does not affect the browsing context.
    5. 利用者が 文書の unload を拒否した The user refuses to allow the document to be unloaded.
  2. UA による前の 文書prompts to unload の直後の時刻を navigationStart に記録する。 Immediately after the user agent prompts to unload the previous document, record the current time as navigationStart.
  3. window.performance.navigation.type に現在のナビゲーション型がまだ設定されていない場合、それを記録する: Record the current navigation type in window.performance.navigation.type if it has not been set:

    1. 次のいずれか[ リンクのクリック, UA のアドレスバーへの URL 入力, フォーム送信, location.reload() メソッド以外のスクリプト演算を通した初期化 ]により,ナビゲーションが開始された場合のナビゲーション型は、 TYPE_NAVIGATE If the navigation was started by clicking on a link, or entering the URL in the user agent's address bar, or form submission, or initializing through a script operation other than the location.reload() method, let the navigation type be TYPE_NAVIGATE.
    2. meta refresh の結果, または location.reload() メソッド ]または他の等価な動作により,ナビゲーションが開始された場合のナビゲーション型は、 TYPE_RELOAD If the navigation was started either as a result of a meta refresh, or the location.reload() method, or other equivalent actions, let the navigation type be TYPE_RELOAD.
    3. history traversal の結果,ナビゲーションが開始された場合のナビゲーション型は、 TYPE_BACK_FORWARD If the navigation was started as a result of history traversal, let the navigation type be TYPE_BACK_FORWARD.
    4. 他の場合のナビゲーション型は、 TYPE_RESERVED Otherwise, let the navigation type be TYPE_RESERVED.
  4. 現在の文書と前の文書が異なる生成元に属する場合、 unloadEventStartunloadEventEnd を 0 にして, 取得開始段 へ進む。 他の場合、 unload イベントの直前の時刻を unloadEventStart に記録する。 If the current document and the previous document are from different origins, set both unloadEventStart and unloadEventEnd to 0 then go to step 6. Otherwise, record unloadEventStart as the time immediately before the unload event.
  5. unload イベントが完了した直後の時刻を unloadEventEnd に記録する。 Immediately after the unload event is completed, record the current time as unloadEventEnd.
  6. 取得開始
    HTTP GET を用いて新たなリソースが取得される場合、 UA は関連のアプリケーションキャッシュをチェックする直前の時刻を fetchStart に記録する。 他の場合、 UA は 取得プロセスを開始する直前に現在の時刻を fetchStart に記録する。 If the new resource is to be fetched using HTTP GET or equivalent, immediately before a user agent checks with the relevant application caches, record the current time as fetchStart. Otherwise, immediately before a user agent starts the fetching process, record the current time as fetchStart.
  7. domainLookupStart, domainLookupEnd, connectStart, connectEndfetchStart と同じ値にする。 Let domainLookupStart, domainLookupEnd, connectStart and connectEnd be the same value as fetchStart.
  8. リソースが( HTTP cache も含めた)関連のアプリケーションキャッシュや局所リソースから取得される場合、 リクエスト開始段 へ進む。 If the resource is fetched from the relevant application cache or local resources, including the HTTP cache, go to step 13.
  9. ドメイン名検索が要求されていない場合、 接続開始段 へ進む。 他の場合、 UA がドメイン名検索を開始する直前の時刻を domainLookupStart に記録する。 If no domain lookup is required, go to step 11. Otherwise, immediately before a user agent starts the domain name lookup, record the time as domainLookupStart.
  10. ドメイン名検索に成功した場合、その直後の時刻を domainLookupEnd に記録する。 UA はその前に複数回の再試行が必要になり得る。 ドメイン名検索に失敗した場合、残りの手続きを中止する。 Record the time as domainLookupEnd immediately after the domain name lookup is successfully done. A user agent may need multiple retries before that. If the domain lookup fails, abort the rest of the steps.
  11. 接続開始
    持続的 transport 接続がリソースの取得に利用されている場合、 connectStartconnectEnddomainLookupEnd と同じ値にする。 他の場合、サーバへの接続を始める直前の時刻を connectStart に記録し,サーバまたはプロキシへの接続が確立された直後の時刻を connectEnd に記録する。 UA はその前に複数回の再試行が必要になり得る。 接続が確立できなかった場合、残りの手続きを中止する。 If a persistent transport connection is used to fetch the resource, let connectStart and connectEnd be the same value of domainLookupEnd. Otherwise, record the time as connectStart immediately before initiating the connection to the server and record the time as connectEnd immediately after the connection to the server or the proxy is established. A user agent may need multiple retries before this time. If a connection can not be established, abort the rest of the steps.
  12. 接続開始段 において、 UA が secureConnectionStart 属性をサポートする場合、次の追加の手続きも行われるべきである: In step 11, a user agent should also carry out these additional steps if it supports the secureConnectionStart attribute:

    1. 現在の文書のスキームが HTTPS である場合、 UA は,接続をセキュアにするためのハンドシェイクプロセスの直前の時刻を secureConnectionStart に記録しなければならない。 If the scheme of the current document is HTTPS, the user agent must record the time as secureConnectionStart immediately before the handshake process to secure the connection.
    2. 現在の文書のスキームが HTTPS でない場合、 UA は secureConnectionStart の値を 0 にしなければならない。 If the scheme of the current document is not HTTPS, the user agent must set the value of secureConnectionStart to 0.
  13. リクエスト開始
    UA が文書のリクエストの送信を開始する直前の時刻を requestStart に記録する。 Immediately before a user agent starts sending request for the document, record the current time as requestStart.
  14. 応答開始
    UA が応答の最初のバイトを受信した直後の時刻を responseStart に記録する。 Record the time as responseStart immediately after the user agent receives the first byte of the response.
  15. 応答終了

    UA が応答の最後のバイトを受信した直後の時刻を responseEnd に記録する。 Record the time as responseEnd immediately after receiving the last byte of the response.

    UA がリクエストの送信または応答全体の受信に失敗し,接続の再オープンを要する場合、 接続開始段 へ戻る。 Return to step 11 if the user agent fails to send the request or receive the entire response, and needs to reopen the connection.

    持続的接続 [RFC 2616] が有効にされているときは、 UA はまず最初に,リクエスト送信のためのオープン接続の再利用を(その接続は 非同期に切断 され得るが)試行してよい。 そのような場合、 connectStart, connectEnd, requestStart は再オープン接続において収集された計時情報を表現するべきである。 When persistent connection [RFC 2616] is enabled, a user agent may first try to re-use an open connect to send the request while the connection can be asynchronously closed. In such case, connectStart, connectEnd and requestStart should represent timing information collected over the re-open connection.

  16. リソース取得の結果が, HTTP リダイレクト になる場合: If the fetched resource results in an HTTP redirect or equivalent, then

    1. 現在の文書とリダイレクト先の文書が同じ生成元に属さない場合、 redirectStart, redirectEnd, unloadEventStart, unloadEventEnd, redirectCount を 0 にする。 新たなリソースの下に、 取得開始段 へ戻る。 if the current document and the document that is redirected to are not from the same origin, set redirectStart, redirectEnd, unloadEventStart, unloadEventEnd and redirectCount to 0. Then, return to step 6 with the new resource.
    2. 前のリダイレクトの中に,他と異なる生成元に属する文書を対象にするものがある場合、 redirectStart, redirectEnd, unloadEventStart, unloadEventStart, redirectCount を 0 にする。 新たなリソースの下に、 取得開始段 へ戻る。 if there is previous redirect involving documents that are not from the same origin, set redirectStart, redirectEnd, unloadEventStart, unloadEventStart and redirectCount to 0. Then, return to step 6 with the new resource.
    3. redirectCount を 1 増やす。 Increment redirectCount by 1.
    4. redirectStart の値が 0 の場合、 その値 ← fetchStart の値とする。 If the value of redirectStart is 0, let it be the value of fetchStart.
    5. redirectEndresponseEnd の値。 Let redirectEnd be the value of responseEnd.
    6. navigationStart, redirectStart, redirectEnd, unloadEventStart, unloadEventEnd を除く, window.performance.timing のすべての属性を 0 にする。 Set all the attributes in window.performance.timing to 0 except navigationStart, redirectStart, redirectEnd, unloadEventStart and unloadEventEnd.
    7. 新たなリソースの下に、 取得開始段 へ戻る。 Return to step 6 with the new resource.
  17. UA が現在の文書の準備状況を "loading" に設定する直前の時刻を domLoading に記録する。 Record the time as domLoading immediately before the user agent sets the current document readiness to "loading".
  18. UA が現在の文書の準備状況を "interactive" に設定する直前の時刻を domInteractive に記録する。 Record the time as domInteractive immediately before the user agent sets the current document readiness to "interactive".
  19. UA が文書に対し DOMContentLoaded イベント を発火する直前の時刻を domContentLoadedEventStart に記録する。 Record the time as domContentLoadedEventStart immediately before the user agent fires the DOMContentLoaded event at the document.
  20. DOMContentLoaded イベント が完了した直後の時刻を domContentLoadedEventEnd に記録する。 Record the time as domContentLoadedEventEnd immediately after the DOMContentLoaded event completes.
  21. UA が現在の文書の準備状況を "complete" に設定する直前の時刻を domComplete に記録する。 Record the time as domComplete immediately before the user agent sets the current document readiness to "complete".
  22. UA が load イベントを発火する直前の時刻を loadEventStart に記録する。 Record the time as loadEventStart immediately before the user agent fires the load event.
  23. UA が load イベントを完了した直後の時刻を loadEventEnd に記録する。 Record the time as loadEventEnd immediately after the user agent completes the load event.

5.2 ガーベジコレクション

window オブジェクトからその window.performance.timingwindow.performance.navigation オブジェクトへの 暗黙的な強い参照 が存在する。 【強い参照:参照元が参照先を “所有” する(参考)】 There are implied strong references from the window object to its window.performance.timing and window.performance.navigation objects.

5.3 単調増加クロック

計時属性の値は、ナビゲーションの間,計時属性がシステムクロックに対する調整によりスキューされないように、単調増加でなければならない。 時系列順に記録された2つの計時属性の差分は決して負であってはならない。 下位文書のナビゲーションも含む,すべてのナビゲーションにおいて、 UA はルート文書ナビゲーションの開始時点のシステムクロックを記録し,後続の計時属性は、ナビゲーションの開始からの経過時間を測定する単調増加クロックの下で定義されなければならない。 The value of the timing attributes must monotonically increase to ensure timing attributes are not skewed by adjustments to the system clock during the navigation. The difference between any two chronologically recorded timing attributes must never be negative. For all navigations, including subdocument navigations, the user agent must record the system clock at the beginning of the root document navigation and define subsequent timing attributes in terms of a monotonic clock measuring time elapsed from the beginning of the navigation.

5.4 ベンダ接頭子

ベンダ固有のプロプライエタリ UA 拡張は推奨されない。 例えば,試験的な目的でその種の拡張が必要になった場合、ベンダは次の拡張の仕組みを利用しなければならない: Vendor-specific proprietary user agent extensions are discouraged. If such extensions are needed, e.g., for experimental purposes, vendors must use the following extension mechanisms:

  • 追加の拡張が新たなナビゲーション型である場合、その型は次を満たさなければならない: If the extension to be added is an navigation type, the new type must

    • 命名規約: TYPE_[VENDORPREFIX]_[TYPE][VENDORPREFIX] はベンダ識別する名前)に従う。 follow the naming convention: TYPE_[VENDORPREFIX]_[TYPE], where [VENDORPREFIX] is a name that identifies the vendor.
    • 100 〜 200 の範囲の値をとる。 have a value in the range of 100 to 200.
  • 追加の拡張が新たな計時属性である場合、その属性は次を満たさなければならない: If the extension is a new timing attribute, it must

    • 命名規約: [vendorPrefix]TimeAttribute[vendorPrefix] はベンダを識別する名前, TimeAttribute は計時属性を識別する名前 )に従う。 follow the naming convention: [vendorPrefix]TimeAttribute, where [vendorPrefix] identifies the vendor name and TimeAttribute identifies the name of the timing attribute.
    • 5.3 節にて定義される,単調増加クロックを利用すること。 use a monotonically increasing clock, as defined in Section 5.3 Monotonic Clock.
    • 3 節 にて定義されるように, 1970 年 1 月 1 日 0 時 0 分 0 秒 (UTC) を起点として測定されるミリ秒であること。 be measured in milliseconds since midnight of January 1, 1970 (UTC), as defined in Section 3 Terminology.
  • 拡張が新たなナビゲーション属性である場合、 命名規約: [vendorPrefix]NavigationAttribute[vendorPrefix] はベンダ識別する名前, NavigationAttribute はナビゲーション属性を識別する名前 )に従わなければならない。 If the extension is a new navigation attribute, it must follow the naming convention: [vendorPrefix]NavigationAttribute, where [vendorPrefix] identifies the vendor name and NavigationAttribute identifies the name of the navigation attribute.

6 プライバシー

この節は規定ではない。 This section is non-normative.

6.1 情報の流出

注意深く組み上げられた計時攻撃の利用により、末端利用者による閲覧と行動の履歴が流出する可能性がある。 例えば、 unload 時刻から前のページの unload ハンドラに要した時間が明らかにされ,利用者のログイン状態の推定に利用され得る。 これらの攻撃は、前のナビゲーションを含む計時情報がアクセスされる際に同一生成元ポリシーを適用することによって軽減される。 There is the potential for disclosing an end-user's browsing and activity history by using carefully crafted timing attacks. For instance, the unloading time reveals how long the previous page takes to execute its unload handler, which could be used to infer the user's login status. These attacks have been mitigated by enforcing the same origin policy when timing information involving the previous navigation is accessed.

緩い同一生成元ポリシー は、文書間に渡る,未承認の訪問に対する十分な保護を提供しない。 共有されているホストにおいては、信頼できない第三者が同じ IP アドレスの異なるポートの HTTP サーバをホストし得る。 The relaxed same origin policy doesn't provide sufficient protection against unauthorized visits across documents. In shared hosting, an untrusted third party is able to host an HTTP server at the same IP address but on a different port.

6.2 クロスディレクトリ・アクセス

1つのホスト名を共有する異なるページ,例えばサイトにホストされている異なる文書作成者による,利用者が生成した内容を伴う内容は、パス名に応じたアクセスの制限機能が存在しないため,同じ生成元に属するものと見なされる。 これらのページ間のナビゲーションおいては、後のページから,リダイレクトや unload イベントに対する計時など,前のページの計時情報へのアクセスが可能になる。 Different pages sharing one host name, for example contents from different authors hosted on sites with user generated content are considered from the same origin because there is no feature to restrict the access by pathname. Navigating between these pages allows a latter page to access timing information of the previous one, such as timing regarding redirection and unload event.

7 セキュリティ

この節は規定ではない。 This section is non-normative.

7.1 プロキシサーバの検出

UA とウェブサーバとの間にプロキシが配備されている場合、 connectStart と属性と connectEnd 属性の間の時区間は、 ウェブサーバではなく,プロキシと UA との間の遅延を示すものになる。 それにより、ウェブサーバは,プロキシの存在を推定できる可能性がある。 SOCKS プロキシについては、この時区間にはプロキシ認証に要した時間とプロキシがウェブサーバへの接続に要した時間も含まれ,プロキシの検出を難しくする。 HTTP プロキシの場合、 UA はプロキシサーバについての知識を一切持たないこともあるので、この攻撃の緩和が常に実現できるとは限らない。 In case a proxy is deployed between the user agent and the web server, the time interval between the connectStart and the connectEnd attributes indicates the delay between the user agent and the proxy instead of the web server. With that, web server can potentially infer the existence of the proxy. For SOCKS proxy, this time interval includes the proxy authentication time and time the proxy takes to connect to the web server, which obfuscate the proxy detection. In case of an HTTP proxy, the user agent might not have any knowledge about the proxy server at all so it's not always feasible to mitigate this attack.

7.2 計時オブジェクトの置換による干渉

window.performance オブジェクトは、同じオブジェクトを利用する既存ページとの混同を避けるため、他のものに置換し得る。 それにより、第三者がそのオブジェクトを置換して,この仕様に述べたインタフェースに依存するスクリプトを破壊できる可能性がある。 The window.performance object is replaceable to avoid conflicts with existing pages using the same object. By doing that, it is possible for third-party to replace the object and scripts relying on the interface described in this work would break.

8 参照文献

8.1 文献(規定)

[RFC 2119]
Key words for use in RFCs to Indicate Requirement Levels, Scott Bradner, Author. Internet Engineering Task Force, March 1997. Available at http://www.ietf.org/rfc/rfc2119.txt.
[RFC 2616]
Hypertext Transfer Protocol -- HTTP/1.1, R. Fielding et al., Authors. Internet Engineering Task Force, June 1999. Available at
http://www.ietf.org/rfc/rfc2616.txt.
[RFC 6454]
The Web Origin Concept, Adam Barth, Author. Internet Engineering Task Force, December 2011. Available at http://www.ietf.org/rfc/rfc6454.txt.
[ECMA-262]
ECMAScript Language Specification, 5.1 Edition. ECMA International, Standard ECMA-262, June 2011. This version of the ECMAScript Language is available from http://www.ecma-international.org/publications/standards/Ecma-262.htm.
[HTML5]
HTML5, Robin Berjon et al., Editors. World Wide Web Consortium, December 2012. This version of the HTML5 is available from http://www.w3.org/TR/html5/. The latest editor's draft of HTML5 is available at http://www.w3.org/html/wg/drafts/html/CR/.
[Web IDL]
Web IDL, Cameron McCormack, Editor. World Wide Web Consortium, April 2012. This version of the Web IDL specification is available from http://www.w3.org/TR/2012/CR-WebIDL-20120419/. The latest version of Web IDL is available at http://www.w3.org/TR/WebIDL/.

8.2 文献(参考)

[JSMEASURE]
Measuring Client-Perceived Response Times on the WWW, R. Rajamony and M. Elnozahy, The Proceedings of the 3rd USENIX Symposium on Internet Technologies and Systems (USITS), March 2001.
Navigation Timing 2, Jatinder Mann, Arvind Jain, Editors. World Wide Web Consortium, unpublished.

謝辞

この草案を手がけるにあたってレビューとフィードバックをされた次の方々に謝意を表したい: I would like to offer my sincere thanks to all the people that I have been in touch with regarding this draft, including

Anderson Quach, Alex Russell, Alois Reitbauer, Annie Sullivan, Christian Biesinger, Darin Fisher, Eric Lawrence, James Simonsen, Jatinder Mann, Jason Sobel, Jason Weber, Jonas Sicking, Kyle Scholz, Lenny Rachitsky, Nic Jansma, Richard Rabbat, Sergey Novikov, Sigbjørn Vik, Steve Souders, Tony Gentilcore for their reviews and feedback.