WebDriver BiDi

W3C 作業草案,

この文書の詳細
このバージョン:
https://www.w3.org/TR/2026/WD-webdriver-bidi-20260511/
最新公開バージョン:
https://www.w3.org/TR/webdriver-bidi/
編集者草案:
https://w3c.github.io/webdriver-bidi/
以前のバージョン:
履歴:
https://www.w3.org/standards/history/webdriver-bidi/
実装報告:
https://wpt.fyi/results/webdriver/tests/bidi
テストスイート:
https://github.com/web-platform-tests/wpt/tree/master/webdriver/tests/bidi
フィードバック:
GitHub
仕様内インライン
編集者:
James Graham (Mozilla)
Alex Rudenko (Google)
Maksim Sadym (Google)
チャンネル:
irc.w3.org 上の #webdriver
Wiki:
W3C WebDriver Wiki

概要

この文書は、ユーザーエージェントをリモート制御するための仕組みである、双方向 WebDriver プロトコルを定義する。

この文書のステータス

この節は、この文書の公開時点におけるステータスを説明する。現在の W3C 公開文書の一覧およびこの技術報告書の最新改訂版は、W3C 標準および草案索引で確認できる。

この仕様に関する議論には、GitHub Issues が推奨される。 あるいは、Browser Testing and Tools Working Group のメーリングリスト public-browser-tools-testing@w3.orgアーカイブ)へコメントを送ることもできる。

この文書は、Browser Testing and Tools Working Group により、勧告 トラックを用いた作業草案として公開された。

作業草案としての公開は、 W3C およびそのメンバーによる支持を意味しない。

これは草案文書であり、いつでも他の文書によって更新、置換、または廃止される可能性がある。 作業中のもの以外としてこの文書を引用することは不適切である。

この文書は、W3C Patent Policy の下で活動するグループによって作成された。 W3C は、このグループの成果物に関連して行われたすべての 特許開示の公開リストを維持している。そのページには、特許を開示するための手順も含まれる。 個人が、その個人の知る限り Essential Claim(s) を含むと考える特許について実際の知識を有する場合、その情報を W3C Patent Policy の第 6 節に従って開示しなければならない。

この文書は、2025年8月18日版 W3C Process Document によって管理される。

1. 序論

この節は非規範的である。

WebDriver は、ユーザーエージェントの イントロスペクションおよび リモート制御のためのプロトコルを定義する。この仕様は、 双方向通信を導入することにより WebDriver を拡張する。WebDriver の厳密な コマンド/レスポンス形式に代えて、これによりイベントを ユーザーエージェントから制御ソフトウェアへストリーミングできるようになり、 ブラウザー DOM のイベント駆動の性質によりよく一致する。

2. 基盤

この仕様は Infra Standard に依存する。[INFRA]

ネットワークプロトコルメッセージは CDDL を用いて定義される。[RFC8610]

この仕様は、map である wait queue を定義する。

この「イベントを待つ」ことを行うための、もっとよい 仕組みがきっとあるはずだ。

並列に実行されているアルゴリズム algorithm が、イベントの集合 events および resume idawaits するとき:

  1. algorithm の実行を一時停止する。

  2. 表明: wait queueresume id を含まない。

  3. wait queue[resume id] を (events, algorithm) に設定する。

与えられた nameid および parametersresume するには:
  1. wait queueid を含まない場合、戻る。

  2. (events, algorithm) を wait queue[id] とする

  3. events 内の各 event について:

    1. eventname と等しい場合:

      1. wait queue から id を削除する。

      2. algorithm 内のステップの実行を、 一時停止された地点から再開し、name および parametersawait の結果として渡す。

        これがイベントループ上の他のどのタスクよりも先に 実行されることを保証するために、microtasks のようなものを 持つべきだろうか?

WebDriver configuration は、次を持つ struct である:

WebDriver configurationassociated type を持ち、 これは type である。

WebDriver configuration に対する value は、その設定に対する associated type である型を持つ値、または unset のいずれかである。

Unset は、特定の設定 value が設定されていないことを示す値である。

注: このアルゴリズムは、与えられた navigable についての WebDriver configuration に、 navigables 内の値を確認し、次に user contexts 内、最後に global 内を確認することでアクセスできるようにする。 設定されていない場合は unset を返す。

WebDriver configuration configuration の、 navigable navigable に対する get WebDriver configuration value は:

  1. top-level traversablenavigabletop-level traversable とする。

  2. configurationnavigablestop-level traversable含む場合:

    1. navigable configuration valueconfigurationnavigables[top-level traversable] とする。

    2. navigable configuration valueunset でない場合、 navigable configuration value を返す。

  3. user contextnavigableassociated user context とする。

  4. configurationuser contextsuser context含む場合:

    1. user context configuration valueconfigurationuser contexts[user context] とする。

    2. user context configuration valueunset でない場合、 user context configuration value を返す。

  5. configurationglobal を返す。

注: これは WebDriver configurationtarget ごとに格納するための汎用アルゴリズムであり、targetnavigableuser context のいずれか、または target が null もしくは省略された場合はグローバルに格納できる。

WebDriver configuration configurationvalue value を、任意の targetstore するには。これは navigableuser context、または提供されない場合は null である:

  1. target が null である場合、configurationglobalvalue に設定する。

  2. targetuser context である場合、configurationuser contexts[target] を value に設定する。

  3. targetnavigable である場合、configurationnavigables[target] を value に設定する。

注: この汎用アルゴリズムは、 command parameters 内の "userContexts" および "contexts" の存在に応じて、WebDriver configurationvalueglobaluser contexts、または navigables に格納する。これらの パラメーター は相互に排他的である。どちらも提供されない場合、設定はグローバルに格納される。

与えられた command parameters について、WebDriver configuration configurationvalue valuestore WebDriver configuration するには:

  1. command parameters が "userContexts" を含み、かつ command parameters が "contexts" を含む場合、error を、error code invalid argument とともに返す。

  2. affected navigables を空の set とする。

  3. command parameters が "contexts" を含む場合:

    1. navigables を、command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. navigables の各 navigable について:

      1. navigableaffected navigables追加する

      2. configurationvaluenavigablestore する。

  4. そうでなく、command parameters が "userContexts" を含む場合:

    1. user contexts を、command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. user context である associated user context を持つ、すべての top-level traversables のリスト内の 各 top-level traversable について反復する:

        1. top-level traversableaffected navigables追加する

      2. configurationvalueuser contextstore する。

  5. そうでなければ:

    1. すべての top-level traversables の各 top-level traversable について反復しtop-level traversableaffected navigables追加する

    2. configurationvalueStore する。

  6. affected navigables を返す。

3. プロトコル

この節は、WebDriver BiDi プロトコルの基本概念を定義する。これらの用語は、 トランスポート層での表現とは異なる。

このプロトコルは CDDL 定義を用いて定義される。実装者の便宜のため、2 つの別々の CDDL 定義が定義される。 すなわち、local end で生成され、remote end で消費されるメッセージの形式を 定義する remote end definition と、 remote end で生成され、 local end で消費されるメッセージの形式を定義する local end definition である。

3.1. 定義

これは 付録であるべきだろうか?

この節は、remote end definition および local end definition の初期内容を示す。 これらは、仕様の残りの部分で定義される定義断片によって拡張される。

Command = {
    id: js-uint,
    CommandData,
    Extensible,
    }

    CommandData = (
    BrowserCommand //
    BrowsingContextCommand //
    EmulationCommand //
    InputCommand //
    NetworkCommand //
    ScriptCommand //
    SessionCommand //
    StorageCommand //
    WebExtensionCommand
    )

    EmptyParams = {
    Extensible
    }
    

Local end definition

Message = (
    CommandResponse /
    ErrorResponse /
    Event
    )

    CommandResponse = {
    type: "success",
    id: js-uint,
    result: ResultData,
    Extensible
    }

    ErrorResponse = {
    type: "error",
    id: js-uint / null,
    error: ErrorCode,
    message: text,
    ? stacktrace: text,
    Extensible
    }

    ResultData = (
    BrowserResult /
    BrowsingContextResult /
    EmulationResult /
    InputResult /
    NetworkResult /
    ScriptResult /
    SessionResult /
    StorageResult /
    WebExtensionResult
    )

    EmptyResult = {
    Extensible
    }

    Event = {
    type: "event",
    EventData,
    Extensible
    }

    EventData = (
    BrowsingContextEvent //
    InputEvent //
    LogEvent //
    NetworkEvent //
    ScriptEvent
    )
    

Remote end definition および Local end definition

Extensible = (*text => any)

    js-int = -9007199254740991..9007199254740991
    js-uint = 0..9007199254740991
    

3.2. セッション

WebDriver BiDi は、session の概念を WebDriver から拡張する。

sessionBiDi flag を持ち、特に明記されない限りこれは false である。

BiDi session は、session であり、その BiDi flag が true に設定されているものである。

active BiDi sessions のリストは、次で与えられる:
  1. BiDi sessions を新しい list とする。

  2. active sessions 内の各 session について:

    1. sessionBiDi session である場合、sessionBiDi sessions に追加する。

  3. BiDi sessions を返す。

3.3. モジュール

WebDriver BiDi プロトコルはモジュールに編成される。

module は、ユーザー エージェントの特定の側面に関係する、関連した commands および events の集合を表す。たとえば、モジュールは DOM の検査や 操作、またはスクリプト実行のための機能を含むことがある。

各モジュールは、文字列である module name を持つ。 モジュール内で定義されるコマンドおよびイベントに対する command name および event name は、 module name で始まり、その後にピリオド "." が続く。

commands を含むモジュールは、remote end definition 断片を定義する。これらは、モジュールの commands に対して CommandData グループ内に選択肢を提供し、また 追加の定義プロパティを定義することもできる。それらは、モジュール内のコマンド結果に対して ResultData グループ内に追加の選択肢を提供する local end definition 断片を定義することもできる。

イベントを含むモジュールは、モジュールの events に対して Event グループ内の 選択肢となる local end definition 断片を定義する。

実装は extension modules を定義してもよい。これらは、単一のコロン ":" 文字を含む module name を持たなければならない。コロンの前の部分は接頭辞であり、通常は特定の実装に固有のすべての extension modules で同じであり、特定の実装に対して一意であるべきである。

他の仕様は、プロトコルを拡張する独自の WebDriver-BiDi モジュールを定義してもよい。 そのようなモジュールは、コロン(:)文字を含む名前を持ってはならず、 また、その文字を含む command namesevent names、またはプロパティ 名を定義してはならない。

外部仕様の作者には、既存のモジュールを拡張するのではなく、新しいモジュールを追加することが推奨される。 既存のモジュールを拡張することが望まれる場合は、その拡張を元のモジュール定義を含む仕様に直接統合することが望ましい。

3.4. コマンド

command は非同期 操作であり、local end によって要求され、remote end 上で実行され、 その結果として result または error のいずれかが local end に返される。 複数の コマンドを同時に実行でき、コマンドは潜在的に 長時間実行されることがある。その結果、コマンドは順序どおりでなく完了することがある。

command は次によって定義される:

アクティブなセッションなしで実行できるコマンドは static command である。コマンドは、その 定義で述べられない限り static command ではない。

コマンドが local end から送信されるとき、 それらは command id を持つ。これは、特定の コマンドからのレスポンスを識別するために local end が使用する識別子である。 remote end の観点からは、この識別子は不透明であり、 コマンドを識別するために内部的に使用することはできない。

注: これは、command id が完全に local end によって制御され、セッションの過程で必ずしも一意ではないためである。たとえば、すべてのレスポンスを無視する local end は、 各コマンドに同じ command id を使用できる。

set of all command names は、set であり、 extension modules に属するものを含む、定義済みのすべての command names を含む。

3.5. エラー

WebDriver BiDi は、error codes の集合を WebDriver から次の追加コードで拡張する:

invalid web extension
無効な Web 拡張機能をインストールしようとした。
no such client window
未知の client window とやり取りしようとした。
no such handle
未知の RemoteObjectReference を逆シリアル化しようとした。
no such history entry
未知の session history entry へ移動しようとした。
no such network collector
未知の collector を削除しようとした。
no such intercept
未知の network intercept を削除しようとした。
no such network data
未知の network data を参照しようとした。
no such node
未知の SharedReference を逆シリアル化しようとした。
no such request
未知の request を続行しようとした。
no such script
未知の preload script を削除しようとした。
no such storage partition
存在しないストレージパーティション内のデータにアクセスしようとした。
no such user context
未知の user context を参照しようとした。
no such web extension
未知の Web 拡張機能を参照しようとした。
unable to close browser
ブラウザーを閉じようとしたが、失敗した。
unable to set cookie
Cookie を作成しようとしたが、ユーザーエージェントに拒否された。
underspecified storage partition
十分に指定されていないストレージパーティション内のデータとやり取りしようとした。
unable to set file input
ファイル入力を設定しようとしたが、失敗した。
unavailable network data
収集されていない、またはすでに破棄されたネットワークデータを取得しようとした。
ErrorCode = "invalid argument" /
                "invalid selector" /
                "invalid session id" /
                "invalid web extension" /
                "move target out of bounds" /
                "no such alert" /
                "no such network collector" /
                "no such element" /
                "no such frame" /
                "no such handle" /
                "no such history entry" /
                "no such intercept" /
                "no such network data" /
                "no such node" /
                "no such request" /
                "no such script" /
                "no such storage partition" /
                "no such user context" /
                "no such web extension" /
                "session not created" /
                "unable to capture screen" /
                "unable to close browser" /
                "unable to set cookie" /
                "unable to set file input" /
                "unavailable network data" /
                "underspecified storage partition" /
                "unknown command" /
                "unknown error" /
                "unsupported operation"
    

3.6. イベント

event は通知であり、 remote end によって local end へ送信され、remote end 上で関心のある何かが 発生したことを通知する。

BiDi sessionsubscriptions を持ち、これは list of subscriptions である。

BiDi sessionknown subscription ids を持ち、これは set であり、 local end に発行されたがまだ購読解除されていない、すべての subscription ids を含む。

subscription は、struct であり、 subscription id(文字列)、 event names(event names の set)、 top-level traversable idstop-level traversables の ID の set) および user context idsuser contexts の ID の set)からなる。

subscription subscription は、subscriptiontop-level traversable ids が空の set であり、 かつ subscriptionuser context ids が空の set である場合、 global である。

event name および navigables が与えられたときの set of sessions for which an event is enabled は次である:

  1. sessions を新しい set とする。

  2. active BiDi sessions 内の各 session について:

    1. sessionevent name および navigablesevent is enabled である場合、 sessionsessions に追加する。

  3. sessions を返す。

sessionevent name および navigables が与えられたとき、event is enabled であるかどうかを判定するには:

注: shared worker は複数のコンテキストに関連付けられ得るため、 navigables は set である。

  1. top-level traversables を、navigablesget top-level traversables したものとする。

  2. sessionsubscriptions 内の各 subscription について:

    1. subscriptionevent namesevent name含まない場合、continue する。

    2. subscriptionglobal である場合、true を返す。

    3. user context ids が空でない場合:

      1. top-level traversables 内の各 navigable について反復する:

        1. subscriptionuser context ids が、 navigableassociated user contextuser context id含む場合、 true を返す。

    4. そうでなければ:

      1. subscription top-level traversables を、subscriptiontop-level traversable idsget navigables by ids したものとする。

      2. top-level traversablessubscription top-level traversables積集合でない場合、true を返す。

  3. false を返す。

event name および session が与えられたときの set of top-level traversables for which an event is enabled は次である:

  1. result を新しい set とする。

  2. sessionsubscriptions 内の各 subscription について:

    1. subscriptionevent namesevent name含まない場合、 continue する。

    2. subscriptionglobal である場合:

      1. remote end の top-level traversables 内の各 traversable について:

        1. traversableresult追加する

      2. Break する。

    3. そうでなく、user context ids が空でない場合:

      1. remote end の top-level traversables 内の各 traversable について:

        1. subscriptionuser context idstraversableassociated user contextuser context id含む場合、 traversableresult追加する

    4. そうでなければ:

      1. top-level traversables を、subscriptiontop-level traversable idsget navigables by ids したものとする。

      2. top-level traversables の各項目を result追加する

  3. result を返す。

与えられた nameobtain a set of event names するには:
  1. events を空の set とする。

  2. name が U+002E(ピリオド)を含む場合:

    1. name がイベントに対する event name である場合、nameevents に追加し、 data events とともに success を返す。

    2. error code invalid argument を持つ error を返す

  3. そうでなければ、name はモジュール内のすべてのイベントを表すものとして解釈される。 namemodule name でない場合、error code invalid argument を持つ error を返す。

  4. 名前 name を持つモジュール内の各 event に対する event nameevents に追加する。

  5. data events とともに success を返す。

4. トランスポート

メッセージトランスポートは WebSocket プロトコルを用いて提供される。 [RFC6455]

注: WebSocket プロトコルの用語では、local end は クライアントであり、remote end はサーバー / リモートホストである。

注: commands および events のメッセージとしての符号化は JSON-RPC に似ているが、この仕様はそれを規範的に 参照しない。[JSON-RPC] 代わりに、remote ends に対する規範的要件は正確な処理モデルとして与えられ、 local ends に対する 規範的要件は与えられない。

WebSocket listener は、受信する WebSocket 接続を 受け入れることができるネットワークエンドポイントである。

WebSocket listenerhostportsecure flag、および list of WebSocket resources を持つ。

WebSocket listener listener が作成されたとき、remote end は、listenerhost および port によって与えられるホストおよびポート上で、 WebSocket 接続を待ち受け始めなければならない。 listenersecure flag が設定されている場合、 listener から確立される接続は TLS で暗号化されなければならない。

remote end は、set of WebSocket listeners である active listeners を持ち、これは初期状態では空である。

remote end は、set of WebSocket connections not associated with a session を持ち、これは初期状態では空である。

WebSocket connection は、 WebSocket protocol の要件に従うネットワーク接続である

BiDi session は、set of session WebSocket connections を持ち、その要素は WebSocket connections である。これは 初期状態では空である。

BiDi session session は、sessionsession WebSocket connectionsconnection を含む場合、connectionassociated with connection している。

注:WebSocket connection は、最大でも 1 つの BiDi session と関連付けられる。

クライアントが WebSocket 接続を確立するとき、すなわち connectionactive listeners の集合内の listener の 1 つに接続して 確立するとき、実装は WebSocket の server-side requirements に従って進めなければならず、受信接続を 受け入れるかどうかを決定するときに次のステップを実行する:

  1. resource name を、クライアントの開始ハンドシェイクを読むことから得られるリソース名とする。 resource namelistenerlist of WebSocket resources 内にない場合、 これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。

  2. resource name がバイト文字列 "/session" であり、 実装が supports BiDi-only sessions する場合:

    1. 接続を受け入れるべきかどうかを決定するための、その他の実装定義のステップを実行し、 受け入れない場合はこれらのステップの実行を停止し、 要求されたサービスが利用できないかのように動作する。

    2. その接続を WebSocket connections not associated with a session に追加する。

    3. 戻る。

  3. resource nameGet a session ID for a WebSocket resource し、 session id をその値とする。session id が null である場合、 これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。

  4. active sessions のリスト内に、その session ID として session id を持つ session が存在する場合、session をその セッションとする。そうでなければ、これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。

  5. 接続を受け入れるべきかどうかを決定するための、その他の実装定義のステップを実行し、 受け入れない場合はこれらのステップの実行を停止し、 要求されたサービスが利用できないかのように動作する。

  6. そうでなければ、connectionsessionsession WebSocket connections に追加し、サーバーが受信接続を受け入れることを選択するときの WebSocket server-side requirements に従って進める。

1 つのセッションに対して 2 つ以上の 接続をサポートするのか?

WebSocket メッセージが受信されたとき、WebSocket connection connection について、型 type およびデータ data が与えられる場合、remote endconnectiontype および data が与えられたものとして handle an incoming message しなければならない。

WebSocket の終了ハンドシェイクが開始されたとき、または WebSocket 接続が閉じられたとき、WebSocket connection connection について、remote endconnection が与えられたものとして handle a connection closing しなければならない。

注: 終了ハンドシェイクなしに WebSocket 接続が閉じられる可能性があるため、 両方の条件が必要である。

session session が与えられたとき、construct a WebSocket resource name するには:

  1. session が null である場合、"/session" を返す

  2. 文字列 "/session/" と sessionsession ID を連結した結果を返す。

WebSocket listener listener および session session が与えられたとき、 construct a WebSocket URL するには:

  1. resource name を、sessionconstruct a WebSocket resource name した結果とする。

  2. ホストを listenerhost に設定し、ポートを listenerport に設定し、パスを resource name に設定して構築した WebSocket URI を返す。 listenersecure flag が設定されている場合は wss-URI 構成に従い、そうでなければ ws-URL 構成に従う。

resource name が与えられたとき、get a session ID for a WebSocket resource するには:

  1. resource name がバイト文字列 "/session/" で始まらない場合、null を返す。

  2. session id を、resource name 内の "/session/" 接頭辞に続くバイト列とする。

  3. session idUUID の文字列表現でない場合、null を返す。

  4. session id を返す。

session session が与えられたとき、 start listening for a WebSocket connection するには:
  1. active listeners 内に、 remote end が再利用したい既存の WebSocket listener が存在する場合、 listener をその listener とする。そうでなければ、listener を、 implementation-definedhostportsecure flag、および空の list of WebSocket resources を持つ新しい WebSocket listener とする。

  2. resource name を、sessionconstruct a WebSocket resource name した結果とする。

  3. resource name を、 listener に対する list of WebSocket resources に追加する。

  4. listener を、remote endactive listeners追加する

  5. listener を返す。

注: 複数のセッションを処理する intermediary node は、1 つまたは多数の WebSocket listener を使用できる。WebDriver は、 endpoint node が同時に最大 1 つのセッションをサポートすると定義しているため、 listener は 1 つだけであることが想定される。

注: endpoint node では、上記ステップにおける host は 通常 "localhost" になる。

WebSocket connection connection、型 type およびデータ data が与えられたとき、 handle an incoming message するには:
  1. typetext でない場合、connection、 null、および invalid argument が与えられたものとして send an error response し、最後に 戻る。

  2. Assert: datascalar value string である。そうでなければ、WebSocket の UTF-8 符号化データ内のエラー処理 が、すでに WebSocket connection を失敗させているためである。

    UTF-8 エラーにどの status code が使用されるかを定義しているものはないように思われる。

  3. connectionassociated with connection している BiDi Session が存在する場合、 session をそのセッションとする。そうでなく、connectionWebSocket connections not associated with a session 内にある場合、session を null とする。そうでなければ、戻る。

  4. parsed を、data が与えられたものとして JSON を Infra values に構文解析する結果とする。 これが例外を投げる場合、connection、 null、および invalid argument が与えられたものとして send an error response し、 最後に戻る。

  5. session が null でなく、かつ active sessions 内にない場合、戻る。

  6. parsedremote end definition に対して照合する。 これが 一致になる場合:

    1. matched を、一致したデータを表す map とする。

    2. Assert: matched は "id"、"method"、および "params" を含む

    3. command idmatched["id"] とする。

    4. methodmatched["method"] とする

    5. command を、command name method を持つ command とする。

    6. session が null であり、かつ commandstatic command でない場合、 connectioncommand id、および invalid session id が与えられたものとして send an error response し、戻る。

    7. 次のステップを並列に実行する:

      1. result を、 session および command parameters matched["params"] が与えられたものとして、 command に対する remote end steps を実行した結果とする。

      2. resulterror である場合、 connectioncommand id、および resulterror code が与えられたものとして send an error response し、最後に 戻る。

      3. valueresult の data とする。

      4. Assert: value は、command name method を持つ command に対応する result type の定義に一致する。

      5. method が "session.new" である場合、sessionactive sessions のリスト内の、その session IDvalue の "sessionId" プロパティと等しいエントリーとし、connectionsessionsession WebSocket connections追加しconnectionWebSocket connections not associated with a session から削除する。

      6. response を、local end definition 内の CommandResponse 生成規則に一致する新しい map とする。 id フィールドは command id に設定され、value フィールドは value に設定される。

      7. serialized を、response が与えられたものとして serialize an infra value to JSON bytes した結果とする。

      8. serialized からなる WebSocket メッセージを送信する。 これは connection 上で行う。

  7. そうでなければ:

    1. command id を null とする。

    2. parsedmap であり、かつ parsed["id"] が存在し、0 以上の integer である場合、command id をその integer に設定する。

    3. error codeinvalid argument とする。

    4. parsedmap であり、かつ parsed["method"] が存在し、 string であるが、parsed["method"] が set of all command names 内にない場合、 error codeunknown command に設定する。

    5. connectioncommand id、および error code が与えられたものとして Send an error response する。

settings object settings が与えられたとき、get related navigables するには:

  1. related navigables を空の set とする。

  2. settingsrelevant global objectWindow である場合:

    1. navigable を、relevant global objectassociated Documentnode navigable とする。

    2. navigable が null でない場合、navigablerelated navigables に追加する。

  3. そうでなく、settings によって指定される global objectWorkerGlobalScope である場合、 global objectowner set 内の各 owner について:

    1. navigable を null とする。

    2. ownerDocument である場合、navigableownernode navigable に設定する。

    3. navigable が null でない場合、navigablerelated navigables に追加する。

  4. related navigables を返す。

context ids の list navigable ids が与えられたとき、get navigables by ids するには:

  1. result を空の set とする。

  2. navigable ids 内の各 navigable id について:

    1. navigable を、id navigable id を持つ navigable が存在する場合はその navigable、そうでなければ null とする。

    2. navigable が null でない場合、 navigableresult追加する

  3. result を返す。

list of navigables navigables が与えられたとき、get top-level traversables するには:

  1. result を空の set とする。

  2. navigables 内の各 navigable について:

    1. navigabletop-level traversableresult追加する

  3. result を返す。

context ids の list navigable ids が与えられたとき、get valid navigables by ids するには:

  1. result を空の set とする。

  2. navigable ids 内の各 navigable id について:

    1. navigable を、navigable idget a navigable することを試みた結果とする。

    2. navigableresult追加する

  3. data result とともに success を返す。

context ids の list navigable ids が与えられたとき、 get valid top-level traversables by ids するには:

  1. result を空の set とする。

  2. navigable ids 内の各 navigable id について:

    1. navigable を、navigable idget a navigable することを試みた結果とする。

    2. navigabletop-level traversable でない場合、 error を、error code invalid argument とともに返す。

    3. navigableresult追加する

  3. data result とともに success を返す。

session および body が与えられたとき、 emit an event するには:
  1. Assert: bodyEvent 生成規則に一致する。

  2. serialized を、body が与えられたものとして serialize an infra value to JSON bytes した結果とする。

  3. sessionsession WebSocket connections 内の各 connection について反復する:

    1. serialized からなる WebSocket メッセージを送信する。 これは connection 上で行う。

WebSocket connection connectioncommand id、および error code が与えられたとき、 send an error response するには:
  1. error data を、local end definition 内の ErrorResponse 生成規則に一致する新しい map とする。 id フィールドは command id に設定され、error フィールドは error code に設定され、 message フィールドは、発生したエラーの人間可読な定義を含む 実装定義の文字列に設定され、stacktrace フィールドは任意で、 エラーが発生した時点のアクティブなスタックフレームのスタックトレース報告を含む 実装定義の文字列に設定される。

  2. response を、error data が与えられたものとして serialize an infra value to JSON bytes した結果とする。

    注: command id は null になり得る。その場合、 id フィールドも null に設定され、 response から省略されるわけではない。

  3. response からなる WebSocket メッセージを送信する。 これは connection 上で行う。

WebSocket connection connection が与えられたとき、handle a connection closing するには:

  1. connectionassociated with connection している BiDi session が存在する場合:

    1. session を、connectionassociated with connection している BiDi session とする。

    2. connectionsessionsession WebSocket connections から削除する。

  2. そうでなく、WebSocket connections not associated with a sessionconnection含む場合、connection をその set から削除する

注: これはどの session も終了させない。

UA が望む場合に listener を閉じられるようにするため、session の終了にフックする必要がある。

session が与えられたとき、close the WebSocket connections するには:

  1. sessionsession WebSocket connections 内の各 connection について:

    1. connectionWebSocket の終了ハンドシェイクを開始する

      注: これにより、connection に対して handle a connection closing のステップが実行されることになり、connection に関連付けられたリソースが クリーンアップされる。

4.1. 接続の確立

WebDriver クライアントは、値 true で WebSocket URL capability を要求することにより、 双方向接続にオプトインする。

この仕様によって定義される WebDriver new session algorithm は、 パラメーター sessioncapabilities、および flags を取り、次である:
  1. flags が "bidi" を含む場合、戻る。

  2. webSocketUrl を、capabilities から "webSocketUrl" という名前のプロパティを取得する結果とする。

  3. webSocketUrl が undefined である場合、戻る。

  4. Assert: webSocketUrl は true である。

  5. listener を、session が与えられたものとして start listening for a WebSocket connection した結果とする。

  6. webSocketUrl を、listener および sessionconstruct a WebSocket URL した結果に設定する。

  7. capabilities 上の "webSocketUrl" という名前のプロパティを webSocketUrl設定する

  8. sessionBiDi flag を true に設定する。

  9. "bidi" を flags に追加する。

実装は、HTTP Session ではない BiDi Session を クライアントが確立できるようにもするべきである。この場合、WebSocket サーバーへの URL は 帯域外で伝達される。これを許可する実装は supports BiDi-only sessions する。そのような実装が WebDriver セッションを開始する要求を 受け入れる準備ができた時点で、次を行わなければならない:

  1. null が与えられたものとして Start listening for a WebSocket connection する。

5. サンドボックス化されたスクリプト実行

自動化ツールに共通する要件は、文書の DOM に アクセスできるが、その文書を含む navigable 内で実行されるスクリプトによって DOM API に加えられた変更についての情報を持たないスクリプトを 実行することである。

BiDi sessionsandbox map を持ち、これは weak map であり、その キーは Window オブジェクト、値は文字列と SandboxWindowProxy オブジェクトの間の map である。

注: ここでのサンドボックスの定義は、既存実装の 振る舞いを成文化しようとするものである。これは、仕様では以前は内部的なものと みなされていた実装の一部、特にプラットフォームオブジェクトの内部状態 (これは通常、ブラウザーエンジンの主たる実装言語におけるネイティブオブジェクトとして 実装される)と ECMAScript から見える状態との区別を公開する。既存のサンドボックス 実装はエンジン内の低レベルで行われているため、実装が仕様のすべての詳細に 収束するには遅い過程になる可能性がある。当面の間、実装者には 仕様との差異について詳細な文書を提供することが推奨され、この機能の利用者には サンドボックス内で実行されるスクリプトがすべての実装で動作することを 明示的にテストすることが推奨される。

5.1. サンドボックスレルム

各サンドボックスは一意の ECMAScript Realm である。しかし、sandbox realm は Window realm 内の既存のプラットフォームオブジェクトへのアクセスを、 SandboxProxy オブジェクトを介して提供する。

name および navigable が与えられたとき、 get or create a sandbox realm するには:
  1. name が空文字列である場合、errorerror code invalid argument とともに返す。

  2. windownavigableactive window とする。

  3. sandbox mapwindow を含まない場合、sandbox map[window] を新しい map に設定する。

  4. sandboxessandbox map[window] とする。

  5. sandboxesname を含まない場合、 sandboxes[name] を navigablecreate a sandbox realm したものに設定する。

  6. data sandboxes[name] とともに success を返す。

windowcreate a sandbox realm するには:

sandbox realm の作成を定義する。これは window をラップする SandboxWindowProxy を返すことになる。

target realm が与えられたとき、get a sandbox name するには:

  1. realms maps を、sandbox map の値を取得するものとする。

  2. realms maps 内の各 realms map について:

    1. realms map 内の各 namerealm について:

      1. realmtarget realm である場合、name を返す。

  3. null を返す。

5.2. サンドボックスプロキシオブジェクト

SandboxProxy オブジェクトは、別の realm からの オブジェクトへのサンドボックス化されたアクセスを仲介する exotic object である。 Sandbox proxy objects は、次の制限を強制するように設計されている:

SandboxProxy interface object は存在しない。

SandboxProxy がどのように機能するかを詳細に定義する

unwrapped object を取得するには:
  1. objectSandboxProxy または SandboxWindowProxy である間、object をその wrapped object に設定する。

  2. object を返す。

5.3. SandboxWindowProxy

SandboxWindowProxy は、 Window オブジェクトを表す exotic object であり、それは SandboxProxy オブジェクトによってラップされる。これは、そのデータへのサンドボックス化された アクセスを Window global 内で提供する。

これがどのように機能するかを定義する。

6. ユーザーコンテキスト

user context は、remote end 内にある 0 個以上の top-level traversables の集合を表す。 各 user context は、 関連付けられた storage partition を持つため、remote end のデータは 異なる user contexts 間で共有されない。

これが user context の概念や storage との相互作用を形式的に定義する最良の方法であるかは不明である。

注: Infra 仕様は、user contexts と同じ概念を指すために "user agent" という用語を使用する。しかし、これは 複数の user contexts を持つ Web クライアント全体を意味する "user agent" という用語の用法と互換性がない。この違いは Web コンテンツからは 見えないが、WebDriver を介して観測されるため、この用語法の使用を避ける。

user contextuser context id を持ち、 これは user context の作成時に設定される一意の文字列である。

navigableassociated user context を持ち、これは user context である。

新しい top-level traversable が作成されると、その associated user contextset of user contexts 内の user context に設定される。

注: 場合によっては、 top-level traversable が作成されるときに user context が 仕様によって設定される。しかし、そのような要件が存在しない場合、 associated user context for a top-level traversable は implementation-defined である。

non-null の opener を持つ top-level traversables は、その opener と同じ associated user context を持つと指定すべきだろうか? これが既存実装で強制されているものか確認する必要がある。

child navigableassociated user context は、 その parentassociated user context である。

どの associated user context にもなっていない user context、 すなわちどの top-level traversable に対してもそうでないものは、empty user context である。

default user context は、user context であり、user context id "default" を持つ。

実装は set of user contexts を持ち、これは set of user contexts である。初期状態では、これは default user context を含む。

実装はいつでも、たとえばユーザー操作に応じて、新しい user contextsset of user contexts追加してもよい。

注: ここでいう「いつでも」には実装の 起動中も含まれるため、ある実装は常に set of user contexts 内に 複数のエントリーを持つことがある。

実装は、default user context を除き、任意の empty user contextset of user contexts からいつでも 削除してもよい。 ただし、そのような user contexts を削除する必要はない。 empty user contexts でない User contexts は、 set of user contexts から削除されてはならない。

BiDi sessionuser context to accept insecure certificates override map を持ち、これは user contexts と boolean の間の map である。

BiDi sessionuser context to proxy configuration map を持ち、これは user contextsproxy configuration の間の map である。

emulated network conditions struct は、次を持つ struct である:

BiDi sessionemulated network conditions を持ち、これは struct であり、 default network conditions という名前の item を持つ。これは emulated network conditions struct または null であり、また user context network conditions という名前の item を持つ。これは user contextsemulated network conditions struct の間の weak map であり、 さらに navigable network conditions という名前の item を持つ。これは navigablesemulated network conditions struct の間の weak map である。

user contextset of user contexts から削除されたとき、 remove user context subscriptions する。

remove user context subscriptions するには:

  1. active sessions 内の各 session について:

    1. subscriptions to removeset とする。

    2. sessionsubscriptions 内の各 subscription について:

      1. subscriptionuser context ids が、 navigableassociated user contextuser context id含む場合;

        1. navigableassociated user contextuser context id を、 subscriptionuser context ids から削除する

        2. subscriptionuser context ids が 空である場合:

          1. subscriptionsubscriptions to remove追加する

    3. subscriptions to removesessionsubscriptions から削除する

user context id が与えられたとき、 get user context するには:
  1. set of user contexts 内の各 user context について:

  2. user contextuser context iduser context id と等しい場合:

    1. user context を返す。

  3. null を返す。

user context ids が与えられたとき、get valid user contexts するには:

  1. result を空の set とする。

  2. user context ids の各 user context id について:

    1. user context を、user context idget user context したものに設定する。

    2. user context が null である場合、errorerror code no such user context とともに返す。

    3. user contextresult追加する

  3. result を返す。

7. モジュール

7.1. session モジュール

session モジュールは、remote end のステータスを監視するための コマンドおよびイベントを含む。

7.1.1. 定義

remote end definition

SessionCommand = (
    session.End //
    session.New //
    session.Status //
    session.Subscribe //
    session.Unsubscribe
    )
    

local end definition

SessionResult = (
    session.EndResult /
    session.NewResult /
    session.StatusResult /
    session.SubscribeResult /
    session.UnsubscribeResult
    )
    
session が与えられたとき、 end the session するには:
  1. sessionactive sessions から削除する。

  2. active sessionsである場合、 webdriver-active flag を false に設定する。

session が与えられたとき、cleanup the session するには:

  1. sessionClose the WebSocket connections する。

  2. set of user contexts 内の各 user context について:

    1. sessionuser context to accept insecure certificates override map[user context] を削除する

    2. sessionuser context to proxy configuration map[user context] を削除する

  3. sessionblocked request map 内の各 request id → (request, phase, response) について:

    1. "continue request"、request id および (response, "incomplete") で Resume する。

  4. sessionnetwork collectors 内の各 collector について:

    1. collector idcollectorcollector とする。

    2. collected network data 内の各 collected data について、collected data および collector idremove collector from data する。

  5. active sessionsである場合、 cleanup remote end state する。

  6. 実装固有のクリーンアップステップを実行する。

cleanup remote end state するには。
  1. before request sent mapクリアする

  2. default cache behavior を "default" に設定する。

  3. navigable cache behavior mapクリアする

  4. 現在の remote end 設定で通常有効にされる 実装固有のリソースキャッシュを有効にするための、実装定義のステップを実行する。

7.1.2.

7.1.2.1. session.CapabilitiesRequest 型
session.CapabilitiesRequest = {
    ? alwaysMatch: session.CapabilityRequest,
    ? firstMatch: [*session.CapabilityRequest]
    }
    

session.CapabilitiesRequest 型は、セッションについて要求される capabilities を表す。

7.1.2.2. session.CapabilityRequest 型

remote end definition および local end definition

session.CapabilityRequest = {
    ? acceptInsecureCerts: bool,
    ? browserName: text,
    ? browserVersion: text,
    ? platformName: text,
    ? proxy: session.ProxyConfiguration,
    ? unhandledPromptBehavior: session.UserPromptHandler,
    Extensible
    }
    

session.CapabilityRequest 型は、要求される capabilities の特定の集合を表す。

WebDriver BiDi は additional WebDriver capabilities を定義する。次の表は、各実装が WebDriver BiDi について サポートしなければならない capabilities を列挙する。

Capability: WebSocket URL
Key: "webSocketUrl"
Value type: boolean
Description: 現在のセッションが双方向接続をサポートすることを定義する。
"webSocketUrl" capability に対する additional capability deserialization algorithm は、パラメーター value を取り、次である:
  1. value が boolean でない場合、errorcode invalid argument とともに返す。

  2. data value とともに success を返す。

"webSocketUrl" capability に対する matched capability serialization algorithm は、パラメーター value を取り、次である:
  1. value が false である場合、data null とともに success を返す。

  2. data true とともに success を返す。

7.1.2.3. session.ProxyConfiguration 型

remote end definition および local end definition

session.ProxyConfiguration = {
    session.AutodetectProxyConfiguration //
    session.DirectProxyConfiguration //
    session.ManualProxyConfiguration //
    session.PacProxyConfiguration //
    session.SystemProxyConfiguration
    }

    session.AutodetectProxyConfiguration = (
    proxyType: "autodetect",
    Extensible
    )

    session.DirectProxyConfiguration = (
    proxyType: "direct",
    Extensible
    )

    session.ManualProxyConfiguration = (
    proxyType: "manual",
    ? httpProxy: text,
    ? sslProxy: text,
    ? session.SocksProxyConfiguration,
    ? noProxy: [*text],
    Extensible
    )

    session.SocksProxyConfiguration = (
    socksProxy: text,
    socksVersion: 0..255,
    )

    session.PacProxyConfiguration = (
    proxyType: "pac",
    proxyAutoconfigUrl: text,
    Extensible
    )

    session.SystemProxyConfiguration = (
    proxyType: "system",
    Extensible
    )

    
7.1.2.4. session.UserPromptHandler 型

Remote end definition および local end definition

session.UserPromptHandler = {
    ? alert: session.UserPromptHandlerType,
    ? beforeUnload: session.UserPromptHandlerType,
    ? confirm: session.UserPromptHandlerType,
    ? default: session.UserPromptHandlerType,
    ? file: session.UserPromptHandlerType,
    ? prompt: session.UserPromptHandlerType,
    }
    

session.UserPromptHandler 型は、 user prompt handler の設定を表す。

注: file はファイルピッカーを処理する。"accept" および "dismiss" は ピッカーを閉じる。"ignore" はピッカーを開いたままにする。

7.1.2.5. session.UserPromptHandlerType 型

Remote end definition および local end definition

session.UserPromptHandlerType = "accept" / "dismiss" / "ignore";
    

session.UserPromptHandlerType 型は、 user prompt handler の振る舞いを表す。

7.1.2.6. session.Subscription 型
session.Subscription = text
    

session.Subscription 型は一意の subscription identifier を表す。

7.1.2.7. session.SubscribeParameters 型
session.SubscribeParameters = {
    events: [+text],
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    

session.SubscribeParameters 型は、特定のイベント集合を 購読する要求を表す。

7.1.2.8. session.UnsubscribeByIDRequest 型
session.UnsubscribeByIDRequest = {
    subscriptions: [+session.Subscription],
    }
    

session.UnsubscribeByIDRequest 型は、subscription ID によって識別される event subscriptions を削除する要求を表す。

7.1.2.9. session.UnsubscribeByAttributesRequest 型
session.UnsubscribeByAttributesRequest = {
    events: [+text],
    }
    

session.UnsubscribeByAttributesRequest 型は、 subscription attributes を用いて購読解除する要求を表す。

7.1.3. コマンド

7.1.3.1. session.status コマンド

session.status コマンドは、remote end が新しいセッションを 作成できる状態にあるかどうかについての情報を返し、 さらに実装固有の任意のメタ情報を含んでもよい。

これは static command である。

Command Type
session.Status = (
    method: "session.status",
    params: EmptyParams,
    )
    
Return Type
session.StatusResult = {
    ready: bool,
    message: text,
    }
    

session および command parameters が与えられたときの remote end steps は次である:

  1. body を、次のプロパティを持つ新しい map とする:

    "ready"
    remote endreadiness state
    "message"
    remote endreadiness state を説明する実装定義の文字列。
  2. data body とともに success を返す

7.1.3.2. session.new コマンド

session.new コマンドにより、新しい BiDi session を作成できる。

注: この方法で作成されたセッションは、 HTTP 経由ではアクセスできない。

これは static command である。

Command Type
session.New = (
    method: "session.new",
    params: session.NewParameters
    )

    session.NewParameters = {
    capabilities: session.CapabilitiesRequest
    }
    
Return Type
session.NewResult = {
    sessionId: text,
    capabilities: {
        acceptInsecureCerts: bool,
        browserName: text,
        browserVersion: text,
        platformName: text,
        setWindowRect: bool,
        userAgent: text,
        ? proxy: session.ProxyConfiguration,
        ? unhandledPromptBehavior: session.UserPromptHandler,
        ? webSocketUrl: text,
        Extensible
    }
    }
    

session および command parameters が与えられたときの remote end steps は次である:

  1. session が null でない場合、error code session not created を持つ error を返す。

  2. 実装が何らかの理由で新しいセッションを開始できない場合、 error code session not created を持つ error を返す。

  3. flags を、"bidi" を含む set とする。

  4. capabilities json を、command parameters および flagsprocess capabilities することを試みた結果とする。

  5. capabilities を、capabilities jsonconvert a JSON-derived JavaScript value to an Infra value したものとする。

  6. session を、capabilities および flagscreate a session することを試みた結果とする。

  7. sessionBiDi flag を true に設定する。

    注: このセッションの connection は、 呼び出し元によって現在の connection に設定される。

  8. body を、session.NewResult 生成規則に一致する 新しい map とし、sessionId フィールドを sessionsession ID に設定し、 capabilities フィールドを capabilities に設定する。

  9. data body とともに success を返す。

7.1.3.3. session.end コマンド

session.end コマンドは現在の session を終了する。

Command Type
session.End = (
    method: "session.end",
    params: EmptyParams
    )

    
Return Type
session.EndResult = EmptyResult
    

session および command parameters が与えられたときの remote end steps は次である:

  1. sessionEnd the session する。

  2. data null とともに success を返し、並列に次の ステップを実行する:

    1. このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。

      これは かなり不正確な表現だが、意図としては接続の シャットダウンを開始する前にコマンドへのレスポンスを送信する、ということが明確であることを期待している。

    2. sessionCleanup the session する。

7.1.3.4. session.subscribe コマンド

session.subscribe コマンドは、特定のイベントを グローバルに、または navigables の集合に対して有効にする。

これは realms でも機能するよう 一般化する必要がある。

Command Type
session.Subscribe = (
    method: "session.subscribe",
    params: session.SubscribeParameters
    )
    
Return Type
session.SubscribeResult = {
    subscription: session.Subscription,
    }
    
session および command parameters を伴う remote end steps は次である:
  1. event names を空の set とする。

  2. command parameters["events"] 内の各エントリー name について、 event names を、event names と、 nameobtain a set of event names することを 試みた結果との union とする。

  3. input user context ids を、command parameters[userContexts] で create a set したものとする。

  4. input context ids を、command parameters[contexts] で create a set したものとする。

  5. input user context ids が空でなく、かつ input context ids が空でない場合、 errorerror code invalid argument とともに返す。

  6. subscription navigablesset とする。

  7. top-level traversable context idsset とする。

  8. input context ids が空でない場合:

    1. navigables を、 input context idsget valid navigables by ids することを 試みた結果とする。

    2. subscription navigables を、navigablesget top-level traversables したものに設定する。

    3. subscription navigables 内の各 navigable について:

      1. navigablenavigable idtop-level traversable context ids追加する

  9. そうでなく、input user context ids が空でない場合:

    1. input user context ids の各 user context id について反復する:

      1. user context を、user context idget user context したものとする。

      2. user context が null である場合、errorerror code no such user context とともに返す。

      3. user context である associated user context を持つ、すべての top-level traversables のリスト内の 各 top-level traversable について反復する:

        1. top-level traversablesubscription navigables追加する

  10. そうでなければ、subscription navigables を、remote end 内のすべての top-level traversablesset に設定する。

  11. subscription を、 subscription idUUID の文字列表現に設定され、 event namesevent names に設定され、 top-level traversable idstop-level traversable context ids に設定され、 user context idsinput user context ids に設定された subscription とする。

  12. subscribe step events を新しい map とする。

  13. event names 内の各 event name について:

    1. event name event name を持つ eventremote end subscribe steps を定義していない場合、 continue する。

    2. existing navigables を、session および event nameset of top-level traversables for which an event is enabled したものとする。

    3. subscribe step events[event name] を、 subscription navigablesexisting navigablesdifference に設定する。

  14. subscriptionsessionsubscriptions に追加する。

  15. subscriptionsubscription idsessionknown subscription ids に追加する。

  16. subscribe step events を、キー event name one および event name two を持つ 2 つのエントリーが与えられたときの次の less than アルゴリズムを用いて昇順に並べ替える:

    1. event one を、名前 event name one を持つ event とする

    2. event two を、名前 event name two を持つ event とする

    3. event onesubscribe priorityevent two の subscribe priority より小さい場合は true を返し、そうでなければ false を返す。

  17. subscriptionglobal である場合、include global を true とし、 そうでなければ include global を false とする。

  18. subscribe step events 内の各 event namenavigables について:

    1. event name event name を持つ event について、 sessionnavigables および include global が与えられたものとして remote end subscribe steps を実行する。

  19. body を、session.SubscribeResult 生成規則に一致する 新しい map とし、 subscription フィールドを subscriptionsubscription id に設定する。

  20. data body とともに success を返す。

7.1.3.5. session.unsubscribe コマンド

session.unsubscribe コマンドは、イベントを グローバルに、または navigables の集合に対して無効にする。

これは realms でも機能するように 一般化する必要がある。

コマンド型
session.Unsubscribe = (
    method: "session.unsubscribe",
    params: session.UnsubscribeParameters,
    )

    session.UnsubscribeParameters = session.UnsubscribeByAttributesRequest / session.UnsubscribeByIDRequest
    
戻り値型
session.UnsubscribeResult = EmptyResult
    
session および command parameters を伴う remote end steps は次である:
  1. command parameters が "subscriptions" を含まない場合:

    注: この条件は、 command parameters が session.UnsubscribeByAttributesRequest 生成規則に一致することを意味する。

    1. event names を空の set とする。

    2. command parameters["events"] 内の各エントリー name について、 event names を、 event names と、nameobtain a set of event names することを 試みた結果との union とする。

    3. new subscriptionslist とする。

    4. matched eventsset とする。

    5. sessionsubscriptions の各 subscription について:

      1. subscriptionevent namesevent namesintersection が空の set である場合:

        1. subscriptionnew subscriptions追加する

        2. Continue する。

      2. subscriptionglobal でない場合:

        1. subscriptionnew subscriptions追加する

        2. Continue する。

      3. subscription event names を、subscriptionevent namesclone とする。

      4. event names の各 event name について:

        1. subscription event namesevent name含む場合:

          1. event namematched events追加する

          2. event namesubscription event names から削除する

      5. subscription event names が空でない場合:

        1. cloned subscription を、 subscription idsubscriptionsubscription id に設定され、 event namessubscription event names を含む新しい set に設定された subscription とする。

        2. cloned subscriptionnew subscriptions追加する

    6. matched eventsevent names等しくない場合、errorerror code invalid argument とともに返す。

    7. sessionsubscriptionsnew subscriptions に設定する。

  2. そうでなければ:

    1. subscriptions を、command parameters[subscriptions] で create a set したものとする。

    2. unknown subscription ids を、subscriptionssessionknown subscription ids の間の difference とする。

    3. unknown subscription ids が空でない場合:

      1. errorerror code invalid argument とともに返す。

    4. subscriptions to remove を空の set とする。

    5. sessionsubscriptions 内の各 subscription について:

      1. subscriptionssubscriptionsubscription id含む場合:

        1. subscriptionsubscriptions to remove追加する

    6. sessionknown subscription ids を、 sessionknown subscription idssubscriptions の間の difference に設定する。

    7. subscriptions to remove 内の各項目を sessionsubscriptions から削除する

  3. data null とともに success を返す。

7.2. browser モジュール

browser モジュールは、 remote end のブラウザープロセスを管理するためのコマンドを含む。

7.2.1. 定義

remote end definition

BrowserCommand = (
    browser.Close //
    browser.CreateUserContext //
    browser.GetClientWindows //
    browser.GetUserContexts //
    browser.RemoveUserContext //
    browser.SetClientWindowState //
    browser.SetDownloadBehavior
    )
    

local end definition

BrowserResult = (
    browser.CloseResult /
    browser.CreateUserContextResult /
    browser.GetClientWindowsResult /
    browser.GetUserContextsResult /
    browser.RemoveUserContextResult /
    browser.SetClientWindowStateResult /
    browser.SetDownloadBehaviorResult
    )
    

7.2.2. ウィンドウ

top-level traversable は単一の client window に関連付けられる。これは、その top-level traversableactive document を、その visibility state が "visible" であるときにレンダリングするために使用される viewport を含む矩形領域を表し、 traversable の表示に関連付けられたブラウザー固有のユーザーインターフェイス要素 (例: URL バー、ツールバー、または OS のウィンドウ装飾)も表す。

client windowclient window id を持ち、 これはそのウィンドウを一意に識別する文字列である。

client windowx-coordinate を持ち、これは web-exposed screen area の左端とウィンドウの左端との間の CSS ピクセル数、または特定のウィンドウについてそれが意味をなさない場合は ゼロである。

client windowy-coordinate を持ち、これは web-exposed screen area の上端とウィンドウの上端との間の CSS ピクセル数、または特定のウィンドウについてそれが意味をなさない場合は ゼロである。

client windowwidth を持ち、これは CSS ピクセルにおけるウィンドウ矩形の幅である。

client windowheight を持ち、これは CSS ピクセルにおけるウィンドウ矩形の高さである。

windowmaximize the client window を行うには、実装はプラットフォームにおける window の最大化の概念に対応する ステップを実行するか、 windowx-coordinate が可能な限り 0 に近くなり、 その y-coordinate が可能な限り 0 に近くなり、 その widthweb-exposed screen area の幅に可能な限り近くなり、その heightweb-exposed screen area の高さに可能な限り近くなるように window を配置するべきである。これらのいずれかの選択肢がサポートされる場合、 maximize client window is supported である。

windowminimize the client window を行うには、実装はプラットフォームにおける window の最小化の概念に対応する ステップを実行するか、 そうでなければ window に関連付けられた top-level traversables 内のすべての active documentsvisibility state が "hidden" になり、かつ windowwidth および height がどちらも可能な限り 0 に近くなるように、 window を隠すべきである。これらのいずれかの選択肢が サポートされる場合、minimize client window is supported である。

windowrestore the client window を行うには、実装はそれが プラットフォーム定義の最大化状態でも、プラットフォーム定義の 最小化状態でもなく、かつ window に関連付けられた 1 つ以上の top-level traversable が存在する場合は、そのうち少なくとも 1 つが "visible" 状態の active document を持つことを保証するべきである。 これがサポートされる場合、restore client window is supported である。

window が与えられたとき、get the client window state するには:

  1. documents を空の list とする。

  2. visible documents を空の list とする。

  3. top-level traversable traversable について:

    1. traversableclient windowwindow でない場合、 continue する。

    2. documenttraversableactive document とする。

    3. documentdocuments追加する

    4. documentvisibility state が "visible" である場合、 documentvisible documents追加する

  4. visible documents 内の各 document について:

    1. documentfullscreen element が null でない場合、 "fullscreen" を返す。

  5. visible documentsであるが documentsでない場合、または window がその他の OS 固有の 最小化状態にある場合、"minimized" を返す。

    注: これは通常、必ずしもそうとは限らないが、 windowwidth および height が 0 に等しいことを意味する。

  6. window が OS 固有の最大化状態にある場合、 "maximized" を返す。

    注: これは通常、必ずしもそうとは限らないが、 windowwidthweb-exposed screen area の幅に等しく、 windowheightweb-exposed screen area の高さに等しいことを意味する。

  7. "normal" を返す。

window および state が与えられたとき、set the client window state するには:

  1. current state を、windowget the client window state したものとする。

  2. current state が "fullscreen"、"maximized"、または "minimized" であり、かつ state と等しい場合、data null とともに success を返す。

  3. 次の条件と関連するステップのリストにおいて、 関連する条件が true である最初のステップ集合を実行する:

    "fullscreen"
    fullscreen is supported でない場合、errorerror code unsupported operation とともに返す。
    "normal"
    window について restore client window is supported でない場合、errorerror code unsupported operation とともに返す。
    "maximize"
    window について maximize client window is supported でない場合、errorerror code unsupported operation とともに返す。
    "minimize"
    window について minimize client window is supported でない場合、errorerror code unsupported operation とともに返す。
  4. documents を空の list とする。

  5. top-level traversable traversable について:

    1. traversable に関連付けられた client windowwindow でない場合、 continue する。

    2. documenttraversableactive document とする。

    3. documentdocuments に追加する。

  6. documentsである場合、 errorerror code no such client window とともに返す。

  7. current state が "fullscreen" である場合:

    1. documents 内の各 document について:

      1. documentFully exit fullscreen する。

        注: これは、 fullscreen でない window 内の文書に対しては何もしない。

  8. current state が "maximized" または "minimized" である場合:

    1. windowRestore the client window する。

  9. state の値について分岐する:

    "fullscreen"
    1. documents 内の各 document について:

      1. documentvisibility state が "visible" である場合、 documentdocument elementfullscreen an element する。

      2. Break する。

    "maximize"
    1. windowMaximize the client window する。
    "minimize"
    1. windowMinimize the client window する。
  10. data null とともに success を返す。

7.2.3.

7.2.3.1. browser.ClientWindow 型
browser.ClientWindow = text;
    

browser.ClientWindowclient window を一意に識別する。

7.2.3.2. browser.ClientWindowInfo 型
browser.ClientWindowInfo = {
    active: bool,
    clientWindow: browser.ClientWindow,
    height: js-uint,
    state: "fullscreen" / "maximized" / "minimized" / "normal",
    width: js-uint,
    x: js-int,
    y: js-int,
    }
    

browser.ClientWindowInfo 型は、 client window のプロパティを表す。

client window が与えられたとき、 get the client window info するには:
  1. client window id を、client windowclient window id とする。

  2. state を、client windowget the client window state したものとする。

  3. client window がオペレーティングシステムから送られるキーボード入力を 受け取ることができる場合、active を true とし、そうでなければ active を false とする。

    注: これは、client window である client window を持つ top-level traversablesystem focus を持つことを意味する場合もあれば、 ブラウザー自体のユーザーインターフェイスが現在フォーカスを持つことを意味する場合もある。

  4. client window info を、 browser.ClientWindowsInfo 生成規則に一致する map とし、 clientWindow フィールドを client window id に、state フィールドを state に、x フィールドを client windowx-coordinate に、y フィールドを client windowy-coordinate に、width フィールドを client windowwidth に、height フィールドを client windowheight に、active フィールドを active に設定したものとする。

  5. client window info を返す

7.2.3.3. browser.UserContext 型
browser.UserContext = text;
    

browser.UserContextuser context を一意に識別する。

7.2.3.4. browser.UserContextInfo 型
browser.UserContextInfo = {
    userContext: browser.UserContext
    }
    

browser.UserContextInfo 型は user context のプロパティを表す。

7.2.4. コマンド

7.2.4.1. browser.close コマンド

browser.close コマンドは、すべての WebDriver セッションを終了し、remote browser instance 内の自動化状態をクリーンアップする。

コマンド型
browser.Close = (
    method: "browser.close",
    params: EmptyParams,
    )
    
戻り値型
browser.CloseResult = EmptyResult
    
session および command parameters を伴う remote end steps は次である:
  1. sessionEnd the session する。

  2. active sessionsでない場合、 実装は unable to close browsererror code を持つ error を返してもよく、その後 次のステップを並列に実行する:

    1. このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。

    2. sessionCleanup the session する。

    注: ブラウザーが複数の自動化 セッションを持つ場合の挙動は、現在未指定である。任意のセッションが ブラウザーを閉じられるのか、最後に開かれたセッションだけが実際に ブラウザーを閉じられるのか、あるいは最初に開始されたセッションだけが可能なのかもしれない。この挙動は、 この仕様の将来のバージョンで完全に指定されるかもしれない。

  3. active sessions 内の各 active session について:

    1. active sessionEnd the session する。

    2. active sessionCleanup the session する

  4. data null とともに success を返し、次のステップを並列に実行する。

    1. このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。

    2. sessionCleanup the session する。

    3. top-level traversables を、どれでも Close する。ただし prompting to unload しない。

    4. 自動化下の remote end に関連付けられたリソースを クリーンアップするための実装定義のステップを実行する。

      注: たとえばこれには、自動化下のブラウザーに関連付けられた OS レベルのプロセスを正常にシャットダウンすること、remote end が自動化下にある間に作成した ユーザープロファイルデータなどの一時状態を削除すること、または WebSocket Listener をシャットダウンすることが 含まれ得る。ブラウザーおよびオペレーティングシステムの違いにより、 local ends がここで依存できる正確な不変条件を 詳細に指定することはできない。

7.2.4.2. browser.createUserContext コマンド

browser.createUserContext コマンドは user context を作成する。

コマンド型
browser.CreateUserContext = (
    method: "browser.createUserContext",
    params: browser.CreateUserContextParameters,
    )

    browser.CreateUserContextParameters = {
    ? acceptInsecureCerts: bool,
    ? proxy: session.ProxyConfiguration,
    ? unhandledPromptBehavior: session.UserPromptHandler
    }
    
戻り値型
browser.CreateUserContextResult = browser.UserContextInfo
    

session および command parameters を伴う remote end steps は次である:

  1. user context を新しい user context とする。

  2. command parameters が "acceptInsecureCerts" を含む場合:

    注: "acceptInsecureCerts" が 設定されている場合、それは accept insecure TLS flag の挙動を上書きする。

    1. acceptInsecureCertscommand parameters["acceptInsecureCerts"] とする:

    2. acceptInsecureCerts が true であり、endpoint node が insecure TLS connections の受け入れをサポートしていない場合、 unsupported operationerror code を持つ error を返す。

    3. sessionuser context to accept insecure certificates override map[user context] を acceptInsecureCerts設定する

  3. command parameters が "unhandledPromptBehavior" を含む場合、 unhandled prompt behavior overrides map[user context] を command parameters["unhandledPromptBehavior"] に設定する

  4. command parameters が "proxy" を含む場合:

    1. proxy configurationcommand parameters["proxy"] とする。

    2. remote enduser context ごとに proxy settings を構成できない場合、 または proxy configuration で proxy を構成できない場合、 unsupported operationerror code を持つ error を返す。

    3. sessionuser context to proxy configuration map[user context] を proxy configuration設定する

  5. user contextset of user contexts追加する

  6. user context info を、 browser.UserContextInfo 生成規則に一致する map とし、 userContext フィールドを user contextuser context id に設定したものとする。

  7. data user context info とともに success を返す。

7.2.4.3. browser.getClientWindows コマンド

browser.getClientWindows コマンドは、 client window のリストを返す。

コマンド型
browser.GetClientWindows = (
    method: "browser.getClientWindows",
    params: EmptyParams,
    )
    
戻り値型
browser.GetClientWindowsResult = {
    clientWindows: [ * browser.ClientWindowInfo]
    }
    

remote end steps は次である:

  1. client window ids を空の set とする。

  2. client windows を空の list とする。

  3. top-level traversable traversable について:

    1. client window を、traversable に関連付けられた client window とする

    2. client window id を、client windowclient window id とする。

    3. client window idsclient window id含む場合、continue する。

    4. client window idclient window ids追加する

    5. client window info を、client windowget the client window info したものとする。

    6. client window infoclient windows追加する

  4. result を、 browser.GetClientWindowsResult 生成規則に一致する map とし、 clientWindows フィールドを client windows に設定したものとする。

  5. data result とともに success を返す。

7.2.4.4. browser.getUserContexts コマンド

browser.getUserContexts コマンドは、 user context のリストを返す。

コマンド型
browser.GetUserContexts = (
    method: "browser.getUserContexts",
    params: EmptyParams,
    )
    
戻り値型
browser.GetUserContextsResult = {
    userContexts: [ + browser.UserContextInfo]
    }
    

remote end steps は次である:

  1. user contexts を空の list とする。

  2. set of user contexts 内の各 user context について:

    1. user context info を、 browser.UserContextInfo 生成規則に一致する map とし、 userContext フィールドを user contextuser context id に設定したものとする。

    2. user context infouser contexts追加する

  3. result を、 browser.GetUserContextsResult 生成規則に一致する map とし、 userContexts フィールドを user contexts に設定したものとする。

  4. data result とともに success を返す。

7.2.4.5. browser.removeUserContext コマンド

browser.removeUserContext コマンドは、 beforeunload ハンドラーを実行せずに、user context およびその中のすべての navigables を閉じる。

コマンド型
browser.RemoveUserContext = (
    method: "browser.removeUserContext",
    params: browser.RemoveUserContextParameters
    )

    browser.RemoveUserContextParameters = {
    userContext: browser.UserContext
    }
    
戻り値型
browser.RemoveUserContextResult = EmptyResult
    

command parameters を伴う remote end steps は次である:

  1. user context idcommand parameters["userContext"] とする。

  2. user context id"default" である場合、errorerror code invalid argument とともに返す。

  3. user context を、user context idget user context したものに設定する。

  4. user context が null である場合、errorerror code no such user context とともに返す。

  5. top-level traversable navigable について:

    1. navigableassociated user contextuser context である場合:

      1. navigable閉じる。ただし prompting to unload しない。

  6. user contextset of user contexts から削除する

  7. data null とともに success を返す。

7.2.4.6. browser.setClientWindowState コマンド

browser.setClientWindowState コマンドは、 client window の寸法を設定する。

コマンド型
browser.SetClientWindowState = (
    method: "browser.setClientWindowState",
    params: browser.SetClientWindowStateParameters
    )

    browser.SetClientWindowStateParameters = {
    clientWindow: browser.ClientWindow,
    (browser.ClientWindowNamedState // browser.ClientWindowRectState)
    }

    browser.ClientWindowNamedState = (
    state: "fullscreen" / "maximized" / "minimized"
    )

    browser.ClientWindowRectState = (
    state: "normal",
    ? width: js-uint,
    ? height: js-uint,
    ? x: js-int,
    ? y: js-int,
    )
    
戻り値型
browser.SetClientWindowStateResult = browser.ClientWindowInfo
    

session および command parameters を伴う remote end steps は次である:

  1. 実装が client window state の設定をまったくサポートしていない場合、 unsupported operationerror code を持つ error を返す。

  2. command parameters["clientWindow"] の client window id を持つ client window が存在する場合、client window をその client window とする。 そうでなければ、no such client windowerror code を持つ error を返す。

  3. client window および command parameters["state"] で set the client window state することを試みる

  4. command parameters["state"] が "normal" である場合:

    1. command parameters が "x" を含み、かつ実装が client windows の位置指定をサポートする場合、client windowx-coordinate を、 command parameters["x"] に可能な限り近い値に設定する。

    2. command parameters が "y" を含み、かつ実装が client windows の位置指定をサポートする場合、client windowy-coordinate を、 command parameters["y"] に可能な限り近い値に設定する。

    3. command parameters が "width" を含み、かつ実装が client windows のリサイズをサポートする場合、 client windowwidthcommand parameters["width"] に可能な限り近い値に設定する。

    4. command parameters が "width" を含み、かつ実装が client windows のリサイズをサポートする場合、 client windowwidthcommand parameters["width"] に可能な限り近い値に設定する。

  5. client window info を、client windowget the client window info したものとする。

  6. data client window info とともに success を返す。

注: 単純化のため、これはすべての client window 操作を 同期的なものとしてモデル化している。したがって、返される client window の寸法は、 window が新しい状態に到達した後のものになることが期待される。

7.2.4.7. browser.setDownloadBehavior コマンド

download behavior struct は、次を持つ struct である:

remote enddownload behavior を持ち、これは struct であり、 default download behavior という名前の item を持つ。これは download behavior struct または null であり、さらに user context download behavior という名前の item を持つ。これは user contextsdownload behavior struct の間の weak map である。

コマンド型
browser.SetDownloadBehavior = (
    method: "browser.setDownloadBehavior",
    params: browser.SetDownloadBehaviorParameters
    )

    browser.SetDownloadBehaviorParameters = {
    downloadBehavior: browser.DownloadBehavior / null,
    ? userContexts: [+browser.UserContext]
    }

    browser.DownloadBehavior = {
    (
        browser.DownloadBehaviorAllowed //
        browser.DownloadBehaviorDenied
    )
    }

    browser.DownloadBehaviorAllowed = (
    type: "allowed",
    destinationFolder: text
    )

    browser.DownloadBehaviorDenied = (
    type: "denied"
    )
    
戻り値型
browser.SetDownloadBehaviorResult = EmptyResult
    
navigable が与えられたとき、 get download behavior するには:
  1. user contextnavigableassociated user context とする。

  2. download behavioruser context download behavioruser context含む場合、download behavioruser context download behavior[user context] を返す。

  3. download behaviordefault download behavior を返す。

session および command parameters を伴う remote end steps は次である:

  1. command parameters["downloadBehavior"] が null である場合、 download behavior を null とする。

  2. そうでなければ:

    1. command parameters["downloadBehavior"]["type"] が "allowed" である場合、allowed を true とし、そうでなければ allowed を false とする。

    2. command parameters["downloadBehavior"] が "destinationFolder" を含む場合、destinationFoldercommand parameters["downloadBehavior"]["destinationFolder"] とし、 そうでなければ destinationFolder を null とする。

    3. download behavior を、allowedallowed に設定され、 destinationFolderdestinationFolder に設定された download behavior struct とする。

  3. 実装が要求された download behavior をサポートしていない場合、 errorerror code unsupported operation とともに返す。

  4. command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. download behavior が null である場合、user contextdownload behavioruser context download behavior から削除する

      2. そうでなければ、download behavioruser context download behavior[user context] を download behavior設定する

  5. そうでなければ、download behaviordefault download behaviordownload behavior に設定する。

  6. data null とともに success を返す。

7.3. browsingContext モジュール

browsingContext モジュールは、navigables に関係するコマンドおよび イベントを含む。

注: 歴史的な理由により、このモジュールは navigable ではなく browsingContext と呼ばれ、プロトコルは navigables を指すために context という用語を使用する。これは特にコマンドおよび レスポンスパラメーター内のフィールドとして用いられる。

ナビゲーションの進行状況は、次の items を持つ、 不変の struct WebDriver BiDi navigation status を用いて伝達される:

id
ナビゲーションの navigation id、または進行する前にナビゲーションが 取り消された場合は null。
status
"canceled"、 "pending"、または "complete" のいずれかであるステータスコード。
url
ナビゲーションで読み込まれている URL
suggestedFilename
ナビゲーションがダウンロードである場合は提案されるファイル名、そうでなければ null。
downloadedFilepath
ナビゲーションが完了済みのダウンロードであり、ダウンロードされたファイルが 利用可能である場合は、そのダウンロードファイルの絶対ファイルパス、そうでなければ null。

7.3.1. 定義

remote end definition

BrowsingContextCommand = (
    browsingContext.Activate //
    browsingContext.CaptureScreenshot //
    browsingContext.Close //
    browsingContext.Create //
    browsingContext.GetTree //
    browsingContext.HandleUserPrompt //
    browsingContext.LocateNodes //
    browsingContext.Navigate //
    browsingContext.Print //
    browsingContext.Reload //
    browsingContext.SetBypassCSP //
    browsingContext.SetViewport //
    browsingContext.TraverseHistory
    )
    

local end definition

BrowsingContextResult = (
    browsingContext.ActivateResult /
    browsingContext.CaptureScreenshotResult /
    browsingContext.CloseResult /
    browsingContext.CreateResult /
    browsingContext.GetTreeResult /
    browsingContext.HandleUserPromptResult /
    browsingContext.LocateNodesResult /
    browsingContext.NavigateResult /
    browsingContext.PrintResult /
    browsingContext.ReloadResult /
    browsingContext.SetBypassCSPResult /
    browsingContext.SetViewportResult /
    browsingContext.TraverseHistoryResult
    )

    BrowsingContextEvent = (
    browsingContext.ContextCreated //
    browsingContext.ContextDestroyed //
    browsingContext.DomContentLoaded //
    browsingContext.DownloadEnd //
    browsingContext.DownloadWillBegin //
    browsingContext.FragmentNavigated //
    browsingContext.HistoryUpdated //
    browsingContext.Load //
    browsingContext.NavigationAborted //
    browsingContext.NavigationCommitted //
    browsingContext.NavigationFailed //
    browsingContext.NavigationStarted //
    browsingContext.UserPromptClosed //
    browsingContext.UserPromptOpened
    )
    

remote enddevice pixel ratio overrides を持ち、これは navigables と device pixel ratio overrides の間の weak map である。 これは初期状態では空である。

注: この map は最後のセッションが終了しても クリアされない。すなわち device pixel ratio overrides はどの WebDriver セッションよりも長く存続する。

viewport dimensions は、次を持つ struct である:

viewport configuration は、次を持つ struct である:

unhandled prompt behavior struct は、次を持つ struct である:

remote endviewport overrides map を持ち、これは user contextsviewport configuration の間の weak map である。

remote endlocale overrides map を持ち、これは navigables または user contexts と string の間の weak map である。

screen settingsstruct であり、 height という名前の item を持つ。これは integer であり、 width という名前の item を持つ。これは integer であり、 x という名前の item を持つ。これは integer であり、 y という名前の item を持つ。これは integer である。

remote endscreen settings overrides を持ち、これは struct であり、 user context screen settings という名前の item を持つ。これは user contextsscreen settings の間の weak map であり、 さらに navigable screen settings という名前の item を持つ。これは navigablesscreen settings の間の weak map である。

remote endtimezone overrides map を持ち、これは navigables または user contexts と string の間の weak map である。

remote endunhandled prompt behavior overrides map を持ち、これは user contextsunhandled prompt behavior struct の間の weak map である。

remote endscripting enabled overrides map を持ち、これは navigables または user contexts と boolean の間の weak map である。

7.3.2.

7.3.2.1. browsingContext.BrowsingContext 型

remote end definition および local end definition

browsingContext.BrowsingContext = text;
    

navigable は、関連付けられた navigable id を持つ。 これは、その navigable を一意に識別する string である。これは navigable が作成されるときに暗黙的に設定される。関連付けられた WebDriver window handle を持つ navigables については、navigable idwindow handle と同じでなければならない。

navigable は、associated storage partition も持つ。 これは、その navigable がデータを永続化するために使用する storage partition である。

navigable は、関連付けられた original opener も持つ。 これは、その navigable を開かせた navigable または null であり、初期状態では null に設定される。

navigable id が与えられたとき、 get a navigable するには:
  1. navigable id が null である場合、data null とともに success を返す。

  2. navigable id navigable id を持つ navigable が存在しない場合、 no such frameerror code を持つ error を返す

  3. navigable を、id navigable id を持つ navigable とする。

  4. data navigable とともに success を返す。

7.3.2.2. browsingContext.Info 型

local end definition

browsingContext.InfoList = [*browsingContext.Info]

    browsingContext.Info = {
    children: browsingContext.InfoList / null,
    clientWindow: browser.ClientWindow,
    context: browsingContext.BrowsingContext,
    originalOpener: browsingContext.BrowsingContext / null,
    url: text,
    userContext: browser.UserContext,
    ? parent: browsingContext.BrowsingContext / null,
    }
    

browsingContext.Info 型は navigable のプロパティを表す。

navigable が与えられたとき、 get the child navigables するには:

TODO: これが文書順のリストを返すようにする

  1. child navigables を、navigablechild navigable であるすべての navigables を含む set とする。

  2. child navigables を返す。

navigablemax depth および include parent id が与えられたとき、 get the navigable info するには:
  1. navigable id を、navigablenavigable id とする。

  2. parent navigablenavigableparent とする。

  3. parent navigable が null でない場合、parent idparent navigablenavigable id とする。 そうでなければ、 parent id を null とする。

  4. documentnavigableactive document とする。

  5. url を、documentURL が与えられたものとして URL serializer を実行した結果とする。

    注: これは URL の fragment component を含む。

  6. child infos を null とする。

  7. max depth が null である、または max depth が 0 より大きい場合:

    1. child navigables を、navigable が与えられたものとして get the child navigables したものとする。

    2. max depth が null でない場合、child depthmax depth - 1 とし、そうでなければ null とする。

    3. child infos を空の list に設定する。

    4. child navigables の各 child navigable について:

      1. info を、 child navigablechild depth および false が与えられたものとして get the navigable info した結果とする。

      2. infochild infos に追加する

  8. user contextnavigableassociated user context とする。

  9. navigableoriginal opener が null でない場合、 opener idnavigableoriginal openernavigable id とし、 そうでなければ null とする。

  10. top-level traversablenavigabletop-level traversable とする。

  11. client window id を、top-level traversable に関連付けられた client windowclient window id とする。

  12. navigable info を、 browsingContext.Info 生成規則に一致する map とし、context フィールドを navigable id に、include parent idtrue である場合は parent フィールドを parent id に設定し、そうでなければ未設定とし、 url フィールドを url に、userContext フィールドを user contextuser context id に、originalOpener フィールドを opener id に、children フィールドを child infos に、 clientWindow フィールドを client window id に設定したものとする。

  13. navigable info を返す。

navigablerequestwait condition、および任意で history handling(デフォルト: "default")と ignore cache(デフォルト: false)が 与えられたとき、await a navigation するには:
  1. navigation id を、真のランダムまたは擬似ランダムな数値に基づく UUID の文字列表現とする。

  2. navigable を resource requestnavigate し、source Document として navigableactive document を用い、 navigation id navigation id および history handling behavior history handling を用いる。ignore cache が true である場合、 そのナビゲーションは HTTP cache からリソースを読み込んではならない。

    ignore cache flag がどのように機能するかを適切に指定する必要がある。これは、リソースの最初の読み込みだけが cache をバイパスするのか (すなわち、最初に cache をクリアして通常どおり進むのと同様であるか)、 または HTML parser によって直接読み込まれないリソース (例: scripts または stylesheets によって開始される読み込み)も cache をバイパスするのかを考慮する必要がある。

  3. (event received, navigation status) を、 «"navigation started", "navigation failed", "fragment navigated"» および navigation id が与えられたものとして await したものとする。

  4. Assert: navigation statusidnavigation id である。

  5. navigation statusstatus が "complete" である場合:

    1. body を、 browsingContext.NavigateResult 生成規則に一致する map とし、 navigation フィールドを navigation id に、url フィールドを navigation statusurl が与えられたものとして URL serializer を実行した結果に設定したものとする。

    2. data body とともに success を返す。

    注: これは、そのナビゲーションが fragment の変更だけを 引き起こした場合である。

  6. navigation statusstatus が "canceled" である場合、 unknown errorerror code を持つ error を返す。

    TODO: ここでエラーを扱うにはこれが正しい方法か?

  7. Assert: navigation statusstatus は "pending" であり、navigation id は null でない。

  8. wait condition が "committed" である場合、event name を "committed" とする。

  9. そうでなく、wait condition が "interactive" である場合、event name を "domContentLoaded" とする。

  10. そうでなければ、event name を "load" とする。

  11. (event received, status) を、 «event name, "download started", "navigation aborted", "navigation failed"» および navigation id が与えられたものとして await したものとする。

  12. event received が "navigation failed" である場合、 unknown errorerror code を持つ error を返す。

    ここでの error により、何が失敗し、なぜ失敗したのかについて十分な情報を 表面化できているか? どの error code が望ましいか? local ends が実装定義の文字列を 解析して、実際に何が問題だったのかを把握しようとする問題は生じるか?

  13. body を、 browsingContext.NavigateResult 生成規則に一致する map とし、 navigation フィールドを status の id に、 url フィールドを status の url が与えられたものとして URL serializer を実行した結果に設定したものとする。

  14. data body とともに success を返す。

7.3.2.3. browsingContext.Locator 型

remote end definition および local end definition

browsingContext.Locator = (
    browsingContext.AccessibilityLocator /
    browsingContext.CssLocator /
    browsingContext.ContextLocator /
    browsingContext.InnerTextLocator /
    browsingContext.XPathLocator
    )

    browsingContext.AccessibilityLocator = {
    type: "accessibility",
    value: {
        ? name: text,
        ? role: text,
    }
    }

    browsingContext.CssLocator = {
    type: "css",
    value: text
    }

    browsingContext.ContextLocator = {
    type: "context",
    value: {
        context: browsingContext.BrowsingContext,
    }
    }

    browsingContext.InnerTextLocator = {
    type: "innerText",
    value: text,
    ? ignoreCase: bool
    ? matchType: "full" / "partial",
    ? maxDepth: js-uint,
    }

    browsingContext.XPathLocator = {
    type: "xpath",
    value: text
    }
    

browsingContext.Locator 型は、文書内の node を特定するための strategy についての詳細を提供する。

7.3.2.4. browsingContext.Navigation 型

remote end definition および local end definition

browsingContext.Navigation = text;
    

browsingContext.Navigation 型は、進行中の navigation を識別する一意の string である。

TODO: HTML 仕様内の定義へリンクする。

7.3.2.5. browsingContext.NavigationInfo 型

local end definition:

browsingContext.BaseNavigationInfo = (
    context: browsingContext.BrowsingContext,
    navigation: browsingContext.Navigation / null,
    timestamp: js-uint,
    url: text,
    ? userContext: browser.UserContext,
    )

    browsingContext.NavigationInfo = {
    browsingContext.BaseNavigationInfo
    }
    

browsingContext.NavigationInfo 型は、進行中の navigation の詳細を提供する。

navigable navigable および navigation status navigation status が与えられたとき、 get the navigation info するには:
  1. navigable id を、navigablenavigable id とする。

  2. navigation idnavigation statusid とする。

  3. timestamp を、UTC での現在の日付および時刻を表す time value とする。

  4. urlnavigation statusurl とする。

  5. user context id を、navigableassociated user contextuser context id とする。

  6. browsingContext.NavigationInfo 生成規則に一致する map を返す。 context フィールドは navigable id に、navigation フィールドは navigation id に、timestamp フィールドは timestamp に、 url フィールドは url が与えられたものとして URL serializer を実行した結果に、 userContext フィールドは user context id に設定される。

7.3.2.6. browsingContext.ReadinessState 型
browsingContext.ReadinessState = "none" / "interactive" / "complete"
    

browsingContext.ReadinessState 型は、navigation command が返る document loading の段階を表す。

7.3.2.7. browsingContext.UserPromptType 型

Remote end definition および local end definition

browsingContext.UserPromptType = "alert" / "beforeunload" / "confirm" / "prompt";
    

browsingContext.UserPromptType 型は、可能な user prompt 型を表す。

7.3.3. コマンド

7.3.3.1. browsingContext.activate コマンド

browsingContext.activate コマンドは、 指定された top-level traversable をアクティブ化し、フォーカスする。

コマンド型
browsingContext.Activate = (
    method: "browsingContext.activate",
    params: browsingContext.ActivateParameters
    )

    browsingContext.ActivateParameters = {
    context: browsingContext.BrowsingContext
    }
    
戻り値型
browsingContext.ActivateResult = EmptyResult
    

command parameters を伴う remote end steps は次である:

  1. navigable idcommand parameters["context"] フィールドの値とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

  4. navigableactivate a navigable した結果を返す。

navigable が与えられたとき、 activate a navigable するには:
  1. navigablesystem visibility statevisible になるように、実装固有のステップを実行する。 これが不可能である場合、error code unsupported operation を持つ error を返す。

    注: これは、現在 visible である navigableshidden にする副作用を持ち得る。

    注: これは、window を最小化解除すること、または system visibility state の変更に関連するその他の副作用により、 基礎となる OS 状態を変更し得る。

  2. navigable がフォーカスされていない場合、navigablesystem focus を設定するための実装固有のステップを実行する。

    注: これは、他の仕様で義務付けられている場合を除き、 focused area of the document を変更しない。

  3. data null とともに success を返す。

7.3.3.2. browsingContext.captureScreenshot コマンド

browsingContext.captureScreenshot コマンドは、 指定された navigable の画像をキャプチャし、それを Base64 エンコードされた文字列として返す。

コマンド型
browsingContext.CaptureScreenshot = (
    method: "browsingContext.captureScreenshot",
    params: browsingContext.CaptureScreenshotParameters
    )

    browsingContext.CaptureScreenshotParameters = {
    context: browsingContext.BrowsingContext,
    ? origin: ("viewport" / "document") .default "viewport",
    ? format: browsingContext.ImageFormat,
    ? clip: browsingContext.ClipRectangle,
    }

    browsingContext.ImageFormat = {
    type: text,
    ? quality: 0.0..1.0,
    }

    browsingContext.ClipRectangle = (
    browsingContext.BoxClipRectangle /
    browsingContext.ElementClipRectangle
    )

    browsingContext.ElementClipRectangle = {
    type: "element",
    element: script.SharedReference
    }

    browsingContext.BoxClipRectangle = {
    type: "box",
    x: float,
    y: float,
    width: float,
    height: float
    }
    
戻り値型
browsingContext.CaptureScreenshotResult = {
    data: text
    }
    
rect が与えられたとき、 normalize rect するには:

注: これは、結果の rect が正の width dimension および height dimension を持つことを保証する。

  1. xrectx coordinate とする。

  2. yrecty coordinate とする。

  3. widthrectwidth dimension とする。

  4. heightrectheight dimension とする。

  5. width が 0 未満である場合、xx + width に設定し、 その後 width を -width に設定する。

  6. height が 0 未満である場合、yy + height に設定し、 その後 height を -height に設定する。

  7. x coordinate xy coordinate ywidth dimension width および height dimension height を持つ新しい DOMRectReadOnly を返す。

rect1 および rect2 が与えられたとき、 rectangle intersection するには
  1. rect1 を、rect1normalize rect したものとする。

  2. rect2 を、rect2normalize rect したものとする。

  3. x1_0rect1x coordinate とする。

  4. x2_0rect2x coordinate とする。

  5. x1_1 を、rect1x coordinaterect1width dimension を加えたものとする。

  6. x2_1 を、rect2x coordinaterect2width dimension を加えたものとする。

  7. x_0 を «x1_0, x2_0» の最大要素とする。

  8. x_1 を «x1_1, x2_1» の最小要素とする。

  9. y1_0rect1y coordinate とする。

  10. y2_0rect2y coordinate とする。

  11. y1_1 を、rect1y coordinaterect1height dimension を加えたものとする。

  12. y2_1 を、rect2y coordinaterect2height dimension を加えたものとする。

  13. y_0 を «y1_0, y2_0» の最大要素とする。

  14. y_1 を «y1_1, y2_1» の最小要素とする。

  15. x_1x_0 未満である場合、width を 0 とする。そうでなければ widthx_1 - x_0 とする。

  16. y_1y_0 未満である場合、height を 0 とする。そうでなければ heighty_1 - y_0 とする。

  17. x coordinate x_0y coordinate y_0width dimension width および height dimension height を持つ新しい DOMRectReadOnly を返す。

document および rect が与えられたとき、 render document to a canvas するには:
  1. ratio を、documentdefault view が与えられたものとして determine the device pixel ratio したものとする。

  2. paint width を、rectwidth dimensionratio を掛け、 最も近い整数に丸めたものとする。これにより device pixels における rect の幅と一致する。

  3. paint height を、rectheight dimensionratio を掛け、 最も近い整数に丸めたものとする。これにより device pixels における rect の高さと一致する。

  4. canvas を、width paint width および height paint height を持つ新しい HTMLCanvasElement とする。

  5. canvas context を、canvas および null で 2D context creation algorithm を実行した結果とする。

  6. canvascontext mode2D に設定する。

  7. rect により覆われる document の領域を表す framebuffer の領域を canvas context に描画することと等価な、実装固有のステップを完了する。 その際、framebuffer 内の各 pixel は canvas context 内の pixel に対応し、viewport coordinates における (rectx coordinate, recty coordinate) が canvas context 内の (0,0) に対応し、(rectx coordinate + rectwidth dimension, recty coordinate + rectheight dimension) が (paint width, paint height) に対応するようにする。

  8. canvas を返す。

canvas および format が与えられたとき、 encode a canvas as Base64 するには:
  1. format が null でない場合、typeformattype フィールドとし、qualityformatquality フィールドとする。

  2. そうでなければ、type を "image/png" とし、qualityundefined とする。

  3. file を、type および quality を伴う canvasa serialization of the bitmap as a file とする。

  4. encoded stringfileforgiving-base64 encode とする。

  5. data encoded string とともに success を返す。

document および origin が与えられたとき、 get the origin rectangle するには:
  1. origin"viewport" である場合:

    1. viewportdocumentvisual viewport とする。

    2. viewport rect を、 x coordinate viewportpage lefty coordinate viewportpage topwidth dimension viewport width、および height dimension viewport height を持つ DOMRectReadOnly とする。

    3. data viewport rect とともに success を返す。

  2. Assert: origin"document" である。

  3. document elementdocumentdocument element とする。

  4. document rect を、x coordinate 0、y coordinate 0、width dimension document elementscroll height、 および height dimension document elementscroll width を持つ DOMRectReadOnly とする。

  5. data document rect とともに success を返す。

session および command parameters を伴う remote end steps は次である:

  1. navigable id を、 command parameterscontext フィールドが存在する場合はその値とし、 そうでなければ null とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. 実装が何らかの理由で navigable の screenshot をキャプチャできない場合、 unsupported operationerror code を持つ error を返す。

  4. documentnavigableactive document とする。

  5. document について、次に run the animation frame callbacks algorithm が 呼び出された直後:

    これは update rendering algorithm に、より明示的な方法で統合されるべきである。

  6. origin を、command parameterscontext フィールドが存在する場合はその値とし、そうでなければ "viewport" とする。

  7. origin rect を、origin および document が与えられたものとして get the origin rectangle することを試みた結果とする。

  8. clip rectorigin rect とする。

  9. command parameters が "clip" を含む場合:

    1. clipcommand parameters["clip"] とする。

    2. 最初に一致する条件の下のステップを実行する:

      clipbrowsingContext.ElementClipRectangle 生成規則に一致する:
      1. environment settings を、その relevant global objectassociated Documentdocument である environment settings object とする。

      2. realm を、environment settingsrealm execution context の Realm component とする。

      3. element を、clip["element"]、 realm および sessiondeserialize remote reference することを試みた結果とする。

      4. elementElement を実装していない場合、no such elementerror code を持つ error を返す。

      5. elementnode documentdocument でない場合、no such elementerror code を持つ error を返す。

      6. viewport rect を、"viewport" および document が 与えられたものとして get the origin rectangle したものとする。

      7. element rect を、 element について get the bounding box したものとする。

      8. clip rect を、 x coordinate element rect["x"] + viewport rect["x"]、 y coordinate element rect["y"] + viewport rect["y"]、width element rect["width"], および height element rect["height"] を持つ DOMRectReadOnly とする。

      clipbrowsingContext.BoxClipRectangle 生成規則に一致する:
      1. clip x を、clip["x"] に origin rectx coordinate を加えたものとする。

      2. clip y を、clip["y"] に origin recty coordinate を加えたものとする。

      3. clip rect を、 x coordinate clip xy coordinate clip y、width clip["width"]、および height clip["height"] を持つ DOMRectReadOnly とする。

  10. 注: すべての座標はここで文書の原点から測定される。

  11. rectorigin rectclip rectrectangle intersection とする。

  12. rectwidth dimension が 0 である、または rectheight dimension が 0 である場合、 error code unable to capture screen を持つ error を返す。

  13. canvas を、document および rectrender document to a canvas したものとする。

  14. formatcommand parametersformat フィールドとする。

  15. encoding result を、canvas および formatencode a canvas as Base64 することを試みた結果とする。

  16. body を、 browsingContext.CaptureScreenshotResult 生成規則に一致する map とし、 data フィールドを encoding result に設定したものとする。

  17. data body とともに success を返す。

7.3.3.3. browsingContext.close コマンド

browsingContext.close コマンドは top-level traversable を閉じる。

コマンド型
browsingContext.Close = (
    method: "browsingContext.close",
    params: browsingContext.CloseParameters
    )

    browsingContext.CloseParameters = {
    context: browsingContext.BrowsingContext,
    ? promptUnload: bool .default false
    }
    
戻り値型
browsingContext.CloseResult = EmptyResult
    
command parameters を伴う remote end steps は次である:
  1. navigable idcommand parameterscontext フィールドの値とする。

  2. prompt unloadcommand parameterspromptUnload フィールドの値とする。

  3. navigable を、navigable idget a navigable することを試みた結果とする。

  4. Assert: navigable は null でない。

  5. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

  6. prompt unload が true である場合:

    1. navigable閉じる

  7. そうでなければ:

    1. Close navigable without prompting to unload.

  8. data null とともに success を返す。

最後の top-level traversable を閉じるときの挙動について、 未解決の議論がある。ブラウザーを閉じること、セッションを閉じること、またはこれを実装に委ねることが 期待され得る。[w3c/webdriver-bidi Issue #170]

7.3.3.4. browsingContext.create コマンド

browsingContext.create コマンドは、新しい navigable を、新しいタブまたは新しいウィンドウのいずれかに作成し、その navigable id を返す。

コマンド型
browsingContext.Create = (
    method: "browsingContext.create",
    params: browsingContext.CreateParameters
    )

    browsingContext.CreateType = "tab" / "window"

    browsingContext.CreateParameters = {
    type: browsingContext.CreateType,
    ? referenceContext: browsingContext.BrowsingContext,
    ? background: bool .default false,
    ? userContext: browser.UserContext
    }
    
戻り値型
browsingContext.CreateResult = {
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext
    }
    
command parameters を伴う remote end steps は次である:
  1. typecommand parameterstype フィールドの値とする。

  2. reference navigable id を、command parametersreferenceContext フィールドが存在する場合はその値とし、そうでなければ null とする。

  3. reference navigable id が null でない場合、reference navigablereference navigable idget a navigable することを試みた結果とする。そうでなければ reference navigable を null とする。

  4. reference navigable が null でなく、かつ top-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

  5. 実装が何らかの理由で新しい top-level traversable を作成できない場合、 unsupported operationerror code を持つ error を返す。

  6. reference navigable が null である場合、user contextdefault user context とし、 そうでなければ reference navigableassociated user context とする。

  7. user context id を、 command parametersuserContext フィールドが存在する場合はその値とし、 そうでなければ null とする。

  8. user context id が null でない場合、user contextuser context idget user context することを試みた結果に設定する。

  9. user context が null である場合、no such user contexterror code を持つ error を返す。

  10. 実装が何らかの理由で associated user context user context を持つ新しい top-level traversable を作成できない場合、 unsupported operationerror code を持つ error を返す。

  11. traversable を、null および空文字列で create a new top-level traversable steps を試み、 新しく作成された top-level traversableassociated user contextuser context に設定した結果とする。 新しい top-level traversable がどの OS window に作成されるかは、 type および reference navigable に依存する:

    • type が "tab" であり、実装が同じ OS window 内の複数の top-level traversables をサポートする場合:

      • 新しい top-level traversable は、存在するなら 既存の OS window を再利用するべきである。

      • reference navigable が null でない場合、新しい top-level traversable は、存在するなら reference navigable を含む window を再利用するべきである。 OS window 内の top-level traversables が明確な順序を持つ場合、 新しい top-level traversable は、その順序において reference navigabletop-level traversable の直後に置かれるべきである。

    • type が "window" であり、実装が別々の OS windows 内の複数の top-level traversable をサポートする場合、作成された top-level traversable は新しい OS window 内にあるべきである。

    • そうでなければ、top-level traversable がユーザーにどのように提示されるかの詳細は 実装定義である。

  12. command parametersbackground フィールドの値が false である場合:

    1. activate result を、新しく作成された navigableactivate a navigable した結果とする。

    2. activate resulterror である場合、 activate result を返す。

    注: background が true である場合、 作成された navigable について focusing steps を呼び出さない。

  13. body を、browsingContext.CreateResult 生成規則に一致する map とし、context フィールドを traversablenavigable id に、 userContext property を traversableassociated user contextuser context id に設定したものとする。

  14. data body とともに success を返す。

7.3.3.5. browsingContext.getTree コマンド

browsingContext.getTree コマンドは、指定された親自身を含む すべての子孫 navigables の tree、または親が提供されない場合はすべての top-level contexts を返す。

コマンド型
browsingContext.GetTree = (
    method: "browsingContext.getTree",
    params: browsingContext.GetTreeParameters
    )

    browsingContext.GetTreeParameters = {
    ? maxDepth: js-uint,
    ? root: browsingContext.BrowsingContext,
    }
    
戻り値型
browsingContext.GetTreeResult = {
    contexts: browsingContext.InfoList
    }
    
session および command parameters を伴う remote end steps は次である:
  1. root id を、command parametersroot フィールドが存在する場合は その値とし、そうでなければ null とする。

  2. max depth を、command parametersmaxDepth フィールドが存在する場合はその値とし、そうでなければ null とする。

  3. navigables を空の list とする。

  4. root id が null でない場合、 root id が与えられたものとして get a navigable することを試みた結果を navigables に追加する。 そうでなければ、すべての top-level traversablesnavigables に追加する。

  5. navigables infos を空の list とする。

  6. navigables の各 navigable について:

    1. info を、 navigablemax depth、および true が与えられたものとして get the navigable info した結果とする。

    2. infonavigables infos に追加する

  7. body を、browsingContext.GetTreeResult 生成規則に一致する map とし、contexts フィールドを navigables infos に設定したものとする。

  8. data body とともに success を返す。

7.3.3.6. browsingContext.handleUserPrompt コマンド

browsingContext.handleUserPrompt コマンドは、開いている prompt を閉じられるようにする

コマンド型
browsingContext.HandleUserPrompt = (
    method: "browsingContext.handleUserPrompt",
    params: browsingContext.HandleUserPromptParameters
    )

    browsingContext.HandleUserPromptParameters = {
    context: browsingContext.BrowsingContext,
    ? accept: bool,
    ? userText: text,
    }
    
戻り値型
browsingContext.HandleUserPromptResult = EmptyResult
    

session および command parameters を伴う remote end steps は次である:

  1. navigable idcommand parameterscontext フィールドの値とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. accept を、 command parametersaccept フィールドが存在する場合はその値とし、 そうでなければ true とする。

  4. userText を、 command parametersuserText フィールドが存在する場合はその値とし、 そうでなければ空文字列とする。

  5. navigable が現在、alert の呼び出しによる simple dialog を表示している場合、 prompt を acknowledge する。

    そうでなく、navigable が現在 confirm の呼び出しによる simple dialog を表示している場合、 accept が true なら肯定的に応答し、 accept が false なら否定的に応答する。

    そうでなく、navigable が現在 prompt の呼び出しによる simple dialog を表示している場合、 accept が true なら文字列値 userText で応答し、accept が false なら中止する。

    そうでなく、navigable が現在 prompt to unload steps の一部として prompt を表示している場合、 accept が true なら navigation を確認し、そうでなければ navigation を拒否する。

    そうでなければ、no such alerterror code を持つ error を返す。

  6. data null とともに success を返す。

7.3.3.7. browsingContext.locateNodes コマンド

browsingContext.locateNodes コマンドは、指定された locator に一致するすべての nodes のリストを返す。

コマンド型
browsingContext.LocateNodes = (
    method: "browsingContext.locateNodes",
    params: browsingContext.LocateNodesParameters
    )

    browsingContext.LocateNodesParameters = {
    context: browsingContext.BrowsingContext,
    locator: browsingContext.Locator,
    ? maxNodeCount: (js-uint .ge 1),
    ? serializationOptions: script.SerializationOptions,
    ? startNodes: [ + script.SharedReference ]
    }
    
戻り値型
browsingContext.LocateNodesResult = {
        nodes: [ * script.NodeRemoteValue ]
    }
    
与えられた navigablecontext nodesselectormaximum returned node count、および sessionlocate nodes using CSS するには:
  1. returned nodes を空の list とする。

  2. parse result を、selector が与えられたものとして parse a selector した結果とする。

  3. parse result が failure である場合、invalid selectorerror code を持つ error を返す。

  4. context nodes の各 context node について:

    1. elements を、 parse result および navigableactive documentroot を用い、 scoping root context node を用いて match a selector against a tree した結果とする。

    2. elements 内の各 element について:

      1. elementreturned nodes追加する

      2. maximum returned node count が null でなく、かつ returned nodessizemaximum returned node count に等しい場合、 data returned nodes とともに success を返す。

  5. data returned nodes とともに success を返す。

navigable が与えられたとき、 locate the container element するには:
  1. returned nodes を空の list とする。

  2. navigablecontainer が null でない場合、 navigablecontainerreturned nodes に追加する。

  3. returned nodes を返す。

与えられた navigablecontext nodesselector、および maximum returned node countlocate nodes using XPath するには:

注: XPath 仕様が保守されていない状態であるため、 このアルゴリズムは XPath DOM APIs への呼び出しを行うかのように記述されている。 しかしこれは、ECMAScript runtime を経由せずに、基礎となるアルゴリズムへ直接アクセスする 仕様内部の呼び出しと等価であると理解されるべきである。

  1. returned nodes を空の list とする。

  2. context nodes の各 context node について:

    1. evaluate result を、navigableactive document 上で、引数 selectorcontext node、null、 ORDERED_NODE_SNAPSHOT_TYPE、 および null を用いて evaluate を呼び出した結果とする。 これが "SyntaxError" DOMException を投げる場合、 invalid selectorerror code を持つ error を返す; そうでなく、これが他の例外を投げる場合、unknown errorerror code を持つ error を返す。

    2. index を 0 とする。

    3. length を、evaluate result から snapshotLength プロパティを 取得した結果とする。

    4. indexlength 未満である間、繰り返す:

      1. node を、evaluate result を this とし、index を引数として snapshotItem を呼び出した結果とする。

      2. nodereturned nodes追加する

      3. maximum returned node count が null でなく、かつ returned nodessizemaximum returned node count に等しい場合、 data returned nodes とともに success を返す。

      4. indexindex + 1 に設定する。

  3. data returned nodes とともに success を返す。

与えられた context nodesselectormax depthmatch typeignore case、および maximum returned node countlocate nodes using inner text するには:
  1. selector が空文字列である場合、 invalid selectorerror code を持つ error を返す。

  2. returned nodes を空の list とする。

  3. ignore case が false である場合、search textselector とする。そうでなければ、 search text を、Unicode Default Case Conversion algorithm に従って、 selectortoUppercase した結果とする。

  4. context nodes 内の各 context node について:

    1. context nodeDocument または DocumentFragment を実装している場合:

      注: document または document fragment をたどるとき、documentdocument.documentElement で検索結果が等価になるように、 max depth は意図的に減らされない。

      1. child nodes を空の list とする。

      2. context nodechildren 内の各 node child について。

        1. childchild nodes追加する

      3. child nodesselectormax depthmatch typeignore case、および maximum returned node countlocate nodes using inner text することを試みた結果で returned nodes拡張する

    2. context nodeHTMLElement を実装していない場合、continue する。

    3. node inner text を、 context nodethis 値として innerText getter steps を呼び出した結果とする。

    4. ignore case が false である場合、node textnode inner text とする。そうでなければ、 node text を、Unicode Default Case Conversion algorithm に従って、 node inner texttoUppercase した結果とする。

    5. search textnode textcode point substring である場合、 次のステップを実行する:

      1. child nodes を空の list とし、 context nodechildren 内の各 node child について:

        1. childchild nodes追加する

      2. child nodessize が 0 に等しい、または max depth が 0 に等しい場合、 次のステップを実行する:

        1. match type"full" であり、node textsearch text である場合、 context nodereturned nodes追加する

        2. そうでなく、match type"partial" である場合、 context nodereturned nodes追加する

      3. そうでなければ、次のステップを実行する:

        1. max depth が null である場合、child max depth を null とし、 そうでなければ max depth - 1 とする。

        2. child node matches を、 child nodesselectorchild max depthmatch typeignore case、および maximum returned node countlocate nodes using inner text した結果とする。

        3. child node matchessize が 0 に等しく、かつ match type"partial" である場合、context nodereturned nodes に追加する。そうでなければ、 child node matchesreturned nodes拡張する

  5. maximum returned node count が null でない場合、returned nodes 内で index が maximum returned node count 以上であるすべての entries を削除する

  6. data returned nodes とともに success を返す。

与えられた context nodesselectormaximum returned node count、および returned nodescollect nodes using accessibility attributes するには:
  1. returned nodes が null である場合:

    1. returned nodes を空の list に設定する。

  2. context nodes 内の各 context node について:

    1. match を true とする。

    2. context nodeElement を実装している場合:

      1. selector が "role" を含む場合:

        1. rolecontext nodecomputed role とする。

        2. selector["role"] が role でない場合:

          1. match を false に設定する。

      2. selector が "name" を含む場合:

        1. namecontext nodeaccessible name とする。

        2. selector["name"] が name でない場合:

          1. match を false に設定する。

    3. そうでなければ、match を false に設定する。

    4. match が true である場合:

      1. maximum returned node count が null でなく、かつ returned nodessizemaximum returned node count に等しい場合、 break する。

      2. context nodereturned nodes追加する

    5. child nodes を空の list とし、 context nodechildren 内の各 node child について:

      1. childElement を実装している場合、 childchild nodes追加する

    6. child nodesselectormaximum returned node count、および returned nodescollect nodes using accessibility attributes することを試みる

  3. returned nodes を返す。

与えられた context nodesselector、および maximum returned node countlocate nodes using accessibility attributes するには:
  1. selector が "role" を含まず、 かつ selector が "name" を含まない場合、 invalid selectorerror code を持つ error を返す。

  2. context nodesselectormaximum returned node count、および null で collect nodes using accessibility attributes した結果を返す。

session および command parameters を伴う remote end steps は次である:
  1. navigable idcommand parameters["context"] とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. Assert: navigable は null でない。

  4. realm を、 navigablenavigable id および null で get a realm from a navigable することを試みた結果とする。

  5. locatorcommand parameters["locator"] とする。

  6. command parameters が "startNodes" を含む場合、 start nodes parametercommand parameters["startNodes"] とする。 そうでなければ、start nodes parameter を null とする。

  7. command parameters が "maxNodeCount" を含む場合、 maximum returned node countcommand parameters["maxNodeCount"] とする。 そうでなければ、maximum returned node count を null とする。

  8. context nodes を空の list とする。

  9. start nodes parameter が null である場合、navigableactive documentcontext nodes追加する。 そうでなければ、start nodes parameter 内の各 serialized start node について:

    1. start node を、 serialized start noderealm、および session が与えられたものとして deserialize shared reference することを試みた結果とする。

    2. start nodecontext nodes追加する

  10. context nodessize が 0 より大きいことを Assert する。

  11. typelocator["type"] とする。

  12. 次の条件と関連するステップのリストにおいて、関連する条件が true である最初の ステップセットを実行する:

    type が文字列 "css" である
    1. selectorlocator["value"] とする。

    2. result nodes を、navigablecontext nodesselector、および maximum returned nodes が与えられたものとして locate nodes using css することを試みた結果とする。

    type が文字列 "xpath" である
    1. selectorlocator["value"] とする。

    2. result nodes を、navigablecontext nodesselector、および maximum returned nodes が与えられたものとして locate nodes using xpath することを試みた結果とする。

    type が文字列 "innerText" である
    1. selectorlocator["value"] とする。

    2. locatormaxDepth含む場合、max depthlocator["maxDepth"] とする。そうでなければ、max depth を null とする。

    3. locatorignoreCase含む場合、 ignore caselocator["ignoreCase"] とする。そうでなければ、ignore case を false とする。

    4. locatormatchType含む場合、 match typelocator["matchType"] とする。そうでなければ、match type を "full" とする。

    5. result nodes を、 context nodesselectormax depthmatch typeignore case および maximum returned node count が与えられたものとして locate nodes using inner text することを試みた結果とする。

    type が文字列 "accessibility" である
    1. selectorlocator["value"] とする。

    2. result nodes を、 context nodesselector、および maximum returned node count が与えられたものとして locate nodes using accessibility attributes したものとする。

    type が文字列 "context" である
    1. start nodes parameter が null でない場合、 error code "invalid argument" を持つ error を返す。

    2. selectorlocator["value"] とする。

    3. context idselector["context"] とする。

    4. child navigable を、 context idget a navigable することを試みた結果とする。

    5. child navigableparentnavigable でない場合、 error code "invalid argument" を持つ error を返す。

    6. result nodes を、child navigable が与えられたものとして locate the container element したものとする。

    7. Assert: result nodes 内の各 node について、 nodenode navigablenavigable である。

  13. Assert: maximum returned node count は null である、または result nodessizemaximum returned node count 以下である。

  14. command parameters が "serializationOptions" を含む場合、 serialization optionscommand parameters["serializationOptions"] とする。 そうでなければ、serialization options を、 フィールドを既定値に設定した script.SerializationOptions 生成規則に一致する map とする。

  15. result ownership を "none" とする。

  16. serialized nodes を空の list とする。

  17. result nodes 内の各 result node について:

    1. serialized node を、 result nodeserialization optionsresult ownership、 serialization internal map としての新しい maprealm および sessionserialize as a remote value した結果とする。

    2. serialized nodeserialized nodes追加する

  18. result を、 browsingContext.LocateNodesResult 生成規則に一致する map とし、nodes フィールドを serialized nodes に設定したものとする。

  19. data result とともに success を返す。

7.3.3.8. browsingContext.navigate コマンド

browsingContext.navigate コマンドは、 navigable を指定された URL へナビゲートする。

コマンド型
browsingContext.Navigate = (
    method: "browsingContext.navigate",
    params: browsingContext.NavigateParameters
    )

    browsingContext.NavigateParameters = {
    context: browsingContext.BrowsingContext,
    url: text,
    ? wait: browsingContext.ReadinessState,
    }
    
戻り値型
browsingContext.NavigateResult = {
    navigation: browsingContext.Navigation / null,
    url: text,
    }
    
session および command parameters を伴う remote end steps は次である:
  1. navigable idcommand parameterscontext フィールドの値とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. Assert: navigable は null でない。

  4. wait condition を "committed" とする。

  5. command parameterswait含み、 かつ command parameters[wait] が "none" でない場合、 wait conditioncommand parameters[wait] に設定する。

  6. urlcommand parametersurl フィールドの値とする。

  7. documentnavigableactive document とする。

  8. basedocumentbase URL とする。

  9. url record を、base URL baseurlURL parser を適用した結果とする。

  10. url record が failure である場合、invalid argumenterror code を持つ error を返す。

  11. request を、URL が url record である新しい request とする。

  12. navigablerequest および wait conditionawait a navigation した結果を返す。

7.3.3.9. browsingContext.print コマンド

browsingContext.print コマンドは、 document のページ分割された表現を作成し、それを Base64 エンコードされた文字列として表される PDF document として返す。

コマンド型
browsingContext.Print = (
    method: "browsingContext.print",
    params: browsingContext.PrintParameters
    )

    browsingContext.PrintParameters = {
    context: browsingContext.BrowsingContext,
    ? background: bool .default false,
    ? margin: browsingContext.PrintMarginParameters,
    ? orientation: ("portrait" / "landscape") .default "portrait",
    ? page: browsingContext.PrintPageParameters,
    ? pageRanges: [*(js-uint / text)],
    ? scale: (0.1..2.0) .default 1.0,
    ? shrinkToFit: bool .default true,
    }

    browsingContext.PrintMarginParameters = {
    ? bottom: (float .ge 0.0) .default 1.0,
    ? left: (float .ge 0.0) .default 1.0,
    ? right: (float .ge 0.0) .default 1.0,
    ? top: (float .ge 0.0) .default 1.0,
    }

    ; Minimum size is 1pt x 1pt. Conversion follows from
    ; https://www.w3.org/TR/css3-values/#absolute-lengths
    browsingContext.PrintPageParameters = {
    ? height: (float .ge 0.0352) .default 27.94,
    ? width: (float .ge 0.0352) .default 21.59,
    }
    
戻り値型
browsingContext.PrintResult = {
    data: text
    }
    

session および command parameters を伴う remote end steps は次である:

  1. navigable idcommand parameterscontext フィールドの値とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. 実装が何らかの理由で navigable のページ分割された表現を提供できない場合、 unsupported operationerror code を持つ error を返す。

  4. margin を、command parametersmargin フィールドが存在する場合は その値とし、そうでなければフィールドを既定値に設定した browsingContext.PrintMarginParameters に一致する map とする。

  5. page size を、command parameterspage フィールドが存在する場合はその値とし、 そうでなければフィールドを既定値に設定した browsingContext.PrintPageParameters に一致する map とする。

注: 最小ページサイズは 1 ポイントであり、 absolute lengths に従うと (2.54 / 72) cm である。

  1. page ranges を、command parameterspageRanges フィールドが存在する場合は その値とし、そうでなければ空の list とする。

  2. documentnavigableactive document とする。

  3. document について、次に run the animation frame callbacks algorithm が呼び出された直後:

    これは update rendering algorithm に、より明示的な方法で統合されるべきである。

    1. pdf data を、 document のページ分割された表現を生成する UA 固有のステップを取り、 CSS media typeprint に設定し、 PDF としてエンコードし、次の用紙設定を用いた結果とする:

      プロパティ
      cm 単位の幅 command parameters["orientation"] が "portrait" である場合は page size["width"]、 そうでなければ page size["height"]
      cm 単位の高さ command parameters["orientation"] が "portrait" である場合は page size["height"]、 そうでなければ page size["width"]
      上マージン、cm 単位 margin["top"]
      下マージン、cm 単位 margin["bottom"]
      左マージン、cm 単位 margin["left"]
      右マージン、cm 単位 margin["right"]

      さらに、次の formatting hints が UA によって適用されるべきである:

      command parameters["scale"] が 1 に等しくない場合:
      content のサイズを係数 command parameters["scale"] で拡大縮小する
      command parameters["background"] が false である場合:
      背景画像の出力を抑制する
      command parameters["shrinkToFit"] が true である場合:
      content 内で指定された任意の page width を上書きし、content を page width に合わせて リサイズする
    2. page rangesでない場合、 pages を、page ranges および pdf data に含まれるページ数で parse a page range することを 試みた結果とし、 one-based index が pages に含まれない任意のページを pdf data から削除する。

    3. encoding result を、pdf data に対して Base64 Encode を呼び出した結果とする。

    4. encoded dataencoding result の data とする。

    5. body を、 browsingContext.PrintResult 生成規則に一致する map とし、data フィールドを encoded data に設定したものとする。

    6. data body とともに success を返す。

7.3.3.10. browsingContext.reload コマンド

browsingContext.reload コマンドは navigable を再読み込みする。

コマンド型
browsingContext.Reload = (
    method: "browsingContext.reload",
    params: browsingContext.ReloadParameters
    )

    browsingContext.ReloadParameters = {
    context: browsingContext.BrowsingContext,
    ? ignoreCache: bool,
    ? wait: browsingContext.ReadinessState,
    }
    
戻り値型
browsingContext.ReloadResult = browsingContext.NavigateResult
    
command parameters を伴う remote end steps は次である:
  1. navigable idcommand parameterscontext フィールドの値とする。

  2. navigable を、navigable idget a navigable することを試みた結果とする。

  3. Assert: navigable は null でない。

  4. ignore cache を、command parametersignoreCache フィールドが存在する場合はその値とし、 そうでなければ false とする。

  5. wait condition を "committed" とする。

  6. command parameterswait含み、 かつ command parameters[wait] が "none" でない場合、 wait conditioncommand parameters[wait] に設定する。

  7. documentnavigableactive document とする。

  8. urldocumentURL とする。

  9. request を、URL が url である新しい request とする。

  10. navigablerequestwait condition、history handling "reload"、および ignore cache ignore cacheawait a navigation した結果を返す。

7.3.3.11. browsingContext.setBypassCSP コマンド

browsingContext.setBypassCSP コマンドは、 Content Security Policy の適用をバイパスできるようにする。

注: CSP bypass が有効である場合、 eval()、new Function()、inline scripts、および resource loading を通常ブロックするものを含め、 すべての CSP directives がバイパスされる。

コマンド型
browsingContext.SetBypassCSP = (
    method: "browsingContext.setBypassCSP",
    params: browsingContext.SetBypassCSPParameters
    )

    browsingContext.SetBypassCSPParameters = {
    bypass: true / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
browsingContext.SetBypassCSPResult = EmptyResult
    

remote endbypass CSP configuration を持ち、これは associated type boolean を持つ WebDriver configuration である。

navigable navigable が与えられたとき、 WebDriver BiDi CSP is bypassed steps は次である:

  1. top-level traversablenavigabletop-level traversable とする。

  2. bypass CSP enabled を、top-level traversable についての bypass CSP configurationget WebDriver configuration value の結果とする。

  3. Assert: bypass CSP enabledtrue または unset である。

  4. bypass CSP enabledunset である場合、false を返す。

  5. true を返す。

command parameters が与えられたときの remote end steps は次である:

  1. bypasscommand parameters["bypass"] とする。

  2. bypass が null である場合、bypassunset に設定する。

  3. command parameters について、 bypass CSP configuration bypassstore WebDriver configuration することを試みる

  4. data null とともに success を返す。

7.3.3.12. browsingContext.setViewport コマンド

browsingContext.setViewport コマンドは、指定された top-level traversable 上の特定の viewport 特性(例: viewport width および viewport height)を変更する。

コマンド型
browsingContext.SetViewport = (
    method: "browsingContext.setViewport",
    params: browsingContext.SetViewportParameters
    )

    browsingContext.SetViewportParameters = {
    ? context: browsingContext.BrowsingContext,
    ? viewport: browsingContext.Viewport / null,
    ? devicePixelRatio: (float .gt 0.0) / null,
    ? userContexts: [+browser.UserContext],
    }

    browsingContext.Viewport = {
    width: js-uint,
    height: js-uint,
    }
    
戻り値型
browsingContext.SetViewportResult = EmptyResult
    
navigable および device pixel ratio が与えられたとき、 set device pixel ratio override するには:
  1. device pixel ratio が null でない場合:

    1. 指定された navigable に現在読み込まれている document について:

      1. select an image source from a source set steps が実行されるとき、画像を選択する際に 実装の pixel density が device pixel ratio に設定されたかのように振る舞う。

      2. resolution media feature の目的では、 実装の resolution が page zoom によってスケールされた device pixel ratio dppx であるかのように振る舞う。

    2. device pixel ratio overrides[navigable] を device pixel ratio設定する

      注: これは § 8.3.1 Determine the device pixel ratio のパッチにより効果を持つ。

  2. そうでなければ:

    1. 指定された navigable に現在読み込まれている document について:

      1. select an image source from a source set steps が実行されるとき、 これらのステップの以前の呼び出しによって行われた変更なしに、 実装の既定の挙動を使用する。

      2. resolution media feature の目的では、 これらのステップの以前の呼び出しによって行われた変更なしに、 実装の既定の挙動を使用する。

    2. device pixel ratio overrides から navigable削除する

  3. 指定された navigable に現在読み込まれている document について evaluate media queries and report changes を実行する。

navigable navigable および viewport viewport が与えられたとき、 set viewport するには:
  1. viewport が null でない場合、navigablelayout viewport の width を CSS pixels における viewportwidth に設定し、 navigablelayout viewport の height を CSS pixels における viewportheight に設定する。

  2. そうでなければ、navigablelayout viewport を 実装定義の既定値に設定する。

新しい navigable navigable に document を作成した後、かつ run WebDriver BiDi preload scripts algorithm が 呼び出される前:

TODO: 代わりに html spec の hook として移動する。

  1. user contextnavigableassociated user context とする。

  2. navigabletop-level traversable である場合:

    1. navigable について Update geolocation override する。

    2. navigable について Update emulated forced colors theme する。

    3. screen orientation overrides mapuser context含む場合、 navigable および screen orientation overrides map[user context] で set emulated screen orientation する。

  3. viewport overrides mapuser context含む場合:

    1. navigabletop-level traversable であり、かつ viewport overrides map[user context] の viewport が null でない場合:

      1. navigable および viewport overrides map[user context] の viewportSet viewport する。

    2. viewport overrides map[user context] の devicePixelRatio が null でない場合:

      1. navigable および viewport overrides map[user context] の devicePixelRatioSet device pixel ratio override する。

  4. navigable について Update scrollbar type override する。

command parameters を伴う remote end steps は次である:

  1. 実装が何らかの理由で、指定された command parameters を用いて layout viewport parameters を調整できない場合、 unsupported operationerror code を持つ error を返す。

  2. command parameters が "userContexts" を含み、 かつ command parameters が "context" を含む場合、 invalid argumenterror code を持つ error を返す。

  3. navigablesset とする。

  4. command parameterscontext フィールドが存在する場合:

    1. navigable idcommand parameterscontext フィールドの値とする。

    2. navigable を、 navigable idget a navigable することを試みた結果とする。

    3. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

    4. navigablenavigables追加する

  5. そうでなく、command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. viewport overrides map[user context] を struct に設定する

      2. command parameters が "viewport" を含む場合:

        1. viewport overrides map[user context] の viewportcommand parameters["viewport"] に設定する。

      3. command parameters が "devicePixelRatio" を含む場合:

        1. viewport overrides map[user context] の devicePixelRatiocommand parameters["devicePixelRatio"] に設定する。

      4. For each user contextassociated user context である すべての top-level traversables のリストの 各 top-level traversable について:

        1. top-level traversablenavigables追加する

  6. そうでなければ、invalid argumenterror code を持つ error を返す。

  7. command parametersviewport フィールドを含む場合:

    1. viewportcommand parameters["viewport"] とする。

    2. navigables の各 navigable について:

      1. navigable および viewportSet viewport する。

      2. navigableactive documentCSSOM View § 13.1 Resizing viewports steps を実行する。

  8. command parametersdevicePixelRatio フィールドを含む場合:

    1. device pixel ratiocommand parameters["devicePixelRatio"] とする。

    2. navigables の各 navigable について:

      1. navigable およびすべての descendant navigables について:

        1. navigable および device pixel ratioSet device pixel ratio override する。

  9. data null とともに success を返す。

7.3.3.13. browsingContext.traverseHistory コマンド

browsingContext.traverseHistory コマンドは、 指定された navigable の履歴を delta だけ走査する。

コマンド型
browsingContext.TraverseHistory = (
    method: "browsingContext.traverseHistory",
    params: browsingContext.TraverseHistoryParameters
    )

    browsingContext.TraverseHistoryParameters = {
    context: browsingContext.BrowsingContext,
    delta: js-int,
    }
    
戻り値型
browsingContext.TraverseHistoryResult = EmptyResult
    
command parameters を伴う remote end steps は次である:
  1. navigable を、command parameters["context"] で get a navigable することを試みた結果とする。

  2. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

  3. Assert: navigable は null でない。

  4. deltacommand parameters["delta"] とする。

  5. resume id を一意な文字列とする。

  6. navigablesession history traversal queue 上に Queue a task して、次のステップを実行する:

    1. all steps を、navigable について getting all used history steps した結果とする。

    2. current index を、all steps 内における navigablecurrent session history step の index とする。

    3. target indexcurrent indexdelta を加えたものとする。

    4. all steps[target index] が存在しない場合、 valid entry を false とし、そうでなければ true とする。

    5. "check history"、resume id、および valid entryResume する。

  7. is valid entry を、«"check history"» および resume idawait したものとする。

  8. is valid entry が false である場合、error code no such history entry を持つ error を返す。

  9. delta および navigable が与えられたものとして Traverse the history by a delta する。

    記述されている アルゴリズムには競合状態がある。なぜなら、ナビゲートを試みる時点で 対象の session history entry が存在しない可能性があるためである。 history のナビゲートを待機することをサポートすれば、これをより堅牢に扱える。

  10. TODO: history traversal の完了待機をサポートする。

  11. body を、 browsingContext.TraverseHistoryResult 生成規則に一致する map とする。

  12. data body とともに success を返す。

context および navigation status navigation status が与えられたとき、 WebDriver BiDi page show steps は次である:

`browsingContext.pageShow event を公開したいか?その場合、 これを bfcache restore の時だけでなく、`pageshow` が発火されようとするたびに呼び出す必要があり、 また persisted status を data に追加する必要がある。

  1. navigation idnavigation statusid とする。

  2. "page show"、navigation id、および navigation statusResume する。

context および navigation status navigation status が与えられたとき、 WebDriver BiDi pop state steps は次である:

  1. navigation idnavigation statusid とする。

  2. "pop state"、navigation id、および navigation statusResume する。

7.3.4. イベント

7.3.4.1. browsingContext.contextCreated イベント
イベント型
browsingContext.ContextCreated = (
    method: "browsingContext.contextCreated",
    params: browsingContext.Info
    )
    

session および navigable が与えられたとき、 Recursively emit context created events するには:

  1. session および navigableEmit a context created event する。

  2. navigable の各 child navigable child について:

    1. session および child が与えられたものとして Recursively emit context created events する。

session および navigable が与えられたとき、 Emit a context created event するには:

  1. params を、navigable、0、および true が与えられたものとして get the navigable info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.ContextCreated 生成規則に一致する map とする。

  3. session および bodyEmit an event する。

remote end event trigger は、 navigable navigable および navigable opener navigable が与えられたときの WebDriver BiDi navigable created steps である:

  1. opener navigable が提供されている場合、navigableoriginal openeropener navigable に設定する。

  2. navigable についての navigable cache behavior が "bypass" である場合、 navigable から発生する network requests について、実装固有の resource caches を無効にする実装定義のステップを実行する。

  3. related navigables を、navigable を含む set とする。

  4. "browsingContext.contextCreated" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および navigable が与えられたものとして Emit a context created event する。

sessionnavigables および include global が与えられたとき、 subscribe priority 1 を伴う remote end subscribe steps は次である:

  1. navigables 内の各 navigable について:

    1. session および navigable が与えられたものとして Recursively emit context created events する。

7.3.4.2. browsingContext.contextDestroyed イベント
イベント型
browsingContext.ContextDestroyed = (
    method: "browsingContext.contextDestroyed",
    params: browsingContext.Info
    )
    
remote end event trigger は次である:

remote end event trigger は、 navigable navigable が与えられたときの WebDriver BiDi navigable destroyed steps である:

  1. params を、navigable、null、および true が与えられたものとして get the navigable info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.ContextDestroyed 生成規則に一致する map とする。

  3. related navigables を、navigableparent が null でない場合はそれを含む set とし、そうでなければ空の set とする。

  4. "browsingContext.contextDestroyed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

    2. subscriptions to remove を空の set とする。

    3. sessionsubscriptions 内の各 subscription について:

      1. subscriptiontop-level traversable idsnavigablenavigable id含む場合:

        1. navigablenavigable idsubscriptiontop-level traversable ids から削除する

        2. subscriptiontop-level traversable ids が空である場合:

          1. subscriptionsubscriptions to remove追加する

    4. subscriptions to removesessionsubscriptions から削除する

このイベントを active documents を持つ browsing contexts に対してのみ発火すべきかは不明である。navigation によって、contexts が アクセス不能になるが、bfcache のためまだ破棄されないこともある。

7.3.4.3. browsingContext.navigationStarted イベント
イベント型
browsingContext.NavigationStarted = (
    method: "browsingContext.navigationStarted",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi navigation started steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.NavigationStarted 生成規則に一致する map とする。

  3. navigation idnavigation statusid とする。

  4. related navigablesnavigable を含む set とする。

  5. "navigation started"、navigation id、および navigation statusResume する。

  6. "browsingContext.navigationStarted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.4. browsingContext.fragmentNavigated イベント
イベント型
browsingContext.FragmentNavigated = (
    method: "browsingContext.fragmentNavigated",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi fragment navigated steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.FragmentNavigated 生成規則に一致する map とする。

  3. navigation idnavigation statusid とする。

  4. related navigable を、navigable を含む set とする。

  5. "fragment navigated"、navigation id、および navigation statusResume する。

  6. "browsingContext.fragmentNavigated" および related navigable が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.5. browsingContext.historyUpdated イベント
イベント型
browsingContext.HistoryUpdated = (
    method: "browsingContext.historyUpdated",
    params: browsingContext.HistoryUpdatedParameters
    )

    browsingContext.HistoryUpdatedParameters = {
    context: browsingContext.BrowsingContext,
    timestamp: js-uint,
    url: text,
    ? userContext: browser.UserContext
    }
    
remote end event trigger は、 navigable navigable が与えられたときの WebDriver BiDi history updated steps である:
  1. url を、 navigableactive browsing contextactive documentURL が与えられたものとして URL serializer を実行した結果とする。

  2. user context id を、navigableassociated user contextuser context id とする。

  3. timestamp を、UTC における現在の日付と時刻を表す time value とする。

  4. params を、browsingContext.HistoryUpdatedParameters 生成規則に一致する map とし、url フィールドを url に、 timestamp フィールドを timestamp に、 context フィールドを navigablenavigable id に、 userContext フィールドを user context id に設定したものとする。

  5. body を、 params フィールドを params に設定した、 browsingContext.HistoryUpdated 生成規則に一致する map とする。

  6. related browsing contexts を、 navigableactive browsing context を含む set とする。

  7. "browsingContext.historyUpdated" および related browsing contexts が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.6. browsingContext.domContentLoaded イベント
イベント型
browsingContext.DomContentLoaded = (
    method: "browsingContext.domContentLoaded",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi DOM content loaded steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.DomContentLoaded 生成規則に一致する map とする。

  3. related navigables を、navigable を含む set とする。

  4. navigation idnavigation statusid とする。

  5. "domContentLoaded"、navigation id、および navigation statusResume する。

  6. "browsingContext.domContentLoaded" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.7. browsingContext.load イベント
イベント型
browsingContext.Load = (
    method: "browsingContext.load",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi load complete steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、params フィールドを params に設定した、 browsingContext.Load 生成規則に一致する map とする。

  3. related navigables を、navigable を含む set とする。

  4. navigation idnavigation statusid とする。

  5. "load"、navigation id および navigation statusResume する。

  6. "browsingContext.load" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.8. browsingContext.downloadWillBegin イベント
イベント型
browsingContext.DownloadWillBegin = (
    method: "browsingContext.downloadWillBegin",
    params: browsingContext.DownloadWillBeginParams
    )

    browsingContext.DownloadWillBeginParams = {
    suggestedFilename: text,
    browsingContext.BaseNavigationInfo
    }
    
remote end event trigger は、 navigable navigable および navigation status navigation status が 与えられたときの WebDriver BiDi download will begin steps である:
  1. navigation info を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. params を、 browsingContext.DownloadWillBeginParams 生成規則に一致する map とし、context フィールドを navigation info["context"] に、 navigation フィールドを navigation info["navigation"] に、 timestamp フィールドを navigation info["timestamp"] に、url フィールドを navigation info["url"] に、そして suggestedFilename フィールドを navigation statussuggestedFilename に設定したものとする。

  3. body を、 params フィールドを params に設定した、 browsingContext.DownloadWillBegin 生成規則に一致する map とする。

  4. navigation idnavigation statusid とする。

  5. related navigables を、navigable を含む set とする。

  6. "download started"、navigation id、および navigation statusResume する。

  7. "browsingContext.downloadWillBegin" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

  8. download behavior を、navigableget download behavior したものとする。

  9. download behavior を返す。

7.3.4.9. browsingContext.downloadEnd イベント
イベント型
browsingContext.DownloadEnd = (
    method: "browsingContext.downloadEnd",
    params: browsingContext.DownloadEndParams
    )

    browsingContext.DownloadEndParams = {
    (
        browsingContext.DownloadCanceledParams //
        browsingContext.DownloadCompleteParams
    )
    }

    browsingContext.DownloadCanceledParams = (
    status: "canceled",
    browsingContext.BaseNavigationInfo
    )

    browsingContext.DownloadCompleteParams = (
    status: "complete",
    filepath: text / null,
    browsingContext.BaseNavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi download end steps である:
  1. navigation info を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. navigation info["status"] は "complete" または "canceled" のいずれかに等しいと Assert する。

  3. navigation info["status"] が "complete" である場合、 paramsbrowsingContext.DownloadCompleteParams 生成規則に一致する map とし、 filepath フィールドを navigation statusdownloadedFilepath に、 context フィールドを navigation info["context"] に、 navigation フィールドを navigation info["navigation"] に、 timestamp フィールドを navigation info["timestamp"] に、そして url フィールドを navigation info["url"] に設定したものとする。

    注: completed downloads において、 何らかの理由で filepath が利用できない場合、filepath は null になり得る。

  4. そうでなければ、paramsbrowsingContext.DownloadCanceledParams 生成規則に一致する map とし、context フィールドを navigation info["context"] に、 navigation フィールドを navigation info["navigation"] に、 timestamp フィールドを navigation info["timestamp"] に、そして url フィールドを navigation info["url"] に設定したものとする。

  5. body を、 params フィールドを params に設定した、 browsingContext.DownloadEnd 生成規則に一致する map とする。

  6. related navigables を、navigable を含む set とする。

  7. "browsingContext.downloadEnd" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.10. browsingContext.navigationAborted イベント
イベント型
browsingContext.NavigationAborted = (
    method: "browsingContext.navigationAborted",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi navigation aborted steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.NavigationAborted 生成規則に一致する map とする。

  3. navigation idnavigation statusid とする。

  4. related navigables を、navigable を含む set とする。

  5. "navigation aborted"、navigation id、および navigation statusResume する。

  6. "browsingContext.navigationAborted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.11. browsingContext.navigationCommitted イベント
イベント型
browsingContext.NavigationCommitted = (
    method: "browsingContext.navigationCommitted",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi navigation committed steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.NavigationCommitted 生成規則に一致する map とする。

  3. related navigables を、navigable を含む set とする。

  4. navigation idnavigation statusid とする。

  5. "navigation committed"、navigation id、および navigation statusResume する。

  6. "browsingContext.navigationCommitted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.12. browsingContext.navigationFailed イベント
イベント型
browsingContext.NavigationFailed = (
    method: "browsingContext.navigationFailed",
    params: browsingContext.NavigationInfo
    )
    
remote end event trigger は、 navigable navigable および navigation status navigation status が与えられたときの WebDriver BiDi navigation failed steps である:
  1. params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。

  2. body を、 params フィールドを params に設定した、 browsingContext.NavigationFailed 生成規則に一致する map とする。

  3. navigation idnavigation statusid とする。

  4. related navigables を、navigable を含む set とする。

  5. "navigation failed"、navigation id、および navigation statusResume する。

  6. "browsingContext.navigationFailed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.13. browsingContext.userPromptClosed イベント
イベント型
browsingContext.UserPromptClosed = (
    method: "browsingContext.userPromptClosed",
    params: browsingContext.UserPromptClosedParameters
    )

    browsingContext.UserPromptClosedParameters = {
    context: browsingContext.BrowsingContext,
    accepted: bool,
    type: browsingContext.UserPromptType,
    ? userContext: browser.UserContext,
    ? userText: text
    }
    
remote end event trigger は、 Window window、文字列 type、boolean accepted、および省略可能な text user text (既定値: null)が与えられたときの WebDriver BiDi user prompt closed steps である。
  1. navigablewindownavigable とする。

  2. navigable idnavigablenavigable id とする。

  3. user context id を、navigableassociated user contextuser context id とする。

  4. params を、 context フィールドを navigable id に、userContext フィールドを user context id に、accepted フィールドを accepted に、 type フィールドを type に設定し、かつ user text が null でなければ userText フィールドを user text に設定し、そうでなければ省略した、 browsingContext.UserPromptClosedParameters 生成規則に一致する map とする。

  5. body を、 params フィールドを params に設定した、 BrowsingContextUserPromptClosedEvent 生成規則に一致する map とする。

  6. related navigables を、navigable を含む set とする。

  7. "browsingContext.userPromptClosed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

7.3.4.14. browsingContext.userPromptOpened イベント
イベント型
browsingContext.UserPromptOpened = (
    method: "browsingContext.userPromptOpened",
    params: browsingContext.UserPromptOpenedParameters
    )

    browsingContext.UserPromptOpenedParameters = {
    context: browsingContext.BrowsingContext,
    handler: session.UserPromptHandlerType,
    message: text,
    type: browsingContext.UserPromptType,
    ? userContext: browser.UserContext,
    ? defaultValue: text
    }
    
type および navigable が与えられたとき、 get navigable’s user prompt handler するには:
  1. user contextnavigableassociated user context とする。

  2. unhandled prompt behavior overrides mapuser context含む場合:

    1. unhandled prompt behavior overrideunhandled prompt behavior overrides map[user context] とする。

    2. unhandled prompt behavior override[type] が null でない場合、 unhandled prompt behavior override[type] を返す。

    3. unhandled prompt behavior override["default"] が null でない場合、 unhandled prompt behavior override["default"] を返す。

  3. handler configuration を、typeget the prompt handler したものとする。

  4. handler configurationhandler を返す。

remote end event trigger は、 Window window、文字列 type、文字列 message、および省略可能な text default value (既定値: null)が与えられたときの WebDriver BiDi user prompt opened steps である。
  1. navigablewindownavigable とする。

  2. navigable idnavigablenavigable id とする。

  3. user context id を、navigableassociated user contextuser context id とする。

  4. handler を、type および navigableget navigable’s user prompt handler したものとする。

  5. params を、 context フィールドを navigable id に、userContext フィールドを user context id に、type フィールドを type に、 message フィールドを message に、defaultValue フィールドを default value が null でなければ default value に設定し、 そうでなければ省略し、 かつ handler フィールドを handler に設定した、 browsingContext.UserPromptOpenedParameters 生成規則に一致する map とする。

  6. body を、 params フィールドを params に設定した、 browsingContext.UserPromptOpened 生成規則に一致する map とする。

  7. related navigables を、navigable を含む set とする。

  8. "browsingContext.userPromptOpened" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

  9. handler が "ignore" である場合、handler を "none" に設定する。

  10. handler を返す。

7.4. emulation モジュール

emulation モジュールは、ブラウザー API のエミュレーションに関するコマンドおよびイベントを含む。

7.4.1. 定義

remote end definition

EmulationCommand = (
    emulation.SetForcedColorsModeThemeOverride //
    emulation.SetGeolocationOverride //
    emulation.SetLocaleOverride //
    emulation.SetNetworkConditions //
    emulation.SetScreenOrientationOverride //
    emulation.SetScreenSettingsOverride //
    emulation.SetScriptingEnabled //
    emulation.SetScrollbarTypeOverride //
    emulation.SetTimezoneOverride //
    emulation.SetTouchOverride //
    emulation.SetUserAgentOverride
    )

    
EmulationResult = (
    emulation.SetForcedColorsModeThemeOverrideResult /
    emulation.SetGeolocationOverrideResult /
    emulation.SetLocaleOverrideResult /
    emulation.SetScreenOrientationOverrideResult /
    emulation.SetScriptingEnabledResult /
    emulation.SetScrollbarTypeOverrideResult /
    emulation.SetTimezoneOverrideResult /
    emulation.SetTouchOverrideResult /
    emulation.SetUserAgentOverrideResult
    )
    

BiDi sessionemulated user agent を持つ。これは struct であり、 string または null である default user agent という名前の itemuser contexts と string の間の weak map である user context user agent という名前の item、および navigables と string の間の weak map である navigable user agent という名前の item を持つ。

BiDi sessionemulated maxTouchPoints を持つ。これは struct であり、 integer または null であり初期値が null である default という名前の itemuser contexts と integer の間の weak map であり初期値が空である user contexts という名前の item、 および navigables と integer の間の weak map であり初期値が空である navigables という名前の item を持つ。

screen orientation override は、次を持つ struct である:

remote endscreen orientation overrides map を持つ。これは user contextsscreen orientation override の間の weak map である。

7.4.2. コマンド

7.4.2.1. emulation.setForcedColorsModeThemeOverride コマンド

emulation.setForcedColorsModeThemeOverride コマンドは、指定された top-level traversables または user contexts 上の forced colors mode のテーマ特性を変更する。

コマンド型
emulation.SetForcedColorsModeThemeOverride = (
    method: "emulation.setForcedColorsModeThemeOverride",
    params: emulation.SetForcedColorsModeThemeOverrideParameters
    )

    emulation.SetForcedColorsModeThemeOverrideParameters = {
    theme: emulation.ForcedColorsModeTheme / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.ForcedColorsModeTheme = "light" / "dark"
    
戻り値型
emulation.SetForcedColorsModeThemeOverrideResult = EmptyResult
    

注: CSS 仕様における対応する enum mapping については、ForcedColorsModeAutomationTheme を参照すること。

remote endforced colors mode theme override configuration を持つ。これは associated type string を持つ WebDriver configuration である。

navigable navigable について update emulated forced colors theme するには:
  1. theme を、navigable についての forced colors mode theme override configurationget WebDriver configuration value の結果とする。

  2. Assert: theme は "light"、"dark" または unset である。

  3. themeunset である場合、theme を "none" に設定する。

  4. navigable および themeSet emulated forced colors theme data する。

command parameters を伴う remote end steps は次である:

  1. themecommand parameters["theme"] とする。

  2. theme が null である場合、themeunset に設定する。

  3. 実装が theme の設定をサポートしない場合、 unsupported operationerror code を持つ error を返す。

  4. affected navigables を、command parameters について forced colors mode theme override configuration themestore WebDriver configuration することを試みた結果とする。

  5. affected navigables の各 navigable について:

    1. navigable について Update emulated forced colors theme する。

  6. data null とともに success を返す。

7.4.2.2. emulation.setGeolocationOverride コマンド

emulation.setGeolocationOverride コマンドは、 指定された top-level traversables または user contexts 上の geolocation 特性を変更する。

コマンド型
emulation.SetGeolocationOverride = (
    method: "emulation.setGeolocationOverride",
    params: emulation.SetGeolocationOverrideParameters
    )

    emulation.SetGeolocationOverrideParameters = {
    (
        (coordinates: emulation.GeolocationCoordinates / null) //
        (error: emulation.GeolocationPositionError)
    ),
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.GeolocationCoordinates = {
    latitude: -90.0..90.0,
    longitude: -180.0..180.0,
    ? accuracy: (float .ge 0.0) .default 1.0,
    ? altitude: float / null .default null,
    ? altitudeAccuracy: (float .ge 0.0) / null .default null,
    ? heading: (0.0...360.0) / null .default null,
    ? speed: (float .ge 0.0) / null .default null,
    }

    emulation.GeolocationPositionError = {
    type: "positionUnavailable"
    }
    
戻り値型
emulation.SetGeolocationOverrideResult = EmptyResult
    

geolocation override は、次を持つ struct である:

remote endgeolocation override configuration を持つ。これは associated type geolocation override を持つ WebDriver configuration である。

navigable navigable について update geolocation override するには:
  1. emulated position data を、 navigable についての geolocation override configurationget WebDriver configuration value の結果とする。

  2. emulated position dataunset である場合、emulated position data を null に設定する。

  3. navigable および emulated position dataSet emulated position data する。

command parameters を伴う remote end steps は次である:

  1. command parameters が "coordinates" を含みcommand parameters["coordinates"] が "altitudeAccuracy" を含み、 かつ command parameters["coordinates"] が "altitude" を含まない場合、 invalid argumenterror code を持つ error を返す。

  2. command parameters が "error" を含む場合:

    1. command parameters["error"]["type"] が "positionUnavailable" に等しいことを Assert する。

    2. emulated position data を、code フィールドを POSITION_UNAVAILABLE に、message フィールドを空文字列に設定した、 GeolocationPositionError 生成規則に一致する map とする。

      注: message は geolocation 仕様に従って実装に無視される。

  3. そうでなければ、emulated position datacommand parameters["coordinates"] とする。

  4. emulated position data が null である場合、emulated position dataunset に設定する。

  5. affected navigables を、command parameters について geolocation override configuration emulated position datastore WebDriver configuration することを試みた結果とする。

  6. affected navigables の各 navigable について:

    1. navigable について Update geolocation override する。

  7. data null とともに success を返す。

7.4.2.3. emulation.setLocaleOverride コマンド

emulation.setLocaleOverride コマンドは、 指定された top-level traversables または user contexts 上の locale を変更する。

コマンド型
emulation.SetLocaleOverride = (
    method: "emulation.setLocaleOverride",
    params: emulation.SetLocaleOverrideParameters
    )

    emulation.SetLocaleOverrideParameters = {
    locale: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetLocaleOverrideResult = EmptyResult
    

WebDriver BiDi emulated language steps は、 environment settings object environment settings が与えられたとき、次である:

  1. related navigables を、 environment settings が与えられたものとして get related navigables した結果とする。

  2. related navigables の各 navigable について:

    1. top-level traversablenavigabletop-level traversable とする。

    2. user contexttop-level traversableassociated user context とする。

    3. locale overrides maptop-level traversable含む場合、 locale overrides map[top-level traversable] を返す。

    4. locale overrides mapuser context含む場合、 locale overrides map[user context] を返す。

  3. null を返す

command parameters を伴う remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. command parameters が "userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argumenterror code を持つ error を返す。

  3. emulated localecommand parameters["locale"] とする。

  4. emulated locale が null でなく、かつ IsStructurallyValidLanguageTag(emulated locale) が false を返す場合、invalid argumenterror code を持つ error を返す。

  5. navigablesset とする。

  6. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

  7. そうでなければ:

    1. command parametersuserContexts フィールドが存在することを Assert する。

    2. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    3. user contexts の各 user context について:

      1. emulated locale が null である場合、user contextlocale overrides map から削除する

      2. そうでなければ、locale overrides map[user context] を emulated locale設定する

      3. For each user contextassociated user context である すべての top-level traversables のリストの各 top-level traversable について:

        1. top-level traversablenavigables追加する

  8. navigables の各 navigable について:

    1. emulated locale が null である場合、 navigablelocale overrides map から削除する

    2. そうでなければ、locale overrides map[navigable] を emulated locale設定する

  9. data null とともに success を返す。

7.4.2.4. emulation.setNetworkConditions コマンド

emulation.setNetworkConditions コマンドは、 指定された browsing context または user context に対して特定の network conditions をエミュレートする。

コマンド型
emulation.SetNetworkConditions = (
    method: "emulation.setNetworkConditions",
    params: emulation.SetNetworkConditionsParameters
    )

    emulation.SetNetworkConditionsParameters = {
    networkConditions: emulation.NetworkConditions / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.NetworkConditions = emulation.NetworkConditionsOffline

    emulation.NetworkConditionsOffline = {
    type: "offline"
    }
    
戻り値型
emulation.SetNetworkConditionsResult = EmptyResult
    

apply network conditions するには:

  1. WebSocket object webSocket について:

    1. realmwebSocketrelevant Realm とする。

    2. environment settings を、その realm execution context の Realm component が realm である environment settings object とする。

    3. environment settingsWebDriver BiDi network is offline した結果が true である場合:

      1. webSocket について Fail the WebSocket connection する。

  2. WebTransport object webTransport について:

    1. realmwebSocketrelevant Realm とする。

    2. environment settings を、その realm execution context の Realm component が realm である environment settings object とする。

    3. environment settingsWebDriver BiDi network is offline した結果が true である場合:

      1. webTransport について Cleanup WebTransport する。

command parameters および session を伴う remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "context" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. emulated network conditions を null とする。

  3. command parameters["networkConditions"] が null でなく、かつ command parameters["networkConditions"]["type"] が "offline" に等しい場合、emulated network conditionsoffline を true に設定した新しい emulated network conditions struct に設定する。

  4. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. navigables の各 navigable について:

      1. emulated network conditions が null である場合、 navigablesessionemulated network conditionsnavigable network conditions から削除する

      2. そうでなければ、sessionemulated network conditionsnavigable network conditions[navigable] を emulated network conditions設定する

  5. command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. emulated network conditions が null である場合、 user contextsessionemulated network conditionsuser context network conditions から削除する

      2. そうでなければ、sessionemulated network conditionsuser context network conditions[user context] を emulated network conditions設定する

  6. command parameters が "userContexts" を含まず、 かつ command parameters が "context" を含まない場合、 sessionemulated network conditionsdefault network conditionsemulated network conditions設定する

  7. Apply network conditions する。

  8. data null とともに success を返す。

7.4.2.5. emulation.setScreenSettingsOverride コマンド

emulation.setScreenSettingsOverride コマンドは、 指定された top-level traversables または user contexts の web-exposed screen area および web-exposed available screen area をエミュレートする。

コマンド型
emulation.SetScreenSettingsOverride = (
    method: "emulation.setScreenSettingsOverride",
    params: emulation.SetScreenSettingsOverrideParameters
    )

    emulation.ScreenArea = {
    width: js-uint,
    height: js-uint
    }

    emulation.SetScreenSettingsOverrideParameters = {
    screenArea: emulation.ScreenArea / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetScreenSettingsOverrideResult = EmptyResult
    

WebDriver BiDi emulated available screen area steps は、navigable navigable が与えられたとき、次である:

  1. top-level traversablenavigabletop-level traversable とする。

  2. user contexttop-level traversableassociated user context とする。

  3. screen settings overridestop-level traversable含む場合、 screen settings overrides[top-level traversable] を返す。

  4. screen settings overridesuser context含む場合、 screen settings overrides[user context] を返す。

  5. null を返す

WebDriver BiDi emulated total screen area steps は、navigable navigable が与えられたとき、次である:

  1. top-level traversablenavigabletop-level traversable とする。

  2. user contexttop-level traversableassociated user context とする。

  3. screen settings overridestop-level traversable含む場合、 screen settings overrides[top-level traversable] を返す。

  4. screen settings overridesuser context含む場合、 screen settings overrides[user context] を返す。

  5. null を返す

command parameters を伴う remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. command parameters が "userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argumenterror code を持つ error を返す。

  3. emulated screen areacommand parameters["screenArea"] とする。

  4. emulated screen area が null でない場合:

    1. emulated screen area["x"] を 0 に設定する

    2. emulated screen area["y"] を 0 に設定する

  5. navigablesset とする。

  6. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. targetnavigable screen settings とする。

    3. navigables の各 navigable について:

      1. emulated screen area が null である場合、navigabletarget から削除する

      2. そうでなければ、target[navigable] を emulated screen area設定する

    4. data null とともに success を返す。

  7. そうでなければ:

    1. command parametersuserContexts フィールドが存在することを Assert する。

    2. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    3. targetuser context screen settings とする。

    4. user contexts の各 user context について:

      1. emulated screen area が null である場合、user contexttarget から削除する

      2. そうでなければ、target[user context] を emulated screen area設定する

    5. data null とともに success を返す。

7.4.2.6. emulation.setScreenOrientationOverride コマンド

emulation.setScreenOrientationOverride コマンドは、 指定された top-level traversables または user contexts のscreen orientation をエミュレートする。

コマンド型
emulation.SetScreenOrientationOverride = (
    method: "emulation.setScreenOrientationOverride",
    params: emulation.SetScreenOrientationOverrideParameters
    )

    emulation.ScreenOrientationNatural = "portrait" / "landscape"
    emulation.ScreenOrientationType = "portrait-primary" / "portrait-secondary" / "landscape-primary" / "landscape-secondary"

    emulation.ScreenOrientation = {
    natural: emulation.ScreenOrientationNatural,
    type: emulation.ScreenOrientationType
    }

    emulation.SetScreenOrientationOverrideParameters = {
    screenOrientation: emulation.ScreenOrientation / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetScreenOrientationOverrideResult = EmptyResult
    

navigable および emulated screen orientation が与えられたとき、set emulated screen orientation するには:

このアルゴリズムを screen orientation 仕様へ移動する。

  1. emulated screen orientation が null である場合:

    1. navigablecurrent orientation angle を 実装定義の既定値に設定する。

    2. navigablecurrent orientation type を 実装定義の既定値に設定する。

  2. そうでなければ:

    1. emulated orientation typeemulated screen orientation["type"] とする。

    2. emulated orientation angle を、 screen orientation values lists で定義されるとおり、 emulated screen orientation["natural"] orientations を持つ screen についての emulated orientation type に関連付けられた角度とする。

    3. current orientation angleemulated orientation angle に設定する。

    4. current orientation typeemulated orientation type に設定する。

  3. navigableactive document で、 screen orientation change steps を実行する。

command parameters を伴う remote end steps は次である:

  1. 実装が何らかの理由で、指定された command parameters を用いて screen orientations parameters を調整できない場合、 unsupported operationerror code を持つ error を返す。

  2. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  3. command parameters が "userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argumenterror code を持つ error を返す。

  4. emulated screen orientationcommand parameters["screenOrientation"] とする。

  5. navigablesset とする。

  6. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

  7. そうでなく、command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. emulated screen orientation が null である場合、 user contextscreen orientation overrides map から削除する

      2. そうでなければ、screen orientation overrides map[user context] を emulated screen orientation設定する

      3. For each user contextassociated user context である すべての top-level traversables のリストの各 top-level traversable について:

        1. top-level traversablenavigables追加する

  8. navigables の各 navigable について:

    1. user contextnavigableassociated user context とする。

    2. emulated screen orientation が null であり、かつ screen orientation overrides mapuser context含む場合、navigable および screen orientation overrides map[user context] で set emulated screen orientation する。

    3. そうでなければ、navigable および emulated screen orientationset emulated screen orientation する。

  9. data null とともに success を返す。

7.4.2.7. emulation.setUserAgentOverride コマンド

emulation.setUserAgentOverride コマンドは、 指定された top-level traversables、user contexts、または global において User-Agent を変更する。

コマンド型
emulation.SetUserAgentOverride = (
    method: "emulation.setUserAgentOverride",
    params: emulation.SetUserAgentOverrideParameters
    )

    emulation.SetUserAgentOverrideParameters = {
    userAgent: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetUserAgentOverrideResult = EmptyResult
    
environment settings object environment settings が与えられたときの WebDriver BiDi emulated User-Agent steps は次である:
  1. related navigables を、environment settingsget related navigables した結果とする。

  2. related navigables の各 navigable について:

    1. top-level navigablenavigabletop-level traversable とする。

    2. user contexttop-level navigableassociated user context とする。

    3. active BiDi sessions 内の各 session について:

      1. sessionemulated user agentnavigable user agenttop-level navigable を含む場合、sessionemulated user agentnavigable user agent[top-level navigable] を返す。

    4. active BiDi sessions 内の各 session について:

      1. sessionemulated user agentuser context user agentuser context を含む場合、sessionemulated user agentuser context user agent[user context] を返す。

  3. active BiDi sessions 内の各 session について:

    1. default emulated user agentsessionemulated user agentdefault user agent とする。

    2. default emulated user agent が null でない場合、 default emulated user agent を返す。

  4. null を返す。

session および command parameters が与えられたときの remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. emulated user agentcommand parameters["userAgent"] とする。

  3. command parameters が "contexts" を含む場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. navigables の各 navigable について:

      1. emulated user agent が null である場合、 navigablesessionemulated user agentnavigable user agent から削除する

      2. そうでなければ、sessionemulated user agentnavigable user agent[navigable] を emulated user agent設定する

    3. data null とともに success を返す。

  4. command parameters が "userContexts" を含む場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. emulated user agent が null である場合、 user contextsessionemulated user agentuser context user agent から削除する

      2. そうでなければ、sessionemulated user agentuser context user agent[user context] を emulated user agent設定する

    3. data null とともに success を返す。

  5. sessionemulated user agentdefault user agentemulated user agent設定する

  6. data null とともに success を返す。

7.4.2.8. emulation.setScriptingEnabled コマンド

emulation.setScriptingEnabled コマンドは、 web pages 上で JavaScript を無効にすることをエミュレートする。

コマンド型
emulation.SetScriptingEnabled = (
    method: "emulation.setScriptingEnabled",
    params: emulation.SetScriptingEnabledParameters
    )

    emulation.SetScriptingEnabledParameters = {
    enabled: false / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetScriptingEnabledResult = EmptyResult
    

注: disabled Javascript のエミュレーションのみが サポートされる。

environment settings object settings が与えられたときの WebDriver BiDi scripting is enabled steps は次である:
  1. navigable を、settingsrelevant global objectassociated Documentnode navigable とする。

  2. top-level traversablenavigabletop-level traversable とする。

  3. scripting enabled overrides maptop-level traversable を含む場合、 scripting enabled overrides map[top-level traversable] を返す。

  4. user contexttop-level traversableassociated user context とする。

  5. scripting enabled overrides mapuser context を含む場合、 scripting enabled overrides map[user context] を返す。

  6. true を返す。

command parameters を伴う remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. command parameters が "userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argumenterror code を持つ error を返す。

  3. emulated scripting enabled statuscommand parameters["enabled"] とする。

  4. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. navigables の各 navigable について:

      1. emulated scripting enabled status が null である場合、 navigablescripting enabled overrides map から削除する

      2. そうでなければ、scripting enabled overrides map[navigable] を emulated scripting enabled status設定する

  5. command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. emulated scripting enabled status が null である場合、 user contextscripting enabled overrides map から削除する

      2. そうでなければ、scripting enabled overrides map[user context] を emulated scripting enabled status設定する

  6. data null とともに success を返す。

7.4.2.9. emulation.setScrollbarTypeOverride コマンド

emulation.setScrollbarTypeOverride コマンドは、 指定された top-level traversables、user contexts、または global において scrollbar type を変更する。

コマンド型
emulation.SetScrollbarTypeOverride = (
    method: "emulation.setScrollbarTypeOverride",
    params: emulation.SetScrollbarTypeOverrideParameters
    )

    emulation.SetScrollbarTypeOverrideParameters = {
    scrollbarType: "classic" / "overlay" / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetScrollbarTypeOverrideResult = EmptyResult
    

remote endscrollbar type override configuration を持ち、 これは WebDriver configuration であり、associated type string を持つ。

navigable navigable について update scrollbar type override するには:
  1. scrollbar type override を、 navigable についての scrollbar type override configurationget WebDriver configuration value の結果とする。

  2. Assert: scrollbar type override は "classic"、 "overlay" または unset である。

  3. scrollbar type override が "classic" である場合、 navigableactive documentclassic scrollbars を使用するようにする implementation-defined steps を実行し、戻る。

  4. scrollbar type override が "overlay" である場合、 navigableactive documentoverlay scrollbars を使用するようにする implementation-defined steps を実行し、戻る。

  5. Assert: scrollbar type overrideunset である。

  6. navigableactive documentimplementation-defined default scrollbar type を 使用するようにする implementation-defined steps を実行する。

command parameters が与えられたときの remote end steps は次である:

  1. scrollbar type overridecommand parameters["scrollbarType"] とする。

  2. scrollbar type override が null である場合、scrollbar type overrideunset に設定する。

  3. 実装が scrollbar type override の設定をサポートしない場合、unsupported operationerror code を持つ error を返す。

  4. affected navigables を、command parameters について scrollbar type override configuration scrollbar type overridestore WebDriver configuration することを試みた結果とする。

  5. affected navigables の各 navigable について:

    1. navigable について Update scrollbar type override する。

  6. data null とともに success を返す。

7.4.2.10. emulation.setTimezoneOverride コマンド

emulation.setTimezoneOverride コマンドは、 指定された top-level traversables または user contexts 上の timezone を変更する。

コマンド型
emulation.SetTimezoneOverride = (
    method: "emulation.setTimezoneOverride",
    params: emulation.SetTimezoneOverrideParameters
    )

    emulation.SetTimezoneOverrideParameters = {
    timezone: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetTimezoneOverrideResult = EmptyResult
    
SystemTimeZoneIdentifier アルゴリズムは実装定義である。 WebDriver-BiDi remote end は、次のステップを実行する実装を持たなければならない:
  1. emulated timezone を null とする。

  2. realmcurrent Realm Record とする。

  3. environment settings を、その realm execution context の Realm component が realm である environment settings object とする。

  4. related navigables を、 environment settings が与えられたものとして get related navigables した結果とする。

  5. related navigables の各 navigable について:

    1. top-level traversablenavigabletop-level traversable とする。

    2. user contexttop-level traversableassociated user context とする。

    3. timezone overrides maptop-level traversable含む場合、 emulated timezonetimezone overrides map[top-level traversable] に設定する。

    4. そうでなく、timezone overrides mapuser context含む場合、 emulated timezonetimezone overrides map[user context] に設定する。

  6. emulated timezone が null でない場合、emulated timezone を返す。

  7. SystemTimeZoneIdentifier 仕様の要件に従った implementation-defined steps の結果を返す。

command parameters を伴う remote end steps は次である:

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argumenterror code を持つ error を返す。

  2. command parameters が "userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argumenterror code を持つ error を返す。

  3. emulated timezonecommand parameters["timezone"] とする。

  4. emulated timezone が null でなく、かつ IsTimeZoneOffsetString(emulated timezone) が false を返し、かつ AvailableNamedTimeZoneIdentifiersemulated timezone含まない場合、 invalid argumenterror code を持つ error を返す。

  5. navigablesset とする。

  6. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

  7. そうでなければ:

    1. command parametersuserContexts フィールドが存在することを Assert する。

    2. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    3. user contexts の各 user context について:

      1. emulated timezone が null である場合、 user contexttimezone overrides map から削除する

      2. そうでなければ、timezone overrides map[user context] を emulated timezone設定する

      3. For each user contextassociated user context である すべての top-level traversables のリストの各 top-level traversable について:

        1. top-level traversablenavigables追加する

  8. navigables の各 navigable について:

    1. emulated timezone が null である場合、navigabletimezone overrides map から削除する

    2. そうでなければ、timezone overrides map[navigable] を emulated timezone設定する

  9. data null とともに success を返す。

7.4.2.11. emulation.setTouchOverride コマンド

emulation.setTouchOverride コマンドは、 web pages 上で touch input が有効であることをエミュレートする。

コマンド型
emulation.SetTouchOverride = (
    method: "emulation.setTouchOverride",
    params: emulation.SetTouchOverrideParameters
    )

    emulation.SetTouchOverrideParameters = {
    maxTouchPoints: (js-uint .ge 1) / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
戻り値型
emulation.SetTouchOverrideResult = EmptyResult
    
environment settings object environment settings が与えられたときの WebDriver BiDi emulated max touch points steps は次である:
  1. related navigables を、environment settingsget related navigables した結果とする。

  2. related navigables の各 navigable について:

    1. top-level navigablenavigabletop-level traversable とする。

    2. user contexttop-level navigableassociated user context とする。

    3. active BiDi sessions 内の各 session について:

      1. sessionemulated maxTouchPointsnavigablestop-level navigable を含む場合、 sessionemulated maxTouchPointsnavigables[top-level navigable] を返す。

    4. active BiDi sessions 内の各 session について:

      1. sessionemulated maxTouchPointsuser contextsuser context を含む場合、sessionemulated maxTouchPointsuser contexts[user context] を返す。

  3. active BiDi sessions 内の各 session について:

    1. emulated maxTouchPointssessionemulated maxTouchPointsdefault とする。

    2. emulated maxTouchPoints が null でない場合、emulated maxTouchPoints を返す。

  4. null を返す。

session および command parameters を伴う remote end steps は次である:

注: legacy な expose legacy touch event APIs があり、 これは既存の一部の web contents によって、user agent が touch-enabled な "mobile" device であることの signal としてまだ使用されることがある。API は legacy であるが、user agent は emulated maxTouchPoints 状態を expose legacy touch event APIs に反映するため、 implementation-defined steps を実行してもよい。

  1. command parameters が "userContexts" を含み、 かつ command parameters が "contexts" を含む場合、invalid argumenterror code を持つ error を返す。

  2. maxTouchPointscommand parameters["maxTouchPoints"] とする。

  3. command parameterscontexts フィールドが存在する場合:

    1. navigables を、 command parameters["contexts"] で get valid top-level traversables by ids することを試みた結果とする。

    2. navigables の各 navigable について:

      1. maxTouchPoints が null である場合、 navigablesessionemulated maxTouchPointsnavigables から削除する

      2. そうでなければ、sessionemulated maxTouchPointsnavigables[navigable] を maxTouchPoints設定する

    3. data null とともに success を返す。

  4. command parametersuserContexts フィールドが存在する場合:

    1. user contexts を、 command parameters["userContexts"] で get valid user contexts することを試みた結果とする。

    2. user contexts の各 user context について:

      1. maxTouchPoints が null である場合、 user contextsessionemulated maxTouchPointsuser contexts から削除する

      2. そうでなければ、sessionemulated maxTouchPointsuser contexts[user context] を maxTouchPoints設定する

    3. data null とともに success を返す。

  5. sessionemulated maxTouchPointsdefaultmaxTouchPoints に設定する。

  6. data null とともに success を返す。

7.5. network モジュール

network モジュールは、network requests に関するコマンドおよびイベントを含む。

7.5.1. 定義

remote end definition

NetworkCommand = (
    network.AddDataCollector //
    network.AddIntercept //
    network.ContinueRequest //
    network.ContinueResponse //
    network.ContinueWithAuth //
    network.DisownData //
    network.FailRequest //
    network.GetData //
    network.ProvideResponse //
    network.RemoveDataCollector //
    network.RemoveIntercept //
    network.SetCacheBehavior //
    network.SetExtraHeaders
    )

    

local end definition

NetworkResult = (
    network.AddDataCollectorResult /
    network.AddInterceptResult /
    network.ContinueRequestResult /
    network.ContinueResponseResult /
    network.ContinueWithAuthResult /
    network.DisownDataResult /
    network.FailRequestResult /
    network.GetDataResult /
    network.ProvideResponseResult /
    network.RemoveDataCollectorResult /
    network.RemoveInterceptResult /
    network.SetCacheBehaviorResult /
    network.SetExtraHeadersResult
    )

    NetworkEvent = (
        network.AuthRequired //
        network.BeforeRequestSent //
        network.FetchError //
        network.ResponseCompleted //
        network.ResponseStarted
    )

    

remote endbefore request sent map を持ち、これは初期状態では 空の map である。これは、network.beforeRequestSent イベントがすでに送信された network events を追跡するために使用される。

remote enddefault cache behavior を持ち、これは string である。 これは初期状態では "default" である。

remote endnavigable cache behavior map を持ち、これは top-level traversables と cache behavior を表す strings の間の weak map である。これは初期状態では空である。

BiDi sessionextra headers を持ち、これは struct であり、 default headers という名前の item を持つ。これは header list である(初期状態では空の header list に設定される)。また、 user context headers という名前の item を持ち、これは user contextsheader lists の間の weak map である。さらに、 navigable headers という名前の item を持ち、 これは navigablesheader lists の間の weak map である。

7.5.2. ネットワークデータ収集

network data は、次を持つ struct である:

collector は、次を持つ struct である:

注: max encoded item size は item ごとの制限(response または request)を定義し、 特定の collector によって収集されるサイズを制限しない。収集されたすべての resources の合計サイズは max total collected size によって制限される。

BiDi sessionnetwork collectors を持ち、これは network.Collectorcollector の間の map である。これは初期状態では空である。

remote endcollected network data を持ち、これは network data の list である。 これは初期状態では空である。

remote endmax total collected size を持ち、これは collected network data において network data の収集に割り当てられる サイズを表す js-uint である。その値は実装定義である。

注: これにより、実装は resource usage limits を設定できる。 limits は、画像や webpage で使用される fonts など、browser によって完全に decode され処理される data の収集に users が依存できる程度に十分大きいことが期待される。

request が与えられたとき、get navigable for request するには:
  1. navigable を null とする。

  2. requestclientenvironment settings object である場合:

    1. environment settingsrequestclient とする

    2. environment settingsglobal objectactive window である navigable が存在する場合、 navigable をその navigable に設定する。

  3. navigable を返す。

collector および navigable が与えられたとき、 match collector for navigable するには:
  1. collectorcontextsでない場合:

    1. collectorcontextsnavigablenavigable id含む場合、true を返す。

    2. そうでなければ、false を返す。

  2. collectoruser contextsでない場合:

    1. user contextnavigableassociated user context とする。

    2. collectoruser contextsuser contextuser context id含む場合、true を返す。

    3. そうでなければ、false を返す。

  3. true を返す。

request request が与えられたときの WebDriver BiDi clone network request body steps は次である:
  1. requestbody が null である場合、戻る。

  2. active BiDi sessions 内の各 session について:

    1. sessionnetwork collectorsでない場合:

      1. collected data を、 network data とし、 bytes を null に設定し、 cloned bodyrequestbodyclone に設定し、 collectors を空の list に設定し、 pending を true に設定し、 requestrequestrequest id に設定し、 size を null に設定し、 type を "request" に設定したものとする。

      2. collected datacollected network data追加する

      3. 戻る。

request および response body が与えられたときの WebDriver BiDi clone network response body steps は次である:
  1. response body が null である場合、戻る。

  2. active BiDi sessions 内の各 session について:

    1. sessionnetwork collectorsでない場合:

      1. collected data を、 network data とし、 bytes を null に設定し、 cloned bodyresponse bodyclone に設定し、 collectors を空の list に設定し、 pending を true に設定し、 requestrequestrequest id に設定し、 size を null に設定し、 type を "response" に設定したものとする。

      2. collected datacollected network data追加する

      3. 戻る。

request id および data type が与えられたとき、 get collected data するには。
  1. collected network data の各 collected data について:

    1. collected datarequestrequest id であり、 かつ collected datatypedata type である場合、 collected data を返す。

  2. null を返す。

request が与えられたとき、 maybe abort network response body collection するには:
  1. collected data を、requestrequest id および "response" で get collected data したものとする。

  2. collected data が null である場合、戻る。

  3. collected datapending を false に設定する。

  4. "network data collected" および (requestrequest id, "response") で Resume する。

request が与えられたとき、 maybe collect network request body するには:
  1. collected data を、requestrequest id および "request" で get collected data したものとする。

  2. collected data が null である場合、戻る。

    注: これは、request が作成されたときに collectors が設定されておらず、 WebDriver BiDi clone network request body が対応する body を clone しない場合に起こり得る。 または、そもそも body が null であった場合にも起こり得る。

  3. requestcollected data、null、および "request" で Maybe collect network data する。

request および response が与えられたとき、 maybe collect network response body するには:
  1. responsestatusredirect status である場合、戻る。

    注: redirects については、最終 response body のみが保存される。

  2. collected data を、requestrequest id および "response" で get collected data したものとする。

  3. collected data が null である場合、戻る。

    注: これは、response が作成されたときに collectors が設定されておらず、 WebDriver BiDi clone network response body が対応する body を clone しない場合に起こり得る。 または、そもそも body が null であった場合にも起こり得る。

  4. size を、responseresponse body infoencoded size とする。

    注: fetch stream から取得される bytes は decoded data に対応するが、size limits を計算するためには encoded (network) size が使用される、 という不一致がある。実装は、getData で clients に返される data が decoded data と同一である限り、 decoded data を保存するよりも少ない size を使用する storage model を採用してもよい。 storage と performance の潜在的な tradeoff は実装次第である。

  5. requestcollected datasize および "response" で Maybe collect network data する。

request requestnetwork data collected data、js-uint size および network.DataType data type が与えられたとき、 maybe collect network data するには:
  1. collected datapending を false に設定する。

  2. navigable を、 requestget navigable for request したものとする。

  3. navigable が null である場合:

    1. collected datacollected network data から削除する

    2. "network data collected" および (requestrequest id, data type) で Resume する。

    3. 戻る。

    これは navigable に関係しない data の収集を防ぐ。 collector configuration に照らして確認するために navigable を取得する必要はまだあるが、 ここで null を受け入れることもできる。

  4. top-level navigablenavigabletop-level traversable とする。

  5. collectors を空の list とする。

  6. active BiDi sessions 内の各 session について:

    1. sessionnetwork collectors 内の各 collector について:

      1. collectordata typesdata type含み、かつ collector および top-level navigablematch collector for navigable した場合:

        1. collectorcollectors追加する

  7. collectorsである場合:

    1. collected datacollected network data から削除する

    2. "network data collected" および (requestrequest id, data type) で Resume する。

    3. 戻る。

  8. bytes を null とする。

  9. nullOrBytes が与えられたときの processBody を、このステップとする:

    1. nullOrBytes が null でない場合:

      1. bytes を、 nullOrBytesserialize protocol bytes した結果に設定する。

      2. size が null である場合、sizebyteslength に設定する。

  10. processBodyError を、このステップとする: 何もしない。

  11. processBody および processBodyError が与えられたものとして、collected datacloned bodyFully read する。

  12. bytes が null でない場合:

    1. collectors 内の各 collector について:

      1. sizecollectormax encoded item size 以下である場合、 collectorcollectorcollected datacollectors追加する

    2. collected datacollectorsでない場合:

      1. size が与えられたものとして Allocate size to record data する。

      2. collected databytesbytes に設定する。

      3. collected datasizesize に設定する。

    3. そうでなければ、collected datacollected network data から削除する

  13. "network data collected" および (requestrequest id, data type) で Resume する。

size が与えられたとき、allocate size to record data するには:
  1. available sizemax total collected size とする。

  2. already collected data を空の list とする。

  3. collected network data 内の各 collected data について:

    1. collected databytes が null でない場合:

      1. available sizecollected datasize だけ減らす。

      2. collected dataalready collected data追加する

  4. sizeavailable size より大きい場合:

    1. already collected data 内の各 collected data について:

      1. available sizecollected datasize だけ増やす。

      2. collected databytes field を null に設定する。

      3. collected datasize field を null に設定する。

      4. available sizesize 以上である場合、戻る。

collected data および collector id が与えられたとき、 remove collector from data するには:
  1. collected datacollectorscollector id含む場合:

    1. collector idcollected datacollectors から削除する

    2. collected datacollectorsである場合:

      1. collected datacollected network data から削除する

7.5.3. ネットワークインターセプト

network intercept は、remote ends が network requests および responses をインターセプトし、 変更できるようにする仕組みである。

BiDi sessionintercept map を持ち、 これは intercept id と、active network intercepts のプロパティを定義する url patternsphases、および contexts の field を持つ struct との間の map である。これは初期状態では空である。

BiDi sessionblocked request map を持ち、これは現在 active に block されている requests を追跡するために使用される。これは request id と、requestphase、および response の field を持つ struct との間の map である。 これは初期状態では空である。

sessioneventrequest、および navigable id が与えられたとき、get the network intercepts するには:

  1. session interceptssessionintercept map とする。

  2. intercepts を空の list とする。

  3. 最初に一致する条件の下にある steps を実行する:

    event が "network.beforeRequestSent" である
    phase を "beforeRequestSent" に設定する。
    event が "network.responseStarted" である
    phase を "responseStarted" に設定する。
    event が "network.authRequired" である
    phase を "authRequired" に設定する。
    event が "network.responseCompleted" である
    intercepts を返す。
  4. url を、requestURLURL serializer を実行した結果とする。

  5. session intercepts の各 intercept idintercept について:

    1. interceptcontexts が null でない場合:

      1. interceptcontextsnavigable id含まない場合:

        1. 続行する。

    2. interceptphasesphase含む場合:

      1. url patternsintercepturl patterns とする。

      2. url patternsである場合:

        1. intercept idintercepts追加する

        2. 続行する。

      3. url patterns 内の各 url pattern について:

        1. url pattern および urlmatch URL pattern した場合:

          1. intercept idintercepts追加する

          2. 中断する。

  6. intercepts を返す。

sessioncommand および command parameters が与えられたとき、 update the response するには:
  1. blocked requestssessionblocked request map とする。

  2. request idcommand parameters["request"] とする。

  3. blocked requestsrequest id含まない場合、 no such requesterror code を持つ error を返す。

  4. (request, phase, response) を blocked requests[request id] とする。

  5. phase が "beforeRequestSent" であり、かつ command が "continueResponse" である場合、"invalid argument" の error code を持つ error を返す。

    TODO: 別の error を検討する

  6. response が null である場合:

    1. Assert: phase は "beforeRequestSent" である。

    2. response を新しい response に設定する。

  7. command parameters が "statusCode" を含む場合:

    1. responsesstatuscommand parameters["statusCode"] に設定する。

  8. command parameters が "reasonPhrase" を含む場合:

    1. responsesstatus message を、 command parameters["reasonPhrase"] で UTF-8 encode した結果に設定する。

  9. command parameters が "headers" を含む場合:

    1. headers を、 command parameters["headers"] で create a headers list することを試みた結果とする。

    2. responseheader listheaders に設定する。

  10. command parameters が "cookies" を含む場合:

    1. command parameters が "headers" を含む場合、headersresponseheader list とする。

      そうでなければ:

      1. headers を空の header list とする。

      2. responseheaders list 内の各 header について:

        1. nameheader の name とする。

        2. namebyte-lowercase したものが `set-cookie` でない場合:

          1. headerheaders に追加する

    2. command parameters["cookies"] 内の各 cookie について:

      1. header value を、cookieserialize set-cookie header した結果とする。

      2. (`Set-Cookie`, header value) を headers に追加する。

      3. responseheader listheaders に設定する。

  11. command parameters が "credentials" を含む場合:

    これには auth を cancel する方法がない。

    1. credentialscommand parameters["credentials"] とする。

    2. Assert: credentials["type"] は "password" である。

    3. response の authentication credentials を (credentials["username"], credentials["password"]) に設定する

  12. response を返す

7.5.4.

7.5.4.1. network.AuthChallenge 型
network.AuthChallenge = {
    scheme: text,
    realm: text,
    }
    

response が与えられたとき、extract challenges するには:

realm 以外の parameters も含めるべきか?

  1. responsestatus が 401 である場合、header name を `WWW-Authenticate` とする。そうでなく、responsestatus が 407 である場合、 header name を `Proxy-Authenticate` とする。そうでなければ null を返す。

  2. challenges を新しい list とする。

  3. responseheader list 内の各 (name, value) について:

    Fetch と同様に、 複数 headers、parsing issues などを処理する正しい方法であるかどうかは不明である。

    1. nameheader name に対する byte-case-insensitive match である場合:

      1. header challenges を、value を challenges の list に parse した結果とする。各 challenge は scheme および parameters の list からなり、 各 parameter は tuple (name, value) であり、[RFC9110] の規則に従う。

      2. header challenges 内の各 header challenge について:

        1. schemeheader challenge の scheme とする。

        2. realm を空文字列とする。

        3. header challenge の parameters 内の各 (param name, param value) について:

          1. param name が `realm` と等しい場合、 realmparam valueUTF-8 decode した結果とする。

        4. challenge を、 scheme field を scheme に設定し、 realm field を realm に設定した、 network.AuthChallenge production に一致する新しい map とする。

      3. challengechallenges追加する

  4. challenges を返す。

7.5.4.2. network.AuthCredentials 型
network.AuthCredentials = {
    type: "password",
    username: text,
    password: text,
    }
    

network.AuthCredentials 型は、authorization credentials に対する request への response を表す。

7.5.4.3. network.BaseParameters 型
network.BaseParameters = (
        context: browsingContext.BrowsingContext / null,
        isBlocked: bool,
        navigation: browsingContext.Navigation / null,
        redirectCount: js-uint,
        request: network.RequestData,
        timestamp: js-uint,
        ? userContext: browser.UserContext / null,
        ? intercepts: [+network.Intercept]
    )
    

network.BaseParameters 型は、すべての network events に共通する data を表す抽象型である。

context に加えて、 request を開始した document node の `sharedId` を含めることを検討する。

sessionevent、および request が与えられたとき、 process a network event するには:
  1. request data を、requestget the request data した結果とする。

  2. navigationrequestnavigation id とする。

  3. navigable id を null とする。

  4. top-level navigable id を null とする。

  5. user context id を null とする。

  6. requestclientenvironment settings object である場合:

    1. environment settingsrequestclient とする。

    2. environment settingsglobal objectactive window である navigable が存在する場合、navigable id をその navigable の navigable id に設定し、top-level navigable id をその navigable の top-level traversablenavigable id に設定し、 user context id をその navigable の associated user contextuser context id に設定する。

  7. intercepts を、 sessioneventrequest、および top-level navigable idget the network intercepts した結果とする。

  8. redirect countrequestredirect count とする。

  9. timestamp を、UTC における現在の日付と時刻を表す time value とする。

  10. interceptsでない場合、 is blocked を true とし、そうでなければ is blocked を false とする。

  11. params を、network.BaseParameters production に一致する map とし、 request field を request data に設定し、 navigation field を navigation に設定し、context field を navigable id に設定し、userContext field を user context id に設定し、timestamp field を timestamp に設定し、 redirectCount field を redirect count に設定し、 isBlocked field を is blocked に設定し、is blocked が true である場合は intercepts field を intercepts に設定し、そうでなければ省略する。

  12. params を返す

7.5.4.4. network.BytesValue 型
network.BytesValue = network.StringValue / network.Base64Value;

    network.StringValue = {
    type: "string",
    value: text,
    }

    network.Base64Value = {
    type: "base64",
    value: text,
    }
    

network.BytesValue 型は、network を通じて送信される binary data を表す。 valid UTF-8 は network.StringValue 型で表され、 その他の data は Base64-encoded form として network.Base64Value で表される。

protocol bytes が与えられたとき、deserialize protocol bytes するには:

注: これは network.BytesValue として encode された bytes を受け取り、 byte sequence を返す。

  1. protocol bytesnetwork.StringValue production に一致する場合、 bytes を、protocol bytes["value"] で UTF-8 encode した結果とする。

  2. そうでなく、protocol bytesnetwork.Base64Value production に一致する場合、bytes を、protocol bytes["value"] で forgiving-base64 decode した結果とする。

  3. bytes を返す。

bytes が与えられたとき、serialize protocol bytes するには:

注: これは byte sequence を受け取り、 network.BytesValue を返す。

  1. text を、bytesUTF-8 decode without BOM or fail した結果とする。

  2. text が failure である場合、valuebytesforgiving-base64 encode した結果に設定した、 network.Base64Value production に一致する map を返す。

  3. valuetext に設定した、 network.StringValue production に一致する map を返す。

7.5.4.5. network.Collector 型

Remote end definition および local end definition

network.Collector = text
    

network.Collector 型は collector の id を表す。

7.5.4.6. network.CollectorType 型

Remote end definition および local end definition

network.CollectorType = "blob"
    

注: 将来的には、特定の collector によって収集された data を stream を通じて読み取りたい clients のために、"stream" collector type もサポートする可能性がある。

network.CollectorType 型は、追加できる data collectors の異なる種類を表す。

Remote end definition および local end definition

network.SameSite = "strict" / "lax" / "none" / "default"


    network.Cookie = {
        name: text,
        value: network.BytesValue,
        domain: text,
        path: text,
        size: js-uint,
        httpOnly: bool,
        secure: bool,
        sameSite: network.SameSite,
        ? expiry: js-uint,
        Extensible,
    }
    

network.Cookie 型は cookie を表す。

stored cookie が与えられたとき、serialize cookie するには:
  1. name を、stored cookie の name field で UTF-8 decode した結果とする。

  2. value を、stored cookie の value で serialize protocol bytes した結果とする。

  3. domainstored cookie の domain field とする。

  4. pathstored cookie の path field とする。

  5. expiry を、設定されている場合は unix timestamp として表された stored cookie の expiry-time field とし、そうでなければ null とする。

  6. size を、stored cookieCookie header で表されるときの形式で serialize した結果の byte length とする。

  7. http only を、stored cookie の http-only-flag が true である場合は true とし、 そうでなければ false とする。

  8. secure を、stored cookie の secure-only-flag が true である場合は true とし、 そうでなければ false とする。

  9. same site を、stored cookie の same-site-flag が "None" である場合は "none"、"Lax" である場合は "lax"、"Strict" である場合は "strict"、または "Default" である場合は "default" とする

  10. network.Cookie production に一致する map を返す。 name field を name に設定し、value field を value に設定し、domain field を domain に設定し、 path field を path に設定し、expiry field を expiry が null でない場合はそれに設定し、そうでなければ省略し、 size field を size に設定し、httpOnly field を http only に設定し、secure field を secure に設定し、 sameSite field を same site に設定する。

7.5.4.8. network.CookieHeader 型

Remote end definition

network.CookieHeader = {
        name: text,
        value: network.BytesValue,
    }
    

network.CookieHeader 型は、Cookie request header 内にある cookie data の subset を表す。

protocol cookie が与えられたとき、serialize cookie header するには:
  1. name を、protocol cookie["name"] で UTF-8 encode した結果とする。

  2. value を、protocol cookie["value"] で deserialize protocol bytes した結果とする。

  3. header value を、name、 `=`、および value を連結して形成される byte sequence とする

  4. header value を返す。

7.5.4.9. network.DataType 型

Remote end definition および local end definition

network.DataType = "request" / "response"
    

network.DataType 型は、収集できる network data の異なる種類を表す。

7.5.4.10. network.FetchTimingInfo 型

Remote end definition および local end definition

network.FetchTimingInfo = {
        timeOrigin: float,
        requestTime: float,
        redirectStart: float,
        redirectEnd: float,
        fetchStart: float,
        dnsStart: float,
        dnsEnd: float,
        connectStart: float,
        connectEnd: float,
        tlsStart: float,

        requestStart: float,
        responseStart: float,

        responseEnd: float,
    }
    

network.FetchTimingInfo 型は、request の clienttime origin を基準とした、 request の 各部分の時刻を表す。

request が与えられたとき、get the fetch timings するには:
  1. globalrequestclient とする。

  2. global が null である場合、すべての fields を 0 に設定した network.FetchTimingInfo production に一致する map を返す。

  3. time origin を、globalget time origin timestamp した結果とする。

  4. timingsrequestfetch timing info とする。

  5. connection timing を、timingsfinal connection timing info が null でない場合はそれとし、 そうでなければ新しい connection timing info とする。

  6. request time を、timingsstart time および global が与えられたものとして convert fetch timestamp した結果とする。

  7. redirect start を、timingsredirect start time および global が与えられたものとして convert fetch timestamp した結果とする。

  8. redirect end を、timingsredirect end time および global が与えられたものとして convert fetch timestamp した結果とする。

  9. fetch start を、timingspost-redirect start time および global が与えられたものとして convert fetch timestamp した結果とする。

  10. DNS start を、connection timingdomain lookup start time および global が与えられたものとして convert fetch timestamp した結果とする。

  11. DNS end を、connection timingdomain lookup end time および global が与えられたものとして convert fetch timestamp した結果とする。

  12. TLS start を、connection timingsecure connection start time および global が与えられたものとして convert fetch timestamp した結果とする。

  13. connect start を、connection timingconnection start time および global が与えられたものとして convert fetch timestamp した結果とする。

  14. connect end を、connection timingconnection end time および global が与えられたものとして convert fetch timestamp した結果とする。

  15. request start を、timingsfinal network-request start time および global が与えられたものとして convert fetch timestamp した結果とする。

  16. response start を、timingsfinal network-response start time および global が与えられたものとして convert fetch timestamp した結果とする。

  17. response end を、timingsend time および global が与えられたものとして convert fetch timestamp した結果とする。

  18. network.FetchTimingInfo production に一致する map を返す。 timeOrigin field を time origin に設定し、 requestTime field を request time に設定し、 redirectStart field を redirect start に設定し、 redirectEnd field を redirect end に設定し、 fetchStart field を fetch start に設定し、 dnsStart field を DNS start に設定し、dnsEnd field を DNS end に設定し、connectStart field を connect start に設定し、connectEnd field を connect end に設定し、 tlsStart field を TLS start に設定し、 requestStart field を request start に設定し、 responseStart field を response start に設定し、 responseEnd field を response end に設定する。

TODO: service worker fields を追加する

7.5.4.11. network.Header 型

Remote end definition および local end definition

network.Header = {
    name: text,
    value: network.BytesValue,
    }
    

network.Header 型は、単一の request header を表す。

name bytes および value bytes が与えられたとき、serialize header するには:
  1. name を、name bytesUTF-8 decode した結果とする。

    Assert: header names は ASCII-only に制約されているため、これは失敗し得ない。

  2. value を、value bytesserialize protocol bytes した結果とする。

  3. name field を name に設定し、value field を value に設定した、network.Header production に一致する map を返す。

protocol header が与えられたとき、deserialize header するには:
  1. name を、protocol header["name"] で UTF-8 encode した結果とする。

  2. value を、protocol header["value"] で deserialize protocol bytes した結果とする。

  3. header (name, value) を返す。

protocol headers が与えられたとき、create a headers list するには:
  1. headers を空の header list とする。

  2. protocol headers 内の各 header について:

    1. deserialized header を、headerdeserialize header した結果とする。

    2. deserialized header の name が field-name token production に一致しない場合、 "invalid argument" の error code を持つ error を返す。

    3. deserialized header の value が header value production に一致しない場合、 "invalid argument" の error code を持つ error を返す。

    4. deserialized headerheaders に追加する。

  3. data headers とともに success を返す

7.5.4.12. network.Initiator 型

Remote end definition および local end definition

network.Initiator = {
        ? columnNumber: js-uint,
        ? lineNumber: js-uint,
        ? request: network.Request,
        ? stackTrace: script.StackTrace,
        ? type: "parser" / "script" / "preflight" / "other"
    }
    

network.Initiator 型は、network request の source を表す。

注: type field は後方互換性のために definition に含まれているが、get the initiator steps によってはもはや設定されず、 この仕様の将来の revision で削除される予定である。その使用は network.RequestData 上の initiatorType および destination によって置き換えられることが期待される。

注: request field は後方互換性のために definition に含まれているが、get the initiator steps によってはもはや設定されず、 この仕様の将来の revision で削除される予定である。 network.Initiator は、同じ request id も含む network.BeforeRequestSentParameters に含まれるため、 この情報は冗長である。§ 7.5.4.3 network.BaseParameters 型 を参照。

request が与えられたとき、get the initiator するには:
  1. requestinitiator type が "fetch" または "xmlhttprequest" である場合:

    1. stack tracecurrent stack trace とする。

    2. stack trace の size が 1 以上である場合、line numberstack trace[0] 内の lineNumber field の value とし、 column numberstack trace[0] 内の columnNumber field の value とする。 そうでなければ、line number および column number を 0 とする。

    そうでなければ、stack tracecolumn number、および line number をすべて null とする。

    TODO: Chrome は parser-inserted resources について、current parser position を column number / line number として含める。

  2. network.Initiator production に一致する map を返す。 columnNumber field を、column number が null でない場合はそれに設定し、 そうでなければ省略する。lineNumber field を、line number が null でない場合はそれに設定し、そうでなければ省略する。stackTrace field を stack trace が null でない場合はそれに設定し、そうでなければ省略する。

7.5.4.13. network.Intercept 型

Remote end definition および local end definition

network.Intercept = text
    

network.Intercept 型は network intercept の id を表す。

7.5.4.14. network.Request 型

Remote end definition および local end definition

network.Request = text;
    

各 network request は、関連付けられた request id を持つ。これはその request を一意に識別する string である。redirect から生じる request の identifier は、それを開始した request の identifier と一致する。

7.5.4.15. network.RequestData 型

Remote end definition および local end definition

network.RequestData = {
        request: network.Request,
        url: text,
        method: text,
        headers: [*network.Header],
        cookies: [*network.Cookie],
        headersSize: js-uint,
        bodySize: js-uint / null,
        destination: text,
        initiatorType: text / null,
        timings: network.FetchTimingInfo,
    }
    

network.RequestData 型は、進行中の network request を表す。

request が与えられたとき、get the request data するには:

  1. request id を request の request id とする。

  2. url を、requestURLURL serializer を実行した結果とする。

  3. methodrequestmethod とする。

  4. body size を null とする。

  5. body を request の body とする。

  6. bodybyte sequence である場合、body size をその sequence の length に設定する。そうでなく、bodybody である場合、 body size をその body の length に設定する。

  7. headers size を、requestheaders list[HTTP11] によって義務付けられるとおりに serialized されたときの bytes 単位の size とする。

    注: header compression を許可する protocols については、これは network 上で送信される headers の compressed size である。

  8. headers を空の list とする。

  9. cookies を空の list とする。

  10. requestheaders list 内の各 (name, value) について:

    1. name および valueserialize header した結果を headers に追加する。

    2. name が "Cookie" に対する byte-case-insensitive match である場合:

      1. request に含まれる、user agent の cookie store 内の各 cookie について:

        注: [COOKIES] は、 store 内のどの cookies を request に含められるかについて、いくつかの baseline requirements を定義するが、user agents は追加の constraints を課してもよい。

        1. cookie が与えられたものとして serialize cookie した結果を cookies に追加する。

  11. destinationrequestdestination とする。

  12. initiator typerequestinitiator type とする。

  13. timings を、requestget the fetch timings した結果とする。

  14. network.RequestData production に一致する map を返す。 request field を request id に設定し、url field を url に設定し、method field を method に設定し、 headers field を headers に設定し、cookies field を cookies に設定し、headersSize field を headers size に設定し、 bodySize field を body size に設定し、destination field を destination に設定し、initiatorType field を initiator type に設定し、timings field を timings に設定する。

7.5.4.16. network.ResponseContent 型

Remote end definition および local end definition

network.ResponseContent = {
        size: js-uint
    }
    

network.ResponseContent 型は、network request に対する decoded response を表す。

response が与えられたとき、get the response content info するには。
  1. network.ResponseContent production に一致する新しい map を返す。size field を responseresponse body infodecoded size に設定する

7.5.4.17. network.ResponseData 型

Remote end definition および local end definition

network.ResponseData = {
        url: text,
        protocol: text,
        status: js-uint,
        statusText: text,
        fromCache: bool,
        headers: [*network.Header],
        mimeType: text,
        bytesReceived: js-uint,
        headersSize: js-uint / null,
        bodySize: js-uint / null,
        content: network.ResponseContent,
        ?authChallenges: [*network.AuthChallenge],
    }
    

network.ResponseData 型は、network request に対する response を表す。

response が与えられたとき、get the protocol するには:

  1. protocol を空文字列とする。

  2. responsefinal connection timing info が null でない場合、protocolresponsefinal connection timing infoALPN negotiated protocol に設定する。

  3. protocol が空文字列であるか、または "unknown" と等しい場合:

    1. protocolresponseurlscheme に設定する

    2. protocol が "http" または "https" のいずれかと等しく、かつ response に関連付けられた HTTP Response がある場合。

      注: [FETCH] は、HTTP network response と response object の関係について明確ではない。

      1. http version を HTTP Response の Status line の HTTP-version [HTTP11] とする。

      2. http version が "HTTP/" で始まる場合:

        1. version を、 5 から http versionlength までの http versioncode unit substring とする。

        2. version が "0.9" である場合、protocol を "http/0.9" に設定し、そうでなく version が "1.0" である場合、 protocol を "http/1.0" に設定し、そうでなく version が "1.1" である場合、protocol を "http/1.1" に設定する。

  4. protocol を返す。

response が与えられたとき、get the response data するには:
  1. url を、responseURLURL serializer を実行した結果とする。

  2. protocol を、response が与えられたものとして get the protocol した結果に設定する。

  3. statusresponsestatus とする。

  4. status textresponsestatus message とする。

  5. responsecache state が "local" である場合、 from cache を true とし、そうでなければ false とする。

  6. headers を空の list とする。

  7. mime type を、response に対する computed mime typeessence とする。

    注: これは browser が実際に使用している MIME type であり、 [MIMESNIFF] 仕様の正確な algorithm に従っていない場合でも同様である。

  8. responseheaders list 内の各 (name, value) について:

    1. name および valueserialize header した結果を headers に追加する。

  9. bytes received を、response に関連付けられた HTTP response の一部として transmitted された bytes の総数とする。

  10. headers size を、HTTP response の header fields section の一部として transmitted された bytes の数とする。

  11. body sizeresponseresponse body infoencoded size とする。

  12. content を、responseget the response content info した結果とする。

  13. auth challenges を、 responseextract challenges した結果とする。

  14. network.ResponseData production に一致する map を返す。 url field を url に設定し、protocol field を protocol に設定し、status field を status に設定し、 statusText field を status text に設定し、 fromCache field を from cache に設定し、headers field を headers に設定し、mimeType field を mime type に設定し、 bytesReceived field を bytes received に設定し、 headersSize field を headers size に設定し、 bodySize field を body size に設定し、content field を content に設定し、authChallenges field を auth challenges が null でない場合はそれに設定し、そうでなければ省略する。

7.5.4.18. network.SetCookieHeader 型

Remote end definition

network.SetCookieHeader = {
        name: text,
        value: network.BytesValue,
        ? domain: text,
        ? httpOnly: bool,
        ? expiry: text,
        ? maxAge: js-int,
        ? path: text,
        ? sameSite: network.SameSite,
        ? secure: bool,
    }
    

network.SetCookieHeader は、 Set-Cookie response header 内の data を表す。

integer である input が与えられたとき、serialize an integer するには:

注: これは input の最短表現を decimal digits の string として生成する。

  1. serialized を空文字列とする。

  2. valueinput とする。

  3. value が 0 より大きい間:

    1. xvalue を 10 で割ったものとする。

    2. most significant digitsx の integer part とする。

    3. ymost significant digits に 10 を掛けたものとする。

    4. least significant digitvalue - y とする。

    5. Assert: least significant digit は 0 から 9 までの範囲の integer (両端を含む)である。

    6. codepoint を、value が U+0030 DIGIT ZERO の value + least significant digit である code point とする。

    7. codepointserialized の先頭に付加する。

    8. valuemost significant digits に設定する。

  4. serialized を返す。

protocol cookie が与えられたとき、serialize set-cookie header するには:
  1. name を、protocol cookie["name"] で UTF-8 encode した結果とする。

  2. value を、protocol cookie["value"] で deserialize protocol bytes した結果とする。

  3. header value を、name、 `=`、および value を連結して形成される byte sequence とする。

  4. protocol cookie が "expiry" を含む場合:

    1. attribute を `;Expires=` とする

    2. protocol cookie["expiry"] で UTF-8 encode した結果を attribute に追加する。

    3. attributeheader value に追加する。

  5. protocol cookie が "maxAge" を含む場合:

    1. attribute を `;Max-Age=` とする

    2. max age string を、protocol cookie["maxAge"] で serialize an integer した結果とする。

    3. max age stringUTF-8 encode した結果を attribute に追加する。

    4. attributeheader value に追加する。

  6. protocol cookie が "domain" を含む場合:

    1. attribute を `;Domain=` とする

    2. protocol cookie["domain"] で UTF-8 encode した結果を attribute に追加する。

    3. attributeheader value に追加する。

  7. protocol cookie が "path" を含む場合:

    1. attribute を `;Path=` とする

    2. protocol cookie["path"] で UTF-8 encode した結果を attribute に追加する。

    3. attributeheader value に追加する。

  8. protocol cookie が "secure" を含み、かつ protocol cookie["secure"] が true である場合:

    1. `;Secure` を header value に追加する。

  9. protocol cookie が "httpOnly" を含み、かつ protocol cookie["httpOnly"] が true である場合:

    1. `;HttpOnly` を header value に追加する。

  10. protocol cookie が "sameSite" を含む場合:

    1. attribute を `;SameSite=` とする

    2. protocol cookie["sameSite"] で UTF-8 encode した結果を attribute に追加する。

    3. attributeheader value に追加する。

  11. header value を返す。

7.5.4.19. network.UrlPattern 型

Remote end definition

network.UrlPattern = (
    network.UrlPatternPattern /
    network.UrlPatternString
    )

    network.UrlPatternPattern = {
        type: "pattern",
        ?protocol: text,
        ?hostname: text,
        ?port: text,
        ?pathname: text,
        ?search: text,
    }


    network.UrlPatternString = {
        type: "string",
        pattern: text,
    }

    

network.UrlPattern は、network intercepts の request URL を照合するために使用される pattern を表す。

URL が network.UrlPattern に対して照合されるとき、URL は parse され、各 component は、存在する場合、pattern 内の対応する field と 等価性で比較される。pattern にない fields は常に一致する。

注: この構文は将来の拡張性を 念頭に置いて設計されている。特に、この構文は [URLPattern] 仕様で特別に扱われる文字を禁止する。これらは U+005C (\) 文字を前置することで escape できる。

pattern が与えられたとき、unescape URL pattern するには
  1. forbidden characters を、codepoints «U+0028 ((), U+0029 ()), U+002A (*), U+007B ({), U+007D (})» の set とする

  2. result を空文字列とする。

  3. is escaped character を false とする。

  4. pattern 内の各 codepoint について:

    1. is escaped character が false である場合:

      1. forbidden characterscodepoint含む場合、invalid argumenterror code を持つ error を返す。

      2. codepoint が U+005C (\) である場合:

        1. is escaped character を true に設定する。

        2. 続行する。

    2. codepoint を result に追加する。

    3. is escaped character を false に設定する。

  5. data result とともに success を返す。

pattern が与えられたとき、parse URL pattern するには:
  1. has protocol を true とする。

  2. has hostname を true とする。

  3. has port を true とする。

  4. has pathname を true とする。

  5. has search を true とする。

  6. patternnetwork.UrlPatternPattern production に一致する場合:

    1. pattern url を空文字列とする。

    2. pattern が "protocol" を含む場合:

      1. pattern["protocol"] が空文字列である場合、invalid argumenterror code を持つ error を返す。

      2. protocol を、pattern["protocol"] で unescape URL Pattern することを試みた結果とする。

      3. protocol 内の各 codepoint について:

        1. codepointASCII alphanumeric でなく、かつ «U+002B (+), U+002D (-), U+002E (.)» が codepoint含まない場合:

          1. invalid argument の error code を持つ error を返す。

      4. protocolpattern url に追加する。

    3. そうでなければ:

      1. has protocol を false に設定する。

      2. "http" を pattern url に追加する。

    4. scheme を、pattern urlASCII lowercase した結果とする。

    5. ":" を pattern url に追加する。

    6. schemespecial である場合、"//" を pattern url に追加する。

    7. pattern が "hostname" を含む場合:

      1. pattern["hostname"] が空文字列である場合、invalid argumenterror code を持つ error を返す。

      2. scheme が "file" である場合、 invalid argumenterror code を持つ error を返す。

      3. hostname を、pattern["hostname"] で unescape URL Pattern することを試みた結果とする。

      4. inside brackets を false とする。

      5. hostname 内の各 codepoint について:

        1. «U+002F (/), U+003F (?), U+0023 (#)» が codepoint含む場合:

          1. invalid argumenterror code を持つ error を返す。

        2. inside brackets が false であり、かつ codepoint が U+003A (:) である場合:

          1. invalid argumenterror code を持つ error を返す。

        3. codepoint が U+005B ([) である場合、inside brackets を true に設定する。

        4. codepoint が U+005D (]) である場合、inside brackets を false に設定する。

      6. hostnamepattern url に追加する。

    8. そうでなければ:

      1. scheme が "file" でない場合、 "placeholder" を pattern url に追加する。

      2. has hostname を false に設定する。

    9. pattern が "port" を含む場合:

      1. pattern["port"] が空文字列である場合、invalid argumenterror code を持つ error を返す。

      2. port を、pattern["port"] で unescape URL Pattern することを試みた結果とする。

      3. ":" を pattern url に追加する。

      4. port 内の各 codepoint について:

        1. codepointASCII digit でない場合:

          1. invalid argumenterror code を持つ error を返す。

      5. portpattern url に追加する。

    10. そうでなければ:

      1. has port を false に設定する。

    11. pattern が "pathname" を含む場合:

      1. pathname を、 pattern["pathname"] で unescape URL Pattern することを試みた結果とする。

      2. pathname が U+002F (/) で始まらない場合、 "/" を pattern url に追加する。

      3. pathname 内の各 codepoint について:

        1. «U+003F (?), U+0023 (#)» が codepoint含む場合:

          1. invalid argumenterror code を持つ error を返す。

      4. pathnamepattern url に追加する。

    12. そうでなければ:

      1. has pathname を false に設定する。

    13. pattern が "search" を含む場合:

      1. search を、 pattern["search"] で unescape URL pattern することを試みた結果とする。

      2. search が U+003F (?) で始まらない場合、 "?" を pattern url に追加する。

      3. search 内の各 codepoint について:

        1. codepoint が U+0023 (#) である場合:

          1. invalid argumenterror code を持つ error を返す。

      4. searchpattern url に追加する。

    14. そうでなければ:

      1. has search を false に設定する。

  7. そうでなく、patternnetwork.UrlPatternString production に一致する場合:

    1. pattern url を、 pattern["pattern"] で unescape URL pattern することを試みた結果とする。

  8. url を、pattern urlparseした結果とする。

  9. url が failure である場合、invalid argumenterror code を持つ error を返す。

  10. parsed を、次の fields を持つ struct とする:

    protocol
    has protocol が true である場合は urlscheme、そうでなければ null。
    hostname
    has hostname が true である場合は urlhost、そうでなければ null。
    port
    1. has port が false である場合:

      1. null。

    2. そうでなければ:

      1. urlschemespecial であり、かつ urlschemedefault port が null でなく、かつ urlport が null であるか、または schemedefault port と等しい場合:

        1. 空文字列。

      2. そうでなく、urlport が null でない場合:

        1. urlportSerialize an integer する。

      3. そうでなければ:

        1. null。

    pathname
    1. has pathname が false である場合:

      1. null。

    2. そうでなければ:

      1. urlpath が空文字列でなく、かつ でない場合は、 urlURL path serializer を実行した結果、 そうでなければ null。

    search
    1. has search が false である場合:

      1. null。

    2. そうでなければ:

      1. urlquery が null である場合は空文字列、 そうでなければ urlquery

  11. data parsed とともに success を返す。

url pattern および url string が与えられたとき、 match URL pattern するには:
  1. url を、url stringparseした結果とする。

  2. url pattern の protocol が null でなく、かつ urlscheme と等しくない場合、false を返す。

  3. url pattern の hostname が null でなく、かつ urlhost と等しくない場合、false を返す。

  4. url pattern の port が null でない場合:

    1. port を null とする。

    2. urlschemespecial であり、かつ urlschemedefault port が null でなく、かつ urlport が null であるか、または schemedefault port と等しい場合:

      1. port を空文字列に設定する。

    3. そうでなく、urlport が null でない場合:

      1. port を、urlportserialize an integer した結果に設定する。

    4. url pattern の port が port と等しくない場合、false を返す。

  5. url pattern の pathname が null でなく、かつ urlURL path serializer を実行した結果と等しくない場合、false を返す。

  6. url pattern の search が null でない場合:

    1. url queryurlquery とする。

    2. url query が null である場合、url query を空文字列に設定する。

    3. url pattern の search が url query と等しくない場合、false を返す。

  7. true を返す。

7.5.5. コマンド

7.5.5.1. network.addDataCollector コマンド

network.addDataCollectorcollector を追加する。

コマンド型
network.AddDataCollector = (
    method: "network.addDataCollector",
    params: network.AddDataCollectorParameters
    )

    network.AddDataCollectorParameters = {
    dataTypes: [+network.DataType],
    maxEncodedDataSize: js-uint,
    ? collectorType: network.CollectorType .default "blob",
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }
    
返却型
network.AddDataCollectorResult = {
    collector: network.Collector
    }
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. collector idUUID の文字列表現とする。

  2. input context ids を空の set とする。

  3. command parameterscontexts field が存在する場合、 input context idscommand parameters[contexts] で create a set したものに設定する。

  4. data typescommand parameters["dataTypes"] で create a set したものとする。

  5. max encoded item sizecommand parameters ["maxEncodedDataSize"] とする。

    注: maxEncodedDataSize parameter は max encoded item size を表し、 指定された collector によって収集される各 request の size を制限するものであり、 collector 全体の collected size を制限するものではない。

    注: 実装ごとに異なる encodings を サポートする可能性があり、これは encoded size が browsers 間で異なり得ることを意味する。したがって、同じ data collector configuration であっても、一部の network data が max encoded item size に収まるのは、 一部の実装だけである場合がある。

  6. collector typecommand parameters ["collectorType"] とする。

  7. input user context ids を空の set とする。

  8. command parametersuserContexts field が存在する場合、 input user context idscommand parameters[userContexts] で create a set したものに設定する。

  9. input user context ids が空でなく、かつ input context ids が 空でない場合、invalid argumenterror code を持つ error を返す。

  10. max encoded item size が 0 であるか、または max encoded item sizemax total collected size より大きい場合、 invalid argumenterror code を持つ error を返す。

  11. input context idsempty でない場合:

    1. navigables を、input context idsget valid navigables by ids することを試みた結果とする。

    2. navigables 内の各 navigable について:

      1. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

  12. そうでなく、input user context idsempty でない場合:

    1. input user context ids user context id について:

      1. user context を、user context idget user context した結果とする。

      2. user context が null である場合、no such user contexterror code を持つ error を返す。

  13. collector を、次の field を持つ collector とする: max encoded item size field は max encoded item size に設定され、 data types field は data types に設定され、 collector field は collector id に設定され、 collector type field は collector type に設定され、 contexts field は input context ids に設定され、 user contexts field は input user context ids に設定される。

  14. sessionnetwork collectors[collector id] を collector に設定する。

  15. collector field が collector id に設定された network.AddDataCollectorResult production に一致する 新しい map を返す。

7.5.5.2. network.addIntercept コマンド

network.addIntercept command は network intercept を追加する。

コマンド型
network.AddIntercept = (
    method: "network.addIntercept",
    params: network.AddInterceptParameters
    )

    network.AddInterceptParameters = {
    phases: [+network.InterceptPhase],
    ? contexts: [+browsingContext.BrowsingContext],
    ? urlPatterns: [*network.UrlPattern],
    }

    network.InterceptPhase = "beforeRequestSent" / "responseStarted" /
                            "authRequired"
    
返却型
network.AddInterceptResult = {
    intercept: network.Intercept
    }
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. interceptUUID の文字列表現とする。

  2. url patterns を、存在する場合は command parametersurlPatterns field とし、そうでなければ空の list とする。

  3. navigables を null とする。

  4. command parameterscontexts field が存在する場合:

    1. navigables を空の set に設定する。

    2. command parameters["contexts"] の各 navigable id について

      1. navigable を、navigable idget a navigable することを試みた結果とする。

      2. navigabletop-level traversable でない場合、 invalid argumenterror code を持つ error を返す。

      3. navigablenavigables に追加する。

    3. navigables が空の set である場合、 invalid argumenterror code を持つ error を返す。

  5. intercept mapsessionintercept map とする。

  6. parsed patterns を空の list とする。

  7. url patterns 内の各 url pattern について:

    1. parsed を、 url patternparse url pattern することを試みた結果とする。

    2. Append parsedparsed patterns に。

  8. intercept map[intercept] を、 url patterns parsed patternsphases command parameters["phases"]、および browsingContexts navigables を持つ struct に設定する。

  9. intercept field が intercept に設定された network.AddInterceptResult production に一致する 新しい map を返す。

7.5.5.3. network.continueRequest コマンド

network.continueRequest command は、 network intercept によって block されている request を続行する。

コマンド型
network.ContinueRequest = (
    method: "network.continueRequest",
    params: network.ContinueRequestParameters
    )

    network.ContinueRequestParameters = {
    request: network.Request,
    ?body: network.BytesValue,
    ?cookies: [*network.CookieHeader],
    ?headers: [*network.Header],
    ?method: text,
    ?url: text,
    }
    
返却型
network.ContinueRequestResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. blocked requestssessionblocked request map とする。

  2. request idcommand parameters["request"] とする。

  3. blocked requestsrequest idcontain しない場合、 no such requesterror code を持つ error を返す。

  4. (request, phase, response) を blocked requests[request id] とする。

  5. phase が "beforeRequestSent" でない場合、 invalid argumenterror code を持つ error を返す。

    "request already sent" error を検討する。

  6. command parameters が "url" をcontains する場合:

    1. url record を、base URL null で、 command parameters["url"] に URL parser を適用した結果とする。

    2. url record が failure である場合、invalid argumenterror code を持つ error を返す。

      TODO: ここでも resume すべきか?

    3. requesturlurl record とする。

  7. command parameters が "method" をcontains する場合:

    1. methodcommand parameters["method"] とする。

    2. methodmethod token production に一致しない場合、 "invalid argument" の error code を持つ error を返す。

    3. requestmethodmethod とする。

  8. command parameters が "headers" をcontains する場合:

    1. headers を空の header list とする。

    2. command parameters["headers"] 内の header について:

      1. deserialized headerheaderdeserialize header した結果とする。

      2. deserialized header の name が field-name token production に一致しない場合、 "invalid argument" の error code を持つ error を返す。

      3. deserialized header の value が header value production に一致しない場合、 "invalid argument" の error code を持つ error を返す。

      4. deserialized headerheaders に追加する。

    3. requestheaders listheaders に設定する。

  9. command parameters が "cookies" をcontains する場合:

    1. cookie header を空の byte sequence とする。

    2. command parameters["cookies"] 内の各 cookie について:

      1. cookie header が空でない場合、`;` を cookie header に追加する。

      2. cookieserialize cookie header した結果を cookie header に追加する。

    3. found cookie header を false とする。

    4. requestheaders list 内の各 header について:

      1. nameheader の name とする。

      2. byte-lowercase name が `cookie` である場合:

        1. header の value を cookie header に設定する。

        2. found cookie header を true に設定する。

        3. 中断する。

    5. found cookie header が false である場合:

      1. header (`Cookie`, cookie header) を requestheaders list に追加する。

  10. command parameters が "body" をcontains する場合:

    1. bodycommand parameters["body"] で deserialize protocol bytes した結果とする。

    2. requestbodybody に設定する。

  11. "continue request"、request id、および (null, "incomplete") で Resume する。

  12. data null とともに success を返す。

7.5.5.4. network.continueResponse コマンド

network.continueResponse command は、 network intercept によって block されている response を続行する。これは responseStarted phase で呼び出して、response の status および headers を 変更しつつ、network response body は引き続き提供できる。

コマンド型
network.ContinueResponse = (
    method: "network.continueResponse",
    params: network.ContinueResponseParameters
    )

    network.ContinueResponseParameters = {
    request: network.Request,
    ?cookies: [*network.SetCookieHeader]
    ?credentials: network.AuthCredentials,
    ?headers: [*network.Header],
    ?reasonPhrase: text,
    ?statusCode: js-uint,
    }
    
返却型
network.ContinueResponseResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. request idcommand parameters["request"] とする。

  2. response を、 session、"continueResponse"、および command parametersupdate the response することを試みた結果とする。

  3. "continue request"、request id、および (response, "incomplete") で Resume する。

  4. data null とともに success を返す。

7.5.5.5. network.continueWithAuth コマンド

network.continueWithAuth command は、 authRequired phase で network intercept によって block されている response を続行する。

コマンド型
network.ContinueWithAuth = (
    method: "network.continueWithAuth",
    params: network.ContinueWithAuthParameters
    )

    network.ContinueWithAuthParameters = {
    request: network.Request,
    (network.ContinueWithAuthCredentials // network.ContinueWithAuthNoCredentials)
    }

    network.ContinueWithAuthCredentials = (
    action: "provideCredentials", 
    credentials: network.AuthCredentials
    )

    network.ContinueWithAuthNoCredentials = (
    action: "default" / "cancel"
    )
    
返却型
network.ContinueWithAuthResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. blocked requestssessionblocked request map とする。

  2. request idcommand parameters["request"] とする。

  3. blocked requestsrequest idcontain しない場合、 no such requesterror code を持つ error を返す。

  4. (request, phase, response) を blocked requests[request id] とする。

  5. phase が "authRequired" でない場合、 invalid argumenterror code を持つ error を返す。

  6. command parameters "action" が "cancel" である場合、 response の authentication credentials を "cancelled" に設定する。

  7. command parameters "action" が "provideCredentials" である場合:

    1. credentialscommand parameters["credentials"] とする。

    2. Assert: credentials["type"] は "password" である。

    3. response の authentication credentials を (credentials["username"], credentials["password"]) に設定する

  8. "continue request"、request id、および (response, "incomplete") で Resume する。

  9. data null とともに success を返す。

7.5.5.6. network.disownData コマンド

network.disownData command は、指定された collector に対する collected network data を解放する。

コマンド型
network.DisownData = (
    method: "network.disownData",
    params: network.DisownDataParameters
    )

    network.DisownDataParameters = {
    dataType: network.DataType,
    collector: network.Collector,
    request: network.Request,
    }
    
返却型
network.DisownDataResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. data typecommand parameters 内の "dataType" field の value とする。

  2. collector idcommand parameters 内の "collector" field の value とする。

  3. request idcommand parameters 内の "request" field の value とする。

  4. collectorssessionnetwork collectors とする。

  5. collectorscollector idcontain しない場合、 no such network collectorerror code を持つ error を返す。

  6. collected data を、request id および data typeget collected data した結果とする。

  7. collected data が null である場合、 no such network dataerror code を持つ error を返す。

  8. collected data および collector idRemove collector from data する。

  9. data null とともに success を返す。

7.5.5.7. network.failRequest コマンド

network.failRequest command は、 network intercept によって block されている fetch を失敗させる。

コマンド型
network.FailRequest = (
    method: "network.failRequest",
    params: network.FailRequestParameters
    )

    network.FailRequestParameters = {
    request: network.Request,
    }
    
返却型
network.FailRequestResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. blocked requestssessionblocked request map とする。

  2. request idcommand parameters["request"] とする。

  3. blocked requestsrequest idcontain しない場合、 no such requesterror code を持つ error を返す。

  4. (request, phase, response) を blocked requests[request id] とする。

  5. phase が "authRequired" である場合、 invalid argumenterror code を持つ error を返す。

  6. response を新しい network error とする。

    error の正確な種類を設定できるようにする [Issue #508]

  7. "continue request"、request id、および (response, "complete") で Resume する。

  8. data null とともに success を返す。

7.5.5.8. network.getData コマンド

network.getData コマンドは、利用可能であれば ネットワークデータを取得する。

コマンド型
network.GetData = (
    method: "network.getData",
    params: network.GetDataParameters
    )

    network.GetDataParameters = {
    dataType: network.DataType,
    ? collector: network.Collector,
    ? disown: bool .default false,
    request: network.Request,
    }
    
戻り値型
network.GetDataResult = {
    bytes: network.BytesValue,
    }
    
session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. data typecommand parameters["dataType"] とする。

  2. request idcommand parameters["request"] とする。

  3. collector id を null とする。

  4. command parameters が "collector" を 含む 場合:

    1. collectorssessionnetwork collectors とする。

    2. collectorscollector id含まない 場合、 errorerror code no such network collector 付きで返す。

    3. collector idcommand parameters["collector"] に設定する。

  5. disowncommand parameters["disown"] とする。

  6. disown が true かつ collector id が null である場合、errorerror code invalid argument 付きで返す。

  7. collected data を、request id および data type が与えられた get collected data とする。

  8. collected data が null である場合:

    1. errorerror code no such network data 付きで返す。

  9. collected datapending が true である場合:

    1. "network data collected" および (request id, data type) で Await する。

  10. collector id が null でなく、かつ collected datacollectorscollector id含まない 場合:

    1. errorerror code no such network data 付きで返す。

  11. bytescollected databytes とする。

  12. bytes が null である場合、

    1. errorerror code unavailable network data 付きで返す。

  13. body を、network.GetDataResult 生成規則に一致する map で、bytes フィールドを bytes に設定したものとする。

  14. disown が true である場合、collected data および collector idremove collector from data を実行する。

  15. success をデータ body 付きで返す。

7.5.5.9. network.provideResponse コマンド

network.provideResponse コマンドは、 network intercept によってブロックされた request を、完全な response を提供することにより継続する。

注: これは、request が通常の request ライフサイクルを通過し、それに伴って他のイベントを発行することを防がない。

コマンド型
network.ProvideResponse = (
    method: "network.provideResponse",
    params: network.ProvideResponseParameters
    )

    network.ProvideResponseParameters = {
    request: network.Request,
    ?body: network.BytesValue,
    ?cookies: [*network.SetCookieHeader],
    ?headers: [*network.Header],
    ?reasonPhrase: text,
    ?statusCode: js-uint,
    }
    
戻り値型
network.ProvideResponseResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. request idcommand parameters["request"] とする。

  2. response を、 session, "provideResponse", および command parameterstrying to update the response した結果とする。

  3. command parameters が "body" を 含む 場合:

    1. body を、 command parameters["body"] で deserialize protocol bytes したものとする。

    2. responsebodybody as a body に設定する。

  4. "continue request", request id, および (response,"complete") で Resume する。

  5. success をデータ null 付きで返す。

7.5.5.10. network.removeDataCollector コマンド

network.removeDataCollector コマンドは collector を削除する。

コマンド型
network.RemoveDataCollector = (
    method: "network.removeDataCollector",
    params: network.RemoveDataCollectorParameters
    )

    network.RemoveDataCollectorParameters = {
    collector: network.Collector
    }
    
戻り値型
network.RemoveDataCollectorResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. collector idcommand parameters 内の "collector" フィールドの値とする。

  2. collectorssessionnetwork collectors とする。

  3. collectorscollector id含まない 場合、 errorerror code no such network collector 付きで返す。

  4. collector idsessionnetwork collectors から Remove する。

  5. collected network data 内の各 collected data について、collected data および collector idremove collector from data を実行する。

  6. success をデータ null 付きで返す。

7.5.5.11. network.removeIntercept コマンド

network.removeIntercept コマンドは network intercept を削除する。

コマンド型
network.RemoveIntercept = (
    method: "network.removeIntercept",
    params: network.RemoveInterceptParameters
    )

    network.RemoveInterceptParameters = {
    intercept: network.Intercept
    }
    
戻り値型
network.RemoveInterceptResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. interceptcommand parameters 内の "intercept" フィールドの値とする。

  2. intercept mapsessionintercept map とする。

  3. intercept mapintercept含まない 場合、 errorerror code no such intercept 付きで返す。

  4. interceptintercept map から Remove する。

注: intercept の削除は、この intercept によって すでにブロックされている request には影響しない。影響を受けるのは将来の request、 または既存 request の将来のフェーズのみである。

  1. success をデータ null 付きで返す。

7.5.5.12. network.setCacheBehavior コマンド

network.setCacheBehavior コマンドは、 特定の request に対するネットワークキャッシュの動作を構成する。

コマンド型
network.SetCacheBehavior = (
    method: "network.setCacheBehavior",
    params: network.SetCacheBehaviorParameters
    )

    network.SetCacheBehaviorParameters = {
    cacheBehavior: "default" / "bypass",
    ? contexts: [+browsingContext.BrowsingContext]
    }
    
戻り値型
network.SetCacheBehaviorResult = EmptyResult
    
WebDriver BiDi cache behavior 手順は、request request が与えられたとき、次のとおりである:
  1. navigable を null とする。

  2. requestclientenvironment settings object である場合:

    1. environment settingsrequestclient とする。

    2. environment settingsglobal objectactive window である navigable が存在する場合、 navigable をその navigable の top-level traversable に設定する。

  3. navigable が null でなく、かつ navigable cache behavior mapnavigable含む 場合、navigable cache behavior map[navigable] を返す。

  4. default cache behavior を返す。

navigable cache behavior 手順は、navigable が与えられたとき、次のとおりである:
  1. top-level navigablenavigabletop-level traversable とする。

  2. navigable cache behavior maptop-level navigable含む 場合、 navigable cache behavior map[top-level navigable] を返す。

  3. default cache behavior を返す。

session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. behaviorcommand parameters["cacheBehavior"] とする。

  2. command parameters が "contexts" を 含まない 場合:

    1. default cache behaviorbehavior に設定する。

    2. navigable cache behavior mapClear する。

    3. behavior の値について分岐する:

      "bypass"
      実装固有の resource cache を無効化する、実装定義の手順を実行する。
      "default"
      現在の remote end 構成で通常有効になっている 実装固有の resource cache を有効化する、実装定義の手順を実行する。
    4. success をデータ null 付きで返す。

  3. navigables を空の set とする。

  4. command parameters["contexts"] の各 navigable id について:

    1. context を、 navigable idtrying to get a navigable した結果とする。

    2. contexttop-level browsing context でない場合、 errorerror code invalid argument 付きで返す。

    3. contextnavigablesAppend する。

  5. navigables 内の各 navigable について:

    1. navigable cache behavior mapnavigable含み、かつ navigable cache behavior map[navigable] が behavior と等しい場合、 continue する。

    2. behavior の値について分岐する:

      "bypass"
      navigabletop-level browsing context である任意の browsing context から発生したネットワーク request について、実装固有の resource cache を無効化する実装定義の手順を実行する。
      "default"
      navigabletop-level browsing context である任意の browsing context から発生したネットワーク request について、現在の remote end 構成で通常有効になっている 実装固有の resource cache を有効化する、実装定義の手順を実行する。
    3. behaviordefault cache behavior と等しい場合:

      1. navigable cache behavior mapnavigable含む 場合、 navigable cache behavior map[navigable] を remove する。

    4. そうでなければ:

      1. navigable cache behavior map[navigable] を behavior に設定する。

  6. success をデータ null 付きで返す。

7.5.5.13. network.setExtraHeaders コマンド

network.setExtraHeaders コマンドは、 既存の request header を拡張または上書きする header の指定を可能にする。

コマンド型
network.SetExtraHeaders = (
    method: "network.setExtraHeaders",
    params: network.SetExtraHeadersParameters
    )

    network.SetExtraHeadersParameters = {
    headers: [*network.Header]
    ? contexts: [+browsingContext.BrowsingContext]
    ? userContexts: [+browser.UserContext]
    }
    
戻り値型
network.SetExtraHeadersResult = EmptyResult
    
request および headers が与えられたとき、 update headers するには:
  1. request headersrequestheader list とする。

  2. headers 内の各 header について:

    1. request headers 内で headerSet する。

      注: これは、既存の値がある場合には常に それを上書きする。特に、既存の `Set-Cookie` header に cookie を追加しない。

session, request, および related navigables が与えられたとき、 update request headers するには:
  1. Assert: related navigablessize は 0 または 1 である。

    注: これは、複数の navigable に関連付けられた worker では機能しないことを意味する。その場合、どの順序で header を上書きするかが明確でない。

  2. request および sessionextra headersdefault headersUpdate headers する。

  3. user context headerssessionextra headersuser context headers とする。

  4. related navigables 内の navigable について:

    1. user contextnavigableassociated user context とする。

    2. user context headersuser context含む 場合、 request および user context headers[user context] で update headers する。

  5. navigable headerssessionextra headersnavigable headers とする。

  6. related navigables 内の navigable について:

    1. top-level traversablenavigabletop-level traversable とする。

    2. navigable headerstop-level traversable を含む場合、 request および navigable headers[top-level traversable] で update headers する。

session および command parameters が与えられたときの remote end steps は、次のとおりである:
  1. command parameters が "userContexts" を 含み、 かつ command parameters が "contexts" を 含む 場合、 errorerror code invalid argument 付きで返す。

  2. headers を、 command parameters["headers"] で trying to create a headers list した結果とする。

  3. command parameters が "userContexts" を 含む 場合:

    1. user contexts を空の list とする。

    2. command parameters["userContexts"] 内の user context id について:

      1. user contextuser context idget user context したものとする。

      2. user context が null である場合、errorerror code no such user context 付きで返す。

      3. user contextuser contextsAppend する。

    3. targetsessionextra headersuser context headers とする。

    4. user contexts 内の user context について:

      1. target[user context] を headers に設定する。

    5. success をデータ null 付きで返す。

  4. command parameters が "contexts" を 含む 場合:

    1. navigables を、 command parameters["contexts"] で trying to get valid top-level traversables by ids した結果とする。

    2. targetsessionextra headersnavigable headers とする。

    3. navigables 内の navigable について:

      1. target[navigable] を headers に設定する。

    4. success をデータ null 付きで返す。

  5. sessionextra headersdefault headersheaders に設定する。

  6. success をデータ null 付きで返す。

7.5.6. イベント

7.5.6.1. network.authRequired イベント
イベント型
network.AuthRequired = (
    method: "network.authRequired",
    params: network.AuthRequiredParameters
    )

    network.AuthRequiredParameters = {
    network.BaseParameters,
    response: network.ResponseData
    }
    

このイベントは、ユーザーエージェントが認可資格情報の入力を求めようとしているときに 発火される。

remote end event trigger は、request request および response response が与えられたときの、WebDriver BiDi auth required 手順である:
  1. redirect countrequestredirect count とする。

  2. Assert: before request sent map[request] は redirect count と等しい。

    注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。

  3. requestclient が null でない場合、related navigables を、requestclientget related navigables した結果とする。そうでなければ related navigables を空の set とする。

  4. "network.authRequired" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:

    1. params を、session、 "network.authRequired"、および requestprocess a network event した結果とする。

    2. response data を、responseget the response data した結果とする。

    3. Assert: response data は "authChallenge" を contains する。

    4. paramsresponse フィールドを response data に設定する。

    5. Assert: paramsnetwork.AuthRequiredParameters production に一致する。

    6. body を、params フィールドを params に設定した、 network.AuthRequired production に一致する map とする。

    7. session および bodyEmit an event する。

    8. params["isBlocked"] が true の場合:

      1. blocked requestssessionblocked request map とする。

      2. request idrequestrequest id とする。

      3. blocked requests[request id] を (request, "authRequired", response) に設定する。

      4. «"continue request"» および request idAwait する。

      5. blocked requests[request id] を Remove する。

7.5.6.2. network.beforeRequestSent イベント
イベント型
network.BeforeRequestSent = (
    method: "network.beforeRequestSent",
    params: network.BeforeRequestSentParameters
    )

    network.BeforeRequestSentParameters = {
    network.BaseParameters,
    ? initiator: network.Initiator,
    }
    

このイベントは、リクエストが(ネットワーク経由で、または serviceworker やローカルキャッシュによって 処理される前に)送信される前に発火される。

request および user context が与えられたとき、request originates in user context かどうかを確認する手順は:
  1. settingsrequestclient とする。

  2. related navigables を、settingsget related navigables したものとする。

  3. related navigables 内の navigable について:

    1. navigableassociated user contextuser context である場合、true を返す。

  4. false を返す。

related navigables が与えられたとき、get emulated network conditions する手順は:
  1. related navigables の各 navigable について:

    1. top-level traversablenavigabletop-level traversable とする。

    2. user contexttop-level traversableassociated user context とする。

    3. active BiDi sessions 内の各 session について:

      1. sessionemulated network conditionsnavigable network conditionstop-level traversablecontains する場合、 sessionemulated network conditionsnavigable network conditions[top-level traversable] を返す。

    4. active BiDi sessions 内の各 session について:

      1. sessionemulated network conditionsuser context network conditionsuser contextcontains する場合、 sessionemulated network conditionsuser context network conditions[user context] を返す。

    5. active BiDi sessions 内の各 session について:

      1. sessionemulated network conditionsdefault network conditions が null でない場合、 sessionemulated network conditionsdefault network conditions を返す。

  2. null を返す。

environment settings object settings が与えられたときの WebDriver BiDi network is offline 手順は:
  1. navigable を、settingsrelevant global objectassociated Documentnode navigable とする。

  2. emulated network conditions を、 [navigable] で get emulated network conditions した結果とする。

  3. emulated network conditions が null でなく、かつ emulated network conditionsoffline が true の場合、true を返す。

  4. false を返す。

remote end event trigger は、request request が与えられたときの WebDriver BiDi before request sent 手順である:
  1. set of user contexts 内の各 user context について:

    1. request および user context での request originates in user context 手順が true を返す場合:

      1. active BiDi sessions 内の各 session について:

        注: user context は、複数の user context to accept insecure certificates override map に属することはできない。

        1. sessionuser context to accept insecure certificates override mapuser contextcontains する場合:

          1. accept insecure certificatessessionuser context to accept insecure certificates override map[user context] とする。

          2. accept insecure certificates が true の場合:

            1. Assert endpoint node は、安全でない TLS 接続の受け入れをサポートする。

            2. request について Basic Certificate Processing 手順を実行するとき、 ステップ a を、その他のあらゆる実装定義の証明書検証手順とともにスキップする。

          3. そうでなければ、request について Basic Certificate Processing 手順を実行するとき、あらゆる実装定義の 証明書検証手順とともに、すべてのステップを実行する。

        注: user context は、複数の user context to proxy configuration map に属することはできない。

        1. sessionuser context to proxy configuration mapuser contextcontains する場合:

          1. proxy configurationsessionuser context to proxy configuration map[user context] とする。

          2. requestproxy configuration により定義されるプロキシ設定を使用することを保証するために、 実装定義の手順を実行する。

            注: 設定はユーザーコンテキストが作成されるときに検証されるため、 この段階では有効であると想定される。プロキシへのアクセス中に発生したエラーは、 リクエストの処理時にネットワークエラーとして報告される。

  2. requestMaybe collect network request body する。

  3. before request sent maprequest を含まない場合、before request sent map[request] を 新しい set に設定する。

  4. redirect countrequestredirect count とする。

  5. before request sent map[request] に redirect count を追加する。

  6. requestclient が null でない場合、related navigables を、requestclientget related navigables した結果とする。そうでなければ related navigables を空の set とする。

  7. response を null とする。

  8. response status を "incomplete" とする。

  9. active BiDi sessions 内の各 session について:

    1. sessionrequest および related navigablesUpdate request headers する。

  10. "network.beforeRequestSent" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:

    1. params を、session、 "network.beforeRequestSent"、および requestprocess a network event した結果とする。

    2. initiator を、requestget the initiator した結果とする。

    3. initiatorempty でない場合、paramsinitiator フィールド を initiator に設定する。

    4. Assert: paramsnetwork.BeforeRequestSentParameters production に一致する。

    5. body を、params フィールドを params に設定した、 network.BeforeRequestSent production に一致する map とする。

    6. session および bodyEmit an event する。

    7. params["isBlocked"] が true の場合:

      1. blocked requestssessionblocked request map とする。

      2. request idrequestrequest id とする。

      3. blocked requests[request id] を (request, "beforeRequestSent", null) に設定する。

      4. (response, status) を、«"continue request"» および requestrequest idawait したものとする。

      5. status が "complete" の場合、response statusstatus に設定する。

      6. blocked requests[request id] を Remove する。

      注: 待機中、リクエストのさらなる処理は行われない。

  11. emulated network conditions を、 related navigablesget emulated network conditions した結果とする。

  12. emulated network conditions が null でなく、かつ emulated network conditionsoffline が true の場合、(network error, "complete") を返す。

  13. (response, response status) を返す。

Fetch の "HTTP-network-or-cache fetch" アルゴリズムにおける 返り値を尊重する。

7.5.6.3. network.fetchError イベント
イベント型
network.FetchError = (
    method: "network.fetchError",
    params: network.FetchErrorParameters
    )

    network.FetchErrorParameters = {
    network.BaseParameters,
    errorText: text,
    }
    

このイベントは、ネットワークリクエストがエラーで終了したときに発火される。

remote end event trigger は、request request が与えられたときの WebDriver BiDi fetch error 手順である:
  1. before request sent map[request] が requestredirect count を含まない場合、requestWebDriver BiDi before request sent 手順を実行する。

    注: これにより、呼び出し元がすべてのエラーパスで WebDriver BiDi before request sent 手順を明示的に呼び出す必要なく、network.fetchError の前に network.beforeRequestSent が常に発火され得ることが保証される。

  2. requestclient が null でない場合、related navigablesrequestclientget related navigables した結果とする。そうでなければ related navigables を空の set とする。

  3. requestMaybe abort network response body collection する。

  4. "network.fetchError" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:

    1. params を、session、 "network.fetchError"、および requestprocess a network event した結果とする。

    2. paramserrorText フィールドを、リクエストを中止させたエラーを説明する 実装定義の文字列に設定する。

    3. Assert: paramsnetwork.FetchErrorParameters production に一致する。

    4. body を、params フィールドを params に設定した、 network.FetchError production に一致する map とする。

    5. session および bodyEmit an event する。

7.5.6.4. network.responseCompleted イベント
イベント型
network.ResponseCompleted = (
    method: "network.responseCompleted",
    params: network.ResponseCompletedParameters
    )

    network.ResponseCompletedParameters = {
    network.BaseParameters,
    response: network.ResponseData,
    }
    

このイベントは、完全なレスポンスボディが受信された後に発火される。

remote end event trigger は、request request および response response が与えられたときの WebDriver BiDi response completed 手順である:
  1. redirect countrequestredirect count とする。

  2. Assert: before request sent map[request] は redirect count を含む。

    注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。

  3. requestclient が null でない場合、related navigablesrequestclientget related navigables した結果とする。そうでなければ related navigables を空の set とする。

  4. request および responseMaybe collect network response body する。

  5. sessions を、"network.responseCompleted" および related navigables が与えられたときの set of sessions for which an event is enabled とする。

  6. sessions 内の各 session について:

    1. params を、session、 "network.responseCompleted"、および requestprocess a network event した結果とする。

    2. Assert: params["isBlocked"] は false である。

    3. response data を、responseget the response data した結果とする。

    4. paramsresponse フィールドを response data に設定する。

    5. Assert: paramsnetwork.ResponseCompletedParameters production に一致する。

    6. body を、params フィールドを params に設定した、 network.ResponseCompleted production に一致する map とする。

    7. session および bodyEmit an event する。

7.5.6.5. network.responseStarted イベント
イベント型
network.ResponseStarted = (
    method: "network.responseStarted",
    params: network.ResponseStartedParameters
    )

    network.ResponseStartedParameters = {
    network.BaseParameters,
    response: network.ResponseData,
    }
    

このイベントは、レスポンスヘッダーが受信された後、ただし body が完了する前に発火される。

remote end event trigger は、request request および response response が与えられたときの WebDriver BiDi response started 手順である:
  1. redirect countrequestredirect count とする。

  2. Assert: before request sent map[request] は redirect count と等しい。

    注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。

  3. requestclient が null でない場合、related navigablesrequestclientget related navigables した結果とする。そうでなければ related navigables を空の set とする。

  4. response status を "incomplete" とする。

  5. sessions を、"network.responseStarted" および related navigables が与えられたときの set of sessions for which an event is enabled とする。

  6. sessions 内の各 session について:

    1. params を、session、 "network.responseStarted"、および requestprocess a network event した結果とする。

    2. response data を、responseget the response data した結果とする。

    3. paramsresponse フィールドを response data に設定する。

    4. Assert: paramsnetwork.ResponseStartedParameters production に一致する。

    5. body を、params フィールドを params に設定した、 network.ResponseStarted production に一致する map とする。

    6. session および bodyEmit an event する。

    7. params["isBlocked"] が true の場合:

      1. blocked requestssessionblocked request map とする。

      2. request idrequestrequest id とする。

      3. blocked requests[request id] を (request, "beforeRequestSent", response) に設定する。

      4. (response, status) を、 «"continue request"» および request idawait したものとする。

      5. status が "complete" の場合、response statusstatus に設定する。

      6. blocked requests[request id] を Remove する。

  7. (response, response status) を返す。

7.6. script モジュール

script モジュールは、script レルムおよび実行に関連するコマンドとイベントを含む。

7.6.1. 定義

remote end 定義

ScriptCommand = (
    script.AddPreloadScript //
    script.CallFunction //
    script.Disown //
    script.Evaluate //
    script.GetRealms //
    script.RemovePreloadScript
    )
    

local end 定義

ScriptResult = (
    script.AddPreloadScriptResult /
    script.CallFunctionResult /
    script.DisownResult /
    script.EvaluateResult /
    script.GetRealmsResult /
    script.RemovePreloadScriptResult
    )

    ScriptEvent = (
    script.Message //
    script.RealmCreated //
    script.RealmDestroyed
    )
    

7.6.2. プリロードスクリプト

プリロードスクリプト は、新しい Window の作成時、作者定義の script が実行される前に実行されるものである。

TODO: これを他の種類のレルム内の script に拡張する。

BiDi sessionpreload script map を持つ。これは、キーが UUID であり、値が 文字列である function declaration という名前の item、 list である arguments という名前の item、 list または null である contexts という名前の item、 文字列または null である sandbox という名前の item、 および set である user contexts という名前の item を持つ structs である map である。

注: preload script の実行が、構文エラーまたは 実行時例外のいずれかにより失敗した場合、 それが実行されていたレルム内で [ECMAScript] 例外が報告され、他のプリロードスクリプトは通常どおり実行される。

environment settings が与えられたときに run WebDriver BiDi preload scripts するには:
  1. documentenvironment settingsrelevant global objectassociated Document とする。

  2. navigabledocumentnavigable とする。

  3. user contextnavigableassociated user context とする。

  4. user context iduser contextuser context id とする。

  5. active BiDi sessions 内の各 session について:

    1. sessionpreload script mapvalues 内の各 preload script について:

      1. preload scriptuser contextssize が 0 でない場合:

        1. preload scriptuser contextsuser context idcontain しない場合、 continue する。

      2. preload scriptcontexts が null でない場合:

        1. navigable idnavigabletop-level traversable の id とする。

        2. preload scriptcontextsnavigable idcontain しない場合、 continue する。

      3. preload scriptsandbox が null でない場合、 realmpreload scriptsandbox および navigableget or create a sandbox realm したものとする。そうでなければ realmenvironment settingsrealm execution context の Realm component とする。

      4. exception reporting globalenvironment settingsrealm execution context の Realm component の global object とする。

      5. argumentspreload scriptarguments とする。

      6. deserialized arguments を空の list とする。

      7. arguments 内の各 argument について:

        1. channel を、sessionrealm および argumentcreate a channel したものとする。

        2. channeldeserialized arguments に追加する。

      8. base URLenvironment settingsAPI base URL とする。

      9. optionsdefault script fetch options とする。

      10. function declarationpreload scriptfunction declaration とする。

      11. function body evaluation status を、 function declarationenvironment settingsbase URL、および optionsevaluate function body した結果とする。

      12. function body evaluation statusabrupt completion の場合、 function body evaluation status.[[Value]] により与えられる例外を exception reporting global に対して report an exception する。

      13. function objectfunction body evaluation status.[[Value]] とする。

      14. IsCallable(function object) が false である場合:

        1. errorrealm 内の新しい TypeError オブジェクトとする。

        2. errorexception reporting global に対して Report an exception する。

      15. environment settingsPrepare to run script する。

      16. evaluation statusCall(function object, null, deserialized arguments) に設定する。

      17. environment settingsClean up after running script する。

      18. evaluation statusabrupt completion の場合、 evaluation status.[[Value]] により与えられる例外を exception reporting global に対して report an exception する。

7.6.3.

7.6.3.1. script.Channel 型

Remote end 定義 および local end 定義

script.Channel = text;
    

script.Channel 型は、remote end から local end へカスタムメッセージを送信するために使用される 特定のチャネルの id を表す。

7.6.3.2. script.ChannelValue 型

Remote end 定義

script.ChannelValue = {
    type: "channel",
    value: script.ChannelProperties,
    }

    script.ChannelProperties = {
    channel: script.Channel,
    ? serializationOptions: script.SerializationOptions,
    ? ownership: script.ResultOwnership,
    }
    

script.ChannelValue 型は、remote end から local end へ メッセージを送信する関数へデシリアライズできる ArgumentValue を表す。

sessionrealm および protocol value が与えられたときに create a channel するには:

  1. channel propertiesprotocol value["value"] とする。

  2. steps を、引数 message が与えられたときの次の手順とする:

    1. current realmcurrent Realm Record とする。

    2. sessioncurrent realmchannel properties および messageEmit a script message する。

  3. CreateBuiltinFunction(steps, 1, "", « », realm) を返す。

7.6.3.3. script.EvaluateResult 型

Remote end 定義 および local end 定義

script.EvaluateResult = (
    script.EvaluateResultSuccess /
    script.EvaluateResultException
    )

    script.EvaluateResultSuccess = {
    type: "success",
    result: script.RemoteValue,
    realm: script.Realm
    }

    script.EvaluateResultException = {
    type: "exception",
    exceptionDetails: script.ExceptionDetails
    realm: script.Realm
    }
    

script.EvaluateResult 型は、script を実行するコマンドの戻り値を示す。 script.EvaluateResultSuccess バリアントは、script が正常に完了した場合に使用され、 script.EvaluateResultException バリアントは、script が投げられた例外により 完了した場合に使用される。

7.6.3.4. script.ExceptionDetails 型

Remote end 定義 および local end 定義

script.ExceptionDetails = {
    columnNumber: js-uint,
    exception: script.RemoteValue,
    lineNumber: js-uint,
    stackTrace: script.StackTrace,
    text: text,
    }
    

script.ExceptionDetails 型は JavaScript 例外を表す。

realmcompletion record recordownership type および session が与えられたときに get exception details するには:

  1. Assert: record.[[Type]] は throw である。

  2. text を、record により表されるエラーの実装定義のテキスト記述とする。

    TODO: ここでの要件を厳密化する。おそらく人々は regex など同じくらい悪い手段で このデータを解析しようとする。

  3. serialization options を、各フィールドを既定値に設定した script.SerializationOptions production に一致する map とする。

  4. exception を、 record.[[Value]]、serialization optionsownership type、 serialization internal map としての新しい maprealm および sessionserialize as a remote value した結果とする。

  5. stack trace を、record が与えられたときの stack trace for an exception とする。

  6. stack trace の size が 1 以上の場合、line numberstack trace[0] 内の lineNumber フィールドの値とし、 column numberstack trace[0] 内の columnNumber フィールドの値とする。そうでなければ line number および column number を 0 とする。

  7. exception details を、 text フィールドを text に、exception フィールドを exception に、 lineNumber フィールドを line number に、 columnNumber フィールドを column number に、 stackTrace フィールドを stack trace に設定した、 script.ExceptionDetails production に一致する map とする。

  8. exception details を返す。

7.6.3.5. script.Handle 型

Remote end 定義 および local end 定義

script.Handle = text;
    

script.Handle 型は、ECMAScript ランタイムにより所有されるオブジェクトへのハンドルを表す。 このハンドルは特定の Realm 内でのみ有効である。

各 ECMAScript Realm は対応する handle object map を持つ。これは、 handle id からそれに対応するオブジェクトへの strong map である。

7.6.3.6. script.InternalId 型

Remote end 定義 および local end 定義

script.InternalId = text;
    

script.InternalId 型は、 serialization 中の、以前にシリアライズされた script.RemoteValue の id を表す。

7.6.3.7. script.LocalValue 型

Remote end 定義

script.LocalValue = (
    script.RemoteReference /
    script.PrimitiveProtocolValue /
    script.ChannelValue /
    script.ArrayLocalValue /
    { script.DateLocalValue } /
    script.MapLocalValue /
    script.ObjectLocalValue /
    { script.RegExpLocalValue } /
    script.SetLocalValue
    )

    script.ListLocalValue = [*script.LocalValue];

    script.ArrayLocalValue = {
    type: "array",
    value: script.ListLocalValue,
    }

    script.DateLocalValue = (
    type: "date",
    value: text
    )

    script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];

    script.MapLocalValue = {
    type: "map",
    value: script.MappingLocalValue,
    }

    script.ObjectLocalValue = {
    type: "object",
    value: script.MappingLocalValue,
    }

    script.RegExpValue = {
    pattern: text,
    ? flags: text,
    }

    script.RegExpLocalValue = (
    type: "regexp",
    value: script.RegExpValue,
    )

    script.SetLocalValue = {
    type: "set",
    value: script.ListLocalValue,
    }
    

script.LocalValue 型は、ECMAScript へデシリアライズできる値を表す。これにはプリミティブ値および非プリミティブ値の両方、 ならびに remote references および channels が含まれる。

serialized key-value listrealm および session が与えられたときに deserialize key-value list するには:

  1. deserialized key-value list を新しい list とする。

  2. serialized key-value list 内の各 serialized key-value について:

    1. serialized key-valuesize が 2 でない場合、 errorerror code invalid argument で返す。

    2. serialized keyserialized key-value[0] とする。

    3. serialized keystring である場合、 deserialized keyserialized key とする。

    4. そうでなければ deserialized key を、 serialized keyrealm および sessiondeserialize local value することを trying した結果とする。

    5. serialized valueserialized key-value[1] とする。

    6. deserialized value を、serialized valuerealm および session が与えられたときに deserialize local value することを trying した結果とする。

    7. CreateArrayFromListdeserialized key, deserialized value») を deserialized key-value list に追加する。

  3. success をデータ deserialized key-value list で返す。

serialized value listrealm および session が与えられたときに deserialize value list するには:

  1. deserialized values を新しい list とする。

  2. serialized value list 内の各 serialized value について:

    1. deserialized value を、serialized valuerealm および session が与えられたときに deserialize local value することを trying した結果とする。

    2. deserialized valuedeserialized values に追加する;

  3. success をデータ deserialized values で返す。

local protocol valuerealm および session が与えられたときに deserialize local value するには:

  1. local protocol valuescript.RemoteReference production に一致する場合、 local protocol valuerealm および session が与えられたときの deserialize remote reference を返す。

  2. local protocol valuescript.PrimitiveProtocolValue production に一致する場合、 local protocol valuedeserialize primitive protocol value したものを返す。

  3. local protocol valuescript.ChannelValue production に一致する場合、 sessionrealm および local protocol valuecreate a channel したものを返す。

  4. typelocal protocol valuetype フィールドの値、または そのようなフィールドがない場合は undefined とする。

  5. valuelocal protocol valuevalue フィールドの値、または そのようなフィールドがない場合は undefined とする。

  6. 以下の条件と関連する手順のリストにおいて、関連する条件が true となる最初の手順集合を実行する:

    type が文字列 "array" である
    1. deserialized value list を、 valuerealm および session が与えられたときに deserialize value list することを trying した結果とする。

    2. success をデータ CreateArrayFromList(deserialized value list) で返す。

    type が文字列 "date" である
    1. valueDate Time String Format に一致しない場合、 errorerror code invalid argument で返す。

    2. date resultConstruct(Date, value) とする。

    3. Assert: date resultabrupt completion ではない。

    4. success をデータ date result で返す。

    type が文字列 "map" である
    1. deserialized key-value list を、 valuerealm および sessiondeserialize key-value list することを trying した結果とする。

    2. iterableCreateArrayFromList(deserialized key-value list) とする

    3. success をデータ Map(iterable) で返す。

    type が文字列 "object" である
    1. deserialized key-value list を、 valuerealm および sessiondeserialize key-value list することを trying した結果とする。

    2. iterableCreateArrayFromList(deserialized key-value list) とする

    3. success をデータ Object.fromEntries(iterable) で返す。

    type が文字列 "regexp" である
    1. patternlocal protocol valuepattern フィールドの値とする。

    2. flagslocal protocol valueflags フィールドの値、または そのようなフィールドがない場合は undefined とする。

    3. regex_resultRegexp(pattern, flags) とする。これが例外を投げた場合、errorerror code invalid argument で返す。

    4. success をデータ regex_result で返す。

    type が文字列 "set" である
    1. deserialized value list を、 valuerealm および session が与えられたときに deserialize value list することを trying した結果とする。

    2. iterableCreateArrayFromList(deserialized key-value list) とする

    3. success をデータ Set object(iterable) で返す。

    otherwise
    errorerror code invalid argument で返す。
7.6.3.8. script.PreloadScript 型

Remote end 定義 および local end 定義

script.PreloadScript = text;
    

script.PreloadScript 型は、realm 作成時に実行される script へのハンドルを表す。

7.6.3.9. script.Realm 型

Remote end 定義 および local end 定義

script.Realm = text;
    

realm は、関連付けられた realm id を持つ。これはその realm を一意に識別する string である。これは realm が作成されたときに暗黙的に設定される。

realm の realm id は opaque であり、 handle object map 内の対応する global object の handle id、または該当する場合には、任意の navigablenavigable id から導出できてはならない。

注: これは、ユーザーが異なる id 間の 実装固有の関係に依存しないようにするためである。

realm id が与えられたときに get a realm するには:
  1. realm id が null である場合、success をデータ null で返す。

  2. realm であって idrealm id であるものが存在しない場合、 errorerror code no such frame で返す

  3. realm を、realm であって idrealm id であるものとする。

  4. success をデータ realm で返す

これは誤った error code である

7.6.3.10. script.PrimitiveProtocolValue 型

Remote end 定義 および local end 定義

script.PrimitiveProtocolValue = (
    script.UndefinedValue /
    script.NullValue /
    script.StringValue /
    script.NumberValue /
    script.BooleanValue /
    script.BigIntValue
    )

    script.UndefinedValue = {
    type: "undefined",
    }

    script.NullValue = {
    type: "null",
    }

    script.StringValue = {
    type: "string",
    value: text,
    }

    script.SpecialNumber = "NaN" / "-0" / "Infinity" / "-Infinity";

    script.NumberValue = {
    type: "number",
    value: number / script.SpecialNumber,
    }

    script.BooleanValue = {
    type: "boolean",
    value: bool,
    }

    script.BigIntValue = {
    type: "bigint",
    value: text,
    }
    

script.PrimitiveProtocolValue は、参照ではなく値によってのみ 表現できる値を表す。

value が与えられたときに serialize primitive protocol value するには:

  1. remote value を undefined とする。

  2. 以下の条件と関連する手順のリストにおいて、該当するものがある場合、 関連する条件が true となる最初の手順集合を実行する:

    Type(value) が undefined である
    remote value を、local end 定義 内の script.UndefinedValue production に一致する map とする。
    Type(value) が Null である
    remote value を、local end 定義 内の script.NullValue production に一致する map とする。
    Type(value) が String である
    remote value を、local end 定義 内の script.StringValue production に一致し、value property が value に設定された map とする。

    これは lone surrogate を処理しない

    Type(value) が Number である
    1. value の値について switch する:

      NaN
      serialized"NaN" とする
      -0
      serialized"-0" とする
      Infinity
      serialized"Infinity" とする
      -Infinity
      serialized"-Infinity" とする
      Otherwise:
      serializedvalue とする
    2. remote value を、 local end 定義 内の script.NumberValue production に一致し、value property が serialized に設定された map とする。

    Type(value) が Boolean である
    remote value を、local end 定義 内の script.BooleanValue production に一致し、value property が value に設定された map とする。
    Type(value) が BigInt である
    remote value を、local end 定義 内の script.BigIntValue production に一致し、value property が value に対して ToString operation を実行した結果に設定された map とする。
  3. remote value を返す

primitive protocol value が与えられたときに deserialize primitive protocol value するには:

  1. typeprimitive protocol valuetype フィールドの値とする。

  2. value を undefined とする。

  3. primitive protocol value がフィールド value を持つ場合:

    1. valueprimitive protocol valuevalue フィールドの値とする。

  4. 以下の条件と関連する手順のリストにおいて、関連する条件が true となる最初の手順集合を実行する:

    type が文字列 "undefined" である
    success をデータ undefined で返す。
    type が文字列 "null" である
    success をデータ null で返す。
    type が文字列 "string" である
    success をデータ value で返す。
    type が文字列 "number" である
    1. Type(value) が Number である場合、success をデータ value で返す。

    2. Assert: Type(value) は String である。

    3. value が文字列 "NaN" である場合、success を データ NaN で返す。

    4. number_resultStringToNumber(value) とする。

    5. number_result が NaN である場合、errorerror code invalid argument で返す

    6. success をデータ number_result で返す。

    type が文字列 "boolean" である
    success をデータ value で返す。
    type が文字列 "bigint" である
    1. bigint_resultStringToBigInt(value) とする。

    2. bigint_result が undefined である場合、errorerror code invalid argument で返す

    3. success をデータ bigint_result で返す。

  5. errorerror code invalid argument で返す

7.6.3.11. script.RealmInfo 型

Local end 定義

script.RealmInfo = (
    script.WindowRealmInfo /
    script.DedicatedWorkerRealmInfo /
    script.SharedWorkerRealmInfo /
    script.ServiceWorkerRealmInfo /
    script.WorkerRealmInfo /
    script.PaintWorkletRealmInfo /
    script.AudioWorkletRealmInfo /
    script.WorkletRealmInfo
    )

    script.BaseRealmInfo = (
    realm: script.Realm,
    origin: text
    )

    script.WindowRealmInfo = {
    script.BaseRealmInfo,
    type: "window",
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext,
    ? sandbox: text
    }

    script.DedicatedWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "dedicated-worker",
    owners: [script.Realm]
    }

    script.SharedWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "shared-worker"
    }

    script.ServiceWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "service-worker"
    }

    script.WorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "worker"
    }

    script.PaintWorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "paint-worklet"
    }

    script.AudioWorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "audio-worklet"
    }

    script.WorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "worklet"
    }
    

注: script.RealmInfo variants と script.RealmType の値の間には 1:1 の関係がある。

script.RealmInfo 型は realm のプロパティを表す。

realm が与えられたときに get the navigable するには:
  1. global objectrealmglobal object とする。

  2. global objectunwrapped global object とする。

  3. global objectWindow object でない場合、null を返す。

  4. documentglobal object の wrapped Windowassociated Document とする。

  5. documentnode navigable を返す。

global object が与えられたときに get the worker’s owners するには:
  1. Assert: global objectWorkerGlobalScope object である。

  2. owners を空の list とする。

  3. global object の associated owner set 内の各 owner について:

    1. owner environment settingsownerrelevant settings object とする。

    2. owner realm info を、 owner environment settings が与えられたときに get the realm info した結果とする。

    3. owner realm info が null である場合、continue する。

    4. owner realm info["id"] を owners に追加する。

  4. owners を返す。

environment settings が与えられたときに get the realm info するには:
  1. realmenvironment settingsrealm execution context の Realm component とする。

  2. realm idrealmrealm id とする。

  3. origin を、environment settingsorigin が与えられたときの serialization of an origin とする。

  4. global objectenvironment settings により指定される global object とする

  5. 最初に一致する条件の下の手順を実行する:

    global objectWindow object である
    1. documentenvironment settingsrelevant global objectassociated Document とする。

    2. navigabledocumentnode navigable とする。

    3. navigable が null である場合、null を返す。

    4. navigable idnavigablenavigable id とする。

    5. user context id を、 navigableassociated user contextuser context id とする

    6. realm info を、 realm フィールドを realm id に、origin フィールドを origin に、context フィールドを navigable id に、そして userContext フィールドを user context id に設定した、 script.WindowRealmInfo production に一致する map とする。

    global objectSandboxWindowProxy object である
    TODO: sandboxes の処理について、これが正しい定式化かは不明である。
    1. documentglobal object の wrapped Windowassociated Document とする。

    2. navigabledocumentnode navigable とする。

    3. navigable が null である場合、null を返す。

    4. navigable idnavigablenavigable id とする。

    5. user context id を、 navigableassociated user contextuser context id とする

    6. sandbox name を、 realm が与えられたときに get a sandbox name した結果とする。

    7. Assert: sandbox name は null ではない。

    8. realm info を、 realm フィールドを realm id に、origin フィールドを origin に、context フィールドを navigable id に、 userContext フィールドを user context id に、そして sandbox フィールドを sandbox name に設定した、 script.WindowRealmInfo production に一致する map とする。

    global objectDedicatedWorkerGlobalScope object である
    1. owners を、global object が与えられたときに get the worker’s owners した結果とする。

    2. Assert: owners は正確に 1 個の item を持つ。

    3. realm info を、 realm フィールドを realm id に、 origin フィールドを origin に、そして owners フィールドを owners に設定した、 script.DedicatedWorkerRealmInfo production に一致する map とする。

    global objectSharedWorkerGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.SharedWorkerRealmInfo production に一致する map とする。

    global objectServiceWorkerGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.ServiceWorkerRealmInfo production に一致する map とする。

    global objectWorkerGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.WorkerRealmInfo production に一致する map とする。

    global objectPaintWorkletGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.PaintWorkletRealmInfo production に一致する map とする。

    global objectAudioWorkletGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.AudioWorkletRealmInfo production に一致する map とする。

    global objectWorkletGlobalScope object である
    1. realm info を、 realm フィールドを realm id に、そして origin フィールドを origin に設定した、 script.WorkletRealmInfo production に一致する map とする。

    Otherwise:
    1. realm info を null とする。

  6. realm info を返す

注: この仕様の将来の変種は、 "-" で分割した後の type 名の最後の component が、 WorkerGlobalScope を実装する globals については 常に "worker" となり、 WorkletGlobalScope を 実装する globals については "worklet" となる、という不変条件を維持する。

7.6.3.12. script.RealmType 型

Remote end 定義 および local end 定義

script.RealmType = "window" / "dedicated-worker" / "shared-worker" / "service-worker" /
                    "worker" / "paint-worklet" / "audio-worklet" / "worklet"
    

script.RealmType 型は、Realm の異なる型を表す。

7.6.3.13. script.RemoteReference 型

Remote end 定義

script.RemoteReference = (
    script.SharedReference /
    script.RemoteObjectReference
    )

    script.SharedReference = {
    sharedId: script.SharedId

    ? handle: script.Handle,
    Extensible
    }

    script.RemoteObjectReference = {
    handle: script.Handle,

    ? sharedId: script.SharedId
    Extensible
    }
    

script.RemoteReference 型は、与えられた Realm 内の handle object map に存在する ECMAScript object への remote reference を表す script.RemoteObjectReference、または node への reference を表す script.SharedReference のいずれかである。

"stale object reference" の場合を処理する。

注: 提供された reference が handlesharedId の両方を持つ場合、このアルゴリズムは handle を無視し、 sharedId のみを尊重する。

remote reference, realm および session が与えられたときに deserialize remote reference するには:
  1. Assert remote referencescript.RemoteReference production に一致する。

  2. remote referencescript.SharedReference production に一致する場合、 remote reference, realm および sessiondeserialize shared reference した結果を返す。

  3. remote reference および realmdeserialize remote object reference した結果を返す。

remote object reference および realm が与えられたときに deserialize remote object reference するには:
  1. handle idremote object referencehandle フィールドの値とする。

  2. handle maprealmhandle object map とする

  3. handle maphandle id を含まない場合、errorerror code no such handle で返す。

  4. success をデータ handle map[handle id] で返す。

shared reference, realm および session が与えられたときに deserialize shared reference するには:
  1. Assert shared referencescript.SharedReference production に一致する。

  2. navigable を、realmget the navigable した結果とする。

  3. navigablenull である場合、errorerror code no such node で返す。

    注: これは、realm が Window global でない場合に発生する。

  4. shared idshared referencesharedId フィールドの値とする。

  5. node を、session, navigable および shared idget a node することを trying した結果とする。

  6. nodenull である場合、errorerror code no such node で返す。

  7. environment settings を、その realm execution context の Realm component が realm である environment settings object とする。

  8. nodenode documentorigin が、environment settingsoriginsame origin domain でない場合、 errorerror code no such node で返す。

    注: これは、WebDriver-BiDi が、 そうでなければ script access を許可しない realms 間で objects を渡すために 使用できないことを保証する。

  9. realm global objectrealmglobal object とする。

  10. realm global objectSandboxWindowProxy object である場合、 node を、realm 内で node を wrapping する SandboxProxy に設定する。

  11. success をデータ node で返す。

7.6.3.14. script.RemoteValue 型

Remote end 定義 および local end 定義

script.RemoteValue = (
    script.PrimitiveProtocolValue /
    script.SymbolRemoteValue /
    script.ArrayRemoteValue /
    script.ObjectRemoteValue /
    script.FunctionRemoteValue /
    script.RegExpRemoteValue /
    script.DateRemoteValue /
    script.MapRemoteValue /
    script.SetRemoteValue /
    script.WeakMapRemoteValue /
    script.WeakSetRemoteValue /
    script.GeneratorRemoteValue /
    script.ErrorRemoteValue /
    script.ProxyRemoteValue /
    script.PromiseRemoteValue /
    script.TypedArrayRemoteValue /
    script.ArrayBufferRemoteValue /
    script.NodeListRemoteValue /
    script.HTMLCollectionRemoteValue /
    script.NodeRemoteValue /
    script.WindowProxyRemoteValue
    )

    script.ListRemoteValue = [*script.RemoteValue];

    script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];

    script.SymbolRemoteValue = {
    type: "symbol",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayRemoteValue = {
    type: "array",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.ObjectRemoteValue = {
    type: "object",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.FunctionRemoteValue = {
    type: "function",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.RegExpRemoteValue = {
    script.RegExpLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.DateRemoteValue = {
    script.DateLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.MapRemoteValue = {
    type: "map",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.SetRemoteValue = {
    type: "set",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue
    }

    script.WeakMapRemoteValue = {
    type: "weakmap",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.WeakSetRemoteValue = {
    type: "weakset",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.GeneratorRemoteValue = {
    type: "generator",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ErrorRemoteValue = {
    type: "error",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ProxyRemoteValue = {
    type: "proxy",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.PromiseRemoteValue = {
    type: "promise",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.TypedArrayRemoteValue = {
    type: "typedarray",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayBufferRemoteValue = {
    type: "arraybuffer",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.NodeListRemoteValue = {
    type: "nodelist",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.HTMLCollectionRemoteValue = {
    type: "htmlcollection",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.NodeRemoteValue = {
    type: "node",
    ? sharedId: script.SharedId,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.NodeProperties,
    }

    script.NodeProperties = {
    nodeType: js-uint,
    childNodeCount: js-uint,
    ? attributes: {*text => text},
    ? children: [*script.NodeRemoteValue],
    ? localName: text,
    ? mode: "open" / "closed",
    ? namespaceURI: text,
    ? nodeValue: text,
    ? shadowRoot: script.NodeRemoteValue / null,
    }

    script.WindowProxyRemoteValue = {
    type: "window",
    value: script.WindowProxyProperties,
    ? handle: script.Handle,
    ? internalId: script.InternalId
    }

    script.WindowProxyProperties = {
    context: browsingContext.BrowsingContext
    }
    

WASM 型を追加する?

WindowProxy は Node と 同様のスタイルで属性を持つべきか?

String / Number / などの wrapper object を特別に扱う?

ECMAScript runtime からアクセス可能な値は mirror object により表され、script.RemoteValue として指定される。値の型は type プロパティで指定される。JSON で表現可能な primitive value の場合、これは value プロパティに値を含む。JSON で表現できない primitive の場合、 value プロパティは値の文字列表現を 含む。

非 primitive object については、handle プロパティが存在する場合、 その object への一意な文字列 handle を含む。handle は各 serialization ごとに一意である。remote end は、対応する handle を持つ object を、 その handle で script.disown が呼び出されるか、 realm 自身が破棄されることになるまで(例: navigation によって)生存させ続ける。

一部の非 primitive 型について、value プロパティは ECMAScript object 内のデータの表現を含む。container 型では、これはさらに script.RemoteValue instance を含むことができる。 value プロパティは、重複 object、すなわちその object が現在の script.RemoteValue 内ですでに serialize されている場合、おそらく cycle の一部として、 または最大 serialization depth に到達した場合、null になり得るか、省略され得る。

同じ script.RemoteValue 内に重複 object がある場合、 値は remote value のうち 1 つに対してのみ提供される一方で、 ECMAScript object ごとに一意な internalId は、与えられた serialization におけるすべての重複 object に対して提供される。

Nodescript.RemoteValue instance により表される。これらは value プロパティに node の部分的な serialization を持つ。

mirror objects の lifecycle を再検討する。

注: mirror object は runtime 内で元の object を 生存させ続けない。object が runtime 内で破棄された場合、その後に protocol を介してそれへアクセスしようとすると error になる。

realm, ownership type および object が与えられたときに object の handle を取得するには:
  1. ownership type が "none" と等しい場合、null を返す。

  2. handle id を、object のための新しい一意な文字列 handle とする。

  3. handle maprealmhandle object map とする

  4. handle map[handle id] を object に設定する。

  5. 結果として handle id を返す。

node および session が与えられたときに node の shared id を取得する には:
  1. nodeunwrapped node とする。

  2. nodeNode を実装しない場合、 null を返す。

  3. navigablenodenode navigable とする。

  4. navigable が null の場合、null を返す。

  5. session, navigable および nodeget or create a node reference した結果を返す。

serialization internal map, remote value および object が与えられたときに 必要なら internal ids を設定する には:
  1. serialization internal mapobject を含まない場合、 serialization internal map[object] を remote value に設定する。

  2. そうでなければ、次の手順を実行する:

    1. previously serialized remote valueserialization internal map[object] とする。

    2. previously serialized remote valueinternalId フィールドを持たない場合、次の手順を実行する:

      1. internal id を、真にランダム、または疑似ランダムな数に基づく UUID の文字列表現とする。

      2. previously serialized remote valueinternalId フィールドを internal id に設定する。

    3. remote valueinternalId フィールドを、 previously serialized remote value 内の internalId フィールドに設定する。

value, serialization options, ownership type, serialization internal map, realm および session が与えられたときに remote value として serialize する には:

  1. remote value を、value が与えられたものとして serialize primitive protocol value した結果とする。

  2. remote value が undefined でない場合、remote value を返す。

  3. handle id を、realm, ownership type および valuehandle for an object した結果とする。

  4. ownership type を "none" に設定する。

  5. known object を、valueserialization internal map にある場合は true、そうでなければ false とする。

  6. 次の条件と対応する手順の一覧において、関連する条件が真である最初の手順群を実行する:

    Type(value) is Symbol
    remote value を、local end definition 内の script.SymbolRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    IsArray(value)
    remote value を、 session, script.ArrayRemoteValue, handle id, known object, value, serialization options, ownership type, serialization internal map, realm, および sessionserialize an Array-like した結果とする。
    IsRegExp(value)
    1. patternToString(Get(value, "source")) とする。

    2. flagsToString(Get(value, "flags")) とする。

    3. serialized を、 local end definition 内の script.RegExpValue production に一致する map とし、 pattern property を pattern に、flags property を flags に設定する。

    4. remote value を、 local end definition 内の script.RegExpRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略し、 value property を serialized に設定する。

    value has a [[DateValue]] internal slot.
    1. serializedCall(Date.prototype.toISOString, value) に設定する。

    2. Assert: serializedthrow completion でない。

    3. remote value を、 local end definition 内の script.DateRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略し、 value を serialized に設定する。

    value has a [[MapData]] internal slot
    1. remote value を、 local end definition 内の script.MapRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、 そうでなければ省略する。

    2. serialization internal map, remote value および valueSet internal ids if needed する。

    3. serialized を null とする。

    4. known objectfalse で、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:

      1. serialized を、 CreateMapIterator(value, key+value), serialization options, ownership type, serialization internal map, realm, および sessionserialize as a mapping した結果とする。

    5. serialized が null でない場合、remote valuevalue フィールドを serialized に設定する。

    value has a [[SetData]] internal slot
    1. remote value を、 local end definition 内の script.SetRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、 そうでなければ省略する。

    2. serialization internal map, remote value および valueSet internal ids if needed する。

    3. serialized を null とする。

    4. known objectfalse で、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:

      1. serialized を、 CreateSetIterator(value, value), serialization options, ownership type, serialization internal map, realm, および sessionserialize as a list した結果とする。

    5. serialized が null でない場合、remote valuevalue フィールドを serialized に設定する。

    value has a [[WeakMapData]] internal slot
    remote value を、local end definition 内の script.WeakMapRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has a [[WeakSetData]] internal slot
    remote value を、local end definition 内の script.WeakSetRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has a [[GeneratorState]] internal slot or [[AsyncGeneratorState]] internal slot
    remote value を、local end definition 内の script.GeneratorRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has an [[ErrorData]] internal slot
    remote value を、local end definition 内の script.ErrorRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has a [[ProxyHandler]] internal slot and a [[ProxyTarget]] internal slot
    remote value を、local end definition 内の script.ProxyRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    IsPromise(value)
    remote value を、local end definition 内の script.PromiseRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has a [[TypedArrayName]] internal slot
    remote value を、local end definition 内の script.TypedArrayRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value has an [[ArrayBufferData]] internal slot
    remote value を、local end definition 内の script.ArrayBufferRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    value is a platform object that implements NodeList
    remote value を、 script.NodeListRemoteValue,handle id, known object, value, serialization options, ownership type, serialization internal map, realm, および sessionserialize an Array-like した結果とする。
    value is a platform object that implements HTMLCollection
    remote value を、 script.HTMLCollectionRemoteValue, handle id, known object, value, serialization options, ownership type, known object, serialization internal map, realm, および sessionserialize an Array-like した結果とする。
    value is a platform object that implements Node
    1. shared id を、value および sessionget shared id for a node した結果とする。

    2. remote value を、 local end definition 内の script.NodeRemoteValue production に一致する map とし、 sharedId property は shared id が null でない場合はそれに設定し、そうでなければ省略し、 handle property は handle id が null でない場合はそれに設定し、 そうでなければ省略する。

    3. serialization internal map, remote value および valueSet internal ids if needed する。

    4. serialized を null とする。

    5. known objectfalse の場合、次の手順を実行する:

      1. serializedmap とする。

      2. serialized["nodeType"] を Get(value, "nodeType") に設定する。

      3. node valueGet(value, "nodeValue") に設定する。

      4. node value が null でない場合、 serialized["nodeValue"] を node value に設定する。

      5. valueElement または Attr を実装する場合:

        1. serialized["localName"] を Get(value, "localName") に設定する。

        2. serialized["namespaceURI"] を Get(value, "namespaceURI") に設定する

      6. child node count を、valuechildrensize とする。

      7. serialized["childNodeCount"] を child node count に設定する。

      8. serialization options["maxDomDepth"] が 0 と等しい場合、または valueShadowRoot を実装し、 かつ serialization options["includeShadowTree"] が "none" である場合、または serialization options["includeShadowTree"] が "open" で、かつ valuemode が "closed" である場合、children を null とする。

        そうでなければ、children を空の list とし、 valuechildren 内の node child ごとに:

        1. child serialization optionsserialization optionsclone とする。

        2. child serialization options["maxDomDepth"] が null でない場合、child serialization options["maxDomDepth"] を child serialization options["maxDomDepth"] - 1 に設定する。

        3. serialized を、child, child serialization options, ownership type, serialization internal map, realm, および sessionserialize as a remote value した結果とする。

        4. serializedchildren に append する。

      9. children が null でない場合、 serialized["children"] を children に設定する。

      10. valueElement を実装する場合:

        1. attributes を新しい map とする。

        2. valueattribute list 内の各 attribute について:

          1. nameattributequalified name とする

          2. valueattributevalue とする。

          3. attributes[name] を value に設定する

        3. serialized["attributes"] を attributes に設定する。

        4. shadow rootvalueshadow root とする。

        5. shadow root が null の場合、serialized shadow を null とする。 そうでなければ、次の下位手順を実行する:

          1. serialized shadow を、 shadow root, serialization options, ownership type, serialization internal map, realm, および sessionserialize as a remote value した結果とする。

        6. serialized["shadowRoot"] を serialized shadow に設定する。

      11. valueShadowRoot を実装する場合、 serialized["mode"] を valuemode に設定する。

    6. serialized が null でない場合、remote valuevalue フィールドを serialized に設定する。

    value is a platform object that implements WindowProxy
    1. windowvalue の [[WindowProxy]] internal slot の値とする。

    2. navigablewindownavigable とする。

    3. navigable idnavigablenavigable id とする。

    4. serialized を、local end definition 内の script.WindowProxyProperties production に一致する map とし、 context property を navigable id に設定する。

    5. remote value を、 local end definition 内の script.WindowProxyRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略し、 value property を serialized に設定する。

    value is a platform object
    1. remote value を、local end definition 内の script.ObjectRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    IsCallable(value)
    remote value を、local end definition 内の script.FunctionRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。
    Otherwise:
    1. Assert: Type(value) is Object

    2. remote value を、 local end definition 内の script.ObjectRemoteValue production に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ省略する。

    3. serialization internal map, remote value および valueSet internal ids if needed する。

    4. serialized を null とする。

    5. known objectfalse で、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:

      1. serialized を、 EnumerableOwnPropertyNames(value, key+value), serialization options, ownership type, serialization internal map, realm, および sessionserialize as a mapping した結果とする。

    6. serialized が null でない場合、remote valuevalue フィールドを serialized に設定する。

  7. remote value を返す

children と child nodes は別物である。childNodeCountchildNodes を参照するか、または childrenCount に名前を変更するべきである。

production, handle id, known object, value, serialization options, ownership type, serialization internal map, realm, および session が与えられたときに Array-like を serialize する には:
  1. remote valueproduction に一致する map とし、 handle property は handle id が null でない場合はそれに設定し、そうでなければ 省略する。

  2. serialization internal map, remote value および valueSet internal ids if needed する。

  3. known objectfalse で、かつ serialization options["maxObjectDepth"] が 0 でない場合:

    1. serialized を、 CreateArrayIterator(value, value), serialization options, ownership type, serialization internal map, realm, および sessionserialize as a list した結果とする。

    2. serialized が null でない場合、remote valuevalue フィールドを serialized に設定する。

  4. remote value を返す

iterable, serialization options, ownership type, serialization internal map, realm, および session が与えられたときに list として serialize する には:
  1. serialization options["maxObjectDepth"] が null でない場合、 assert: serialization options["maxObjectDepth"] は 0 より大きい。

  2. serialized を新しい list とする。

  3. IteratorToList(GetIterator(iterable, sync)) 内の各 child value について:

    1. child serialization optionsserialization optionsclone とする。

    2. child serialization options["maxObjectDepth"] が null でない場合、child serialization options["maxObjectDepth"] を child serialization options["maxObjectDepth"] - 1 に設定する。

    3. serialized child を、 child value, child serialization options, ownership type, serialization internal map, realm, および sessionserialize as a remote value した結果とする。

    4. serialized childserialized に append する。

  4. serialized を返す

iterable, serialization options, ownership type, serialization internal map, realm, および session が与えられたときに mapping として serialize する には:

  1. serialization options["maxObjectDepth"] が null でない場合、 assert: serialization options["maxObjectDepth"] は 0 より大きい。

  2. serialized を新しい list とする。

  3. IteratorToList(GetIterator(iterable, sync)) 内の item について:

    1. Assert: IsArray(item)

    2. propertyCreateListFromArrayLike(item) とする

    3. Assert: propertysize 2 の list である

    4. keyproperty[0] とし、valueproperty[1] とする

    5. child serialization optionsserialization optionsclone とする。

    6. child serialization options["maxObjectDepth"] が null でない場合、child serialization options["maxObjectDepth"] を child serialization options["maxObjectDepth"] - 1 に設定する。

    7. Type(key) が String である場合、serialized keychild key とし、 そうでなければ serialized key を、 child key, child serialization options, ownership type, serialization internal map, realm, および sessionserialize as a remote value した結果とする。

    8. serialized value を、 value, child serialization options, ownership type, serialization internal map, realm, および sessionserialize as a remote value した結果とする。

    9. serialized child を («serialized key, serialized value») とする。

    10. serialized childserialized に append する。

  4. serialized を返す

7.6.3.15. script.ResultOwnership 型
script.ResultOwnership = "root" / "none"
    

script.ResultOwnership は、serialized value ownership がどのように扱われるかを指定する。

7.6.3.16. script.SerializationOptions 型

Remote end definition

script.SerializationOptions = {
    ? maxDomDepth: (js-uint / null) .default 0,
    ? maxObjectDepth: (js-uint / null) .default null,
    ? includeShadowTree: ("none" / "open" / "all") .default "none",
    }
    

script.SerializationOptions は、ECMAScript object がどのように serialized されるかを指定できるようにする。

7.6.3.17. script.SharedId 型

Remote end definitionlocal end definition

script.SharedId = text;
    

script.SharedId 型は、任意の realm(Sandbox Realms を含む)で 使用可能な DOM Node への参照を表す。

7.6.3.18. script.StackFrame 型

Remote end definitionlocal end definition

script.StackFrame = {
    columnNumber: js-uint,
    functionName: text,
    lineNumber: js-uint,
    url: text,
    }
    

stack trace 内の frame は StackFrame object により表される。これは、script の URL を表す url property、 実行中の function の名前を表す functionName property、 および実行されたコードの行番号と列番号を表す lineNumbercolumnNumber properties を持つ。

7.6.3.19. script.StackTrace 型

Remote end definitionlocal end definition

script.StackTrace = {
    callFrames: [*script.StackFrame],
    }
    

script.StackTrace 型は、script 実行中のある時点における javascript stack を表す。

注: stack frames の list をどのように取得するか、 およびその list の properties の詳細は十分に規定されていないため、 ここでの詳細は実装定義である。

実装は stack frames の list を生成できると仮定される。これは javascript call stack 内の各 item につき 1 つの entry を持つ list であり、最も新しいものから始まる。 各 entry は、script script 内の文または式の実行に対応する単一の stack frame であり、次の fields を含む:

script url
script を含む resource の url
function
実行中の function の名前
line number
script を含む resource の先頭を基準とした、 実行されたコードのゼロ基準の行番号。
column number
script を含む resource 内の行の開始位置を基準とした、 実行されたコードのゼロ基準の列番号。

stack frames の list stack で、stack trace を 構築する には:

  1. call frames を新しい list とする。

  2. stack 内の各 stack frame frame について、 最も最近実行された frame から開始して、次の手順を実行する:

    1. url を、framescript urlURL が与えられたものとして、 URL serializer を実行した結果とする。

    2. frame info を、script.StackFrame production に一致する新しい map とし、url field を url に、 functionName field を framefunction に、 lineNumber field を frameline number に、columnNumber field を framecolumn number に設定する。

  3. frame infocall frames に append する。

  4. stack trace を、script.StackTrace production に一致する新しい map とし、callFrames property を call frames に設定する。

  5. stack trace を返す。

current stack trace は、running execution context の callstack を表す stack frames の list が与えられたものとして construct a stack trace した結果である。

exception、または type throwCompletion Record である exception を伴う exception の stack trace は、次により与えられる:

  1. exception が exception として throw された value である場合、recordexception を throw するために作成された Completion Record とする。 そうでなければ、recordexception とする。

  2. stack を、record が作成された時点での実行に対応する stack frames の list とする。

  3. stack が与えられたものとして construct a stack trace した結果を返す。

7.6.3.20. script.Source 型

Local end definition

script.Source = {
    realm: script.Realm,
    ? context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext
    }
    

script.Source 型は、script 関連の event が発生した script.Realm と、省略可能な browsingContext.BrowsingContext および関連する browser.UserContext を表す。

source realm が与えられたときに source を取得する には:
  1. realm を、source realmrealm id とする。

  2. environment settings を、 realm execution context の Realm component が source realm である environment settings object とする。

  3. environment settingsassociated Document を持つ場合:

    1. document を environment settings の associated Document とする。

    2. navigabledocumentnode navigable とする。

    3. navigable が null でない場合、navigable idnavigablenavigable id とする。

    4. user context id を、 navigableassociated user contextuser context id とする。

    そうでなければ、navigable を null とする。

  4. source を、 script.Source production に一致する map とし、realm field を realm に、context field を navigable が null でない場合は navigable id に設定し、そうでなければ unset し、 userContext field を |navigable が null でない場合は user context id に設定し、そうでなければ unset する。

  5. source を返す。

7.6.3.21. script.Target 型

Remote end definition

script.RealmTarget = {
    realm: script.Realm
    }

    script.ContextTarget = {
    context: browsingContext.BrowsingContext,
    ? sandbox: text
    }

    script.Target = (
    script.ContextTarget /
    script.RealmTarget
    )
    

script.Target 型は、 script.Realm または browsingContext.BrowsingContext のいずれかである値を表す。 これは、navigable identifier が、その navigable の active document に関連付けられた realm の 代わりになり得る場合に有用である。

navigable id および sandbox が与えられたときに navigable から realm を 取得する には:
  1. navigable を、navigable idget a navigable することを trying した結果とする。

  2. sandbox が null または空文字列の場合:

    1. documentnavigableactive document とする。

    2. environment settings を、 relevant global objectassociated Documentdocument である environment settings object とする。

    3. realmenvironment settingsrealm execution context の Realm component とする。

  3. そうでなければ: realm を、 sandbox および navigable が与えられたものとして get or create a sandbox realm することを trying した結果とする。

  4. data realm とともに success を返す

これは誤った error code を持つ

target が与えられたときに target から realm を 取得する には:
  1. targetscript.ContextTarget production に一致する場合:

    1. sandbox を null とする。

    2. target が "sandbox" を contains する場合、 sandboxtarget["sandbox"] に設定する。

    3. realm を、 target["context"] および sandboxget a realm from a navigable した結果とする。

  2. そうでなければ:

    1. Assert: targetscript.RealmTarget production に一致する。

    2. realm id を、targetrealm field の値とする。

    3. realm を、realm id が与えられたものとして get a realm した結果とする。

  3. data realm とともに success を返す

これは誤った error code を持つ

7.6.4. コマンド

7.6.4.1. script.addPreloadScript コマンド

script.addPreloadScript コマンドは preload script を追加する。

コマンド型
script.AddPreloadScript = (
    method: "script.addPreloadScript",
    params: script.AddPreloadScriptParameters
    )

    script.AddPreloadScriptParameters = {
    functionDeclaration: text,
    ? arguments: [*script.ChannelValue],
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    ? sandbox: text
    }
    
返却型
script.AddPreloadScriptResult = {
    script: script.PreloadScript
    }
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. command parameters が "userContexts" を contains し、 かつ command parameters が "contexts" を contains する場合、 invalid argument error code とともに error を返す。

  2. function declaration を、command parametersfunctionDeclaration field とする。

  3. arguments を、存在する場合は command parametersarguments field、そうでなければ空の list とする。

  4. user contextsset とする。

  5. navigables を null とする。

  6. command parameterscontexts field が存在する場合:

    1. navigables を空の set に設定する。

    2. command parameters["contexts"] の各 navigable id について

      1. navigable を、navigable idget a navigable することを trying した結果とする。

      2. navigabletop-level traversable でない場合、 invalid argument error code とともに error を返す。

      3. navigablenavigables に append する。

  7. そうでなければ、command parametersuserContextscontains する場合:

    1. user contexts を、command parameters["userContexts"] で create a set した結果に設定する。

    2. user contexts の各 user context id について:

      1. user context を、user context idget user context した結果に設定する。

      2. user context が null の場合、no such user context error code とともに error を返す。

  8. sandbox を、存在する場合は command parameters 内の "sandbox" field の値、そうでなければ null とする。

  9. scriptUUID の文字列表現とする。

  10. preload script mapsessionpreload script map とする。

  11. preload script map[script] を、 function declaration function declaration, arguments arguments, contexts navigables, sandbox sandbox, および user contexts user contexts を持つ struct に設定する。

  12. script field が script に設定された script.AddPreloadScriptResult に一致する新しい map を返す。

7.6.4.2. script.disown コマンド

script.disown コマンドは、与えられた handles を disown する。 これは handled object が garbage collected されることを保証しない。他の handles や強い ECMAScript references が存在し得るためである。

コマンド型
script.Disown = (
    method: "script.disown",
    params: script.DisownParameters
    )

    script.DisownParameters = {
    handles: [*script.Handle]
    target: script.Target;
    }
    
返却型
script.DisownResult = EmptyResult
    
command parameters を伴う remote end steps は次のとおりである:
  1. realm を、command parameterstarget field の値が与えられたものとして get a realm from a target することを trying した結果とする。

  2. handlescommand parametershandles field の値とする。

  3. handles の各 handle id について:

    1. handle maprealmhandle object map とする

    2. handle maphandle id を含む場合、 handle idhandle map から remove する。

  4. data null とともに success を返す。

7.6.4.3. script.callFunction コマンド

script.callFunction コマンドは、与えられた realm 内で、 提供された function を与えられた arguments で呼び出す。

RealmInfo は realm または navigable のいずれかであり得る。

注: functionDeclaration 内の arrow function の場合、 this argument は function の this binding に影響しない。

コマンド型
script.CallFunction = (
    method: "script.callFunction",
    params: script.CallFunctionParameters
    )

    script.CallFunctionParameters = {
    functionDeclaration: text,
    awaitPromise: bool,
    target: script.Target,
    ? arguments: [*script.LocalValue],
    ? resultOwnership: script.ResultOwnership,
    ? serializationOptions: script.SerializationOptions,
    ? this: script.LocalValue,
    ? userActivation: bool .default false,
    }
    
返却型
script.CallFunctionResult = script.EvaluateResult
    

TODO: script.evaluate で説明されているように timeout argument を追加する。

与えられた realm, serialized arguments list および sessionarguments を deserialize する には:

  1. deserialized arguments list を空の list とする。

  2. serialized arguments list の各 serialized argument について:

    1. deserialized argument を、 serialized argument, realm および session が与えられたものとして deserialize local value することを trying した結果とする。

    2. deserialized argumentdeserialized arguments list に append する。

  3. data deserialized arguments list とともに success を返す。

function declaration, environment settings, base URL, および options が与えられたときに function body を evaluate する には:

注: function declaration は parentheses で囲まれて evaluate される。

  1. bypassDisabledScripting を true とする。

  2. parenthesized function declaration を «"(", function declaration, ")"» を concatenate した結果とする

  3. function script を、 parenthesized function declaration, environment settings, base URL, options および bypassDisabledScriptingcreate a classic script した結果とする。

  4. environment settingsPrepare to run script する。

  5. function body evaluation statusScriptEvaluation(function script の record) とする。

  6. environment settingsClean up after running script する。

  7. function body evaluation status を返す。

session および command parameters を伴う remote end steps は次のとおりである:

  1. realm を、command parameterstarget field の値が与えられたものとして get a realm from a target することを trying した結果とする。

  2. realm idrealmrealm id とする。

  3. environment settings を、 realm execution context の Realm component が realm である environment settings object とする。

  4. command arguments を、command parametersarguments field の値とする。

  5. deserialized arguments を空の list とする。

  6. command arguments が null でない場合、deserialized arguments を、 realm, command arguments および session が与えられたものとして deserialize arguments することを trying した結果に設定する。

  7. this parameter を、command parametersthis field の値とする。

  8. this object を null とする。

  9. this parameter が null でない場合、this object を、 this parameter, realm および session が与えられたものとして deserialize local value することを trying した結果に設定する。

  10. function declaration を、 command parametersfunctionDeclaration field の値とする。

  11. await promise を、 command parametersawaitPromise field の値とする。

  12. serialization options を、存在する場合は command parametersserializationOptions field の値、 そうでなければ fields が default values に設定された script.SerializationOptions production に一致する map とする。

  13. result ownership を、存在する場合は command parametersresultOwnership field の値、そうでなければ none とする。

  14. base URLenvironment settingsAPI base URL とする。

  15. optionsdefault script fetch options とする。

  16. function body evaluation status を、 function declaration, environment settings, base URL, および optionsevaluate function body した結果とする。

  17. function body evaluation status.[[Type]] が throw の場合:

    1. exception details を、 realm, function body evaluation status, result ownership および session が与えられたものとして get exception details した結果とする。

    2. exceptionDetails field が exception details に設定された script.EvaluateResultException production に一致する新しい map を返す。

  18. function objectfunction body evaluation status.[[Value]] とする。

  19. IsCallable(function object) が false の場合:

    1. invalid argument error code とともに error を返す

  20. command parameters["userActivation"] が true の場合、 activation notification steps を実行する。

  21. environment settingsPrepare to run script する。

  22. evaluation statusCall(function object, this object, deserialized arguments) に設定する。

  23. evaluation status.[[Type]] が normal であり、かつ await promisetrue であり、かつ IsPromise(evaluation status.[[Value]]) である場合:

    1. evaluation statusAwait(evaluation status.[[Value]]) に設定する。

  24. environment settingsClean up after running script する。

  25. evaluation status.[[Type]] が throw の場合:

    1. exception details を、 realm, evaluation status, result ownership および session が与えられたものとして get exception details した結果とする。

    2. exceptionDetails field が exception details に設定された script.EvaluateResultException production に一致する新しい map を返す。

  26. Assert: evaluation status.[[Type]] は normal である。

  27. result を、 evaluation status.[[Value]], serialization options, result ownership, serialization internal map としての新しい map, realm および sessionserialize as a remote value した結果とする。

  28. realm field が realm id に設定され、 result field が result に設定された、 script.EvaluateResultSuccess production に一致する新しい map を返す。

7.6.4.4. script.evaluate コマンド

script.evaluate コマンドは、与えられた realm 内で提供された script を evaluate する。便宜上、realm の代わりに navigable を提供でき、 その場合に使用される realm は browsing context の active document の realm である。

この method は、提供された script を実行した値を返す。ただし、それが promise を返し、awaitPromise が true である場合は、その promise の resolved value が 返される。

コマンド型
script.Evaluate = (
    method: "script.evaluate",
    params: script.EvaluateParameters
    )

    script.EvaluateParameters = {
    expression: text,
    target: script.Target,
    awaitPromise: bool,
    ? resultOwnership: script.ResultOwnership,
    ? serializationOptions: script.SerializationOptions,
    ? userActivation: bool .default false,
    }
    
返却型
script.EvaluateResult

TODO: timeout argument を追加する。これがどのように機能すべきかは完全には明確でない。 Chrome では timeout は promise resolve step には適用されないように見えるが、 それはおそらく clients が望むものではない。

session および command parameters が与えられたときの remote end steps は次のとおりである:

  1. realm を、command parameterstarget field の値が与えられたものとして get a realm from a target することを trying した結果とする。

  2. realm idrealmrealm id とする。

  3. environment settings を、 realm execution context の Realm component が realm である environment settings object とする。

  4. sourcecommand parametersexpression field の値とする。

  5. await promisecommand parametersawaitPromise field の値とする。

  6. serialization options を、存在する場合は command parametersserializationOptions field の値、 そうでなければ fields が default values に設定された script.SerializationOptions production に一致する map とする。

  7. result ownership を、存在する場合は command parametersresultOwnership field の値、そうでなければ none とする。

  8. optionsdefault script fetch options とする。

  9. base URLenvironment settingsAPI base URL とする。

  10. bypassDisabledScripting を true とする。

  11. script を、source, environment settings, base URL, options および bypassDisabledScriptingcreate a classic script した結果とする。

  12. command parameters["userActivation"] が true の場合、 activation notification steps を実行する。

  13. environment settingsPrepare to run script する。

  14. evaluation statusScriptEvaluation(script の record) に設定する。

  15. evaluation status.[[Type]] が normal であり、await promise が true であり、かつ IsPromise(evaluation status.[[Value]]) である場合:

    1. evaluation statusAwait(evaluation status.[[Value]]) に設定する。

  16. environment settingsClean up after running script する。

  17. evaluation status.[[Type]] が throw の場合:

    1. exception details を、 realm, evaluation status, result ownership および sessionget exception details した結果とする。

    2. realm field が realm id に設定され、 exceptionDetails field が exception details に設定された script.EvaluateResultException production に一致する新しい map を返す。

  18. Assert: evaluation status.[[Type]] は normal である。

  19. result を、 evaluation status.[[Value]], serialization options, result ownership, serialization internal map としての新しい map, realm および sessionserialize as a remote value した結果とする。

  20. realm field が realm id に設定され、 result field が result に設定された、 script.EvaluateResultSuccess production に一致する新しい map を返す。

7.6.4.5. script.getRealms コマンド

script.getRealms コマンドは、すべての realms の list を返す。 省略可能で、特定の型の realms、または navigableactive document に関連付けられた realm に絞り込むことができる。

コマンド型
script.GetRealms = (
    method: "script.getRealms",
    params: script.GetRealmsParameters
    )

    script.GetRealmsParameters = {
    ? context: browsingContext.BrowsingContext,
    ? type: script.RealmType,
    }
    
返却型
script.GetRealmsResult = {
    realms: [*script.RealmInfo]
    }
    
session および command parameters を伴う remote end steps は次のとおりである:
  1. environment settings を、 execution ready flag が設定されている すべての environment settings objectslist とする。

  2. command parameterscontext を含む場合:

    1. navigable を、 command parameters["context"] で get a navigable することを trying した結果とする。

    2. documentnavigableactive document とする。

    3. navigable environment settingslist とする。

    4. environment settings の各 settings について:

      1. 次の条件のいずれかが成り立つ場合:

        settingsnavigable environment settings に append する。

    5. environment settingsnavigable environment settings に設定する。

  3. realms を list とする。

  4. environment settings の各 settings について:

    1. realm info を、settings が与えられたものとして get the realm info した結果とする。

    2. command parameterstype を含み、かつ realm info["type"] が command parameters["type"] と等しくない場合、continue する。

    3. realm info が null でない場合、realm inforealms に append する。

  5. body を、realms field が realms に設定された script.GetRealmsResult production に一致する map とする。

  6. data body とともに success を返す。

これを拡張して、 nested workers などの realm parents も許可するか? またはすべての ancestor workers を取得するか。

単なる literal match よりも高度な filter system が必要かもしれない。

7.6.4.6. script.removePreloadScript コマンド

script.removePreloadScript コマンドは preload script を削除する。

コマンド型
script.RemovePreloadScript = (
    method: "script.removePreloadScript",
    params: script.RemovePreloadScriptParameters
    )

    script.RemovePreloadScriptParameters = {
    script: script.PreloadScript
    }
    
返却型
script.RemovePreloadScriptResult = EmptyResult
    
session および command parameters が与えられたときの remote end steps は次のとおりである:
  1. script を、command parameters 内の "script" field の値とする。

  2. preload script mapsessionpreload script map とする。

  3. preload script mapscriptcontain しない場合、 no such script error code とともに error を返す。

  4. scriptpreload script map から Remove する。

  5. null を返す

7.6.5. イベント

7.6.5.1. script.message イベント
イベント型
script.Message = (
    method: "script.message",
    params: script.MessageParameters
    )

    script.MessageParameters = {
    channel: script.Channel,
    data: script.RemoteValue,
    source: script.Source,
    }
    
remote end event trigger は、 session, realm, channel properties, および message が与えられた emit a script message 手順である:
  1. environment settings を、 realm execution context の Realm component が realm である environment settings object とする。

  2. related navigables を、environment settings が与えられたものとして get related navigables した結果とする。

  3. session, "script.message" および related navigables が与えられたときに event is enabled である場合:

    1. channel properties が "serializationOptions" を contains する場合、serialization optionschannel propertiesserializationOptions field の値とする。 そうでなければ、serialization options を fields が default values に設定された script.SerializationOptions production に一致する map とする。

    2. channel properties が "ownership" を contains する場合、 ownership typechannel properties["ownership"] とする。 そうでなければ、 ownership type を "none" とする。

    3. data を、message, serialization options, ownership type, serialization internal map としての新しい map および realm が与えられたものとして serialize as a remote value した結果とする。

    4. source を、realmget the source した結果とする。

    5. params を、 script.MessageParameters production に一致する map とし、 channel field を channel properties["channel"] に、 data field を data に、source field を source に設定する。

    6. body を、params field が params に設定された script.Message production に一致する map とする。

    7. session および bodyEmit an event する。

7.6.5.2. script.realmCreated イベント
イベント型
script.RealmCreated = (
    method: "script.realmCreated",
    params: script.RealmInfo
    )
    
remote end event trigger は次のとおりである:

set up a window environment settings object, set up a worker environment settings object または set up a worklet environment settings object algorithms のいずれかが呼び出されたとき、settings object を返す直前に:

  1. environment settings を、新しく作成された environment settings object とする。

  2. realm info を、environment settings が与えられたものとして get the realm info した結果とする。

  3. realm info が null の場合、戻る。

  4. related navigables を、environment settings が与えられたものとして get related navigables した結果とする。

  5. body を、params field が realm info に設定された script.RealmCreated production に一致する map とする。

  6. "script.realmCreated" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

session, navigables および include global が与えられたときの、 subscribe priority 2 を伴う remote end subscribe steps は次のとおりである:

  1. environment settings を、 execution ready flag が設定されている すべての environment settings objects の list とする。

  2. environment settings の各 settings について:

    1. related navigables を新しい set とする。

    2. settingsrelevant global objectassociated DocumentDocument である場合:

      1. navigablesettingsrelevant global objectassociated Documentnode navigable とする。

      2. navigable が null の場合、continue する。

      3. top-level traversiblenavigabletop-level traversable とする。

      4. top-level traversiblenavigables 内にない場合、continue する。

      5. top-level traversiblerelated navigables に append する。

      そうでなければ、include global が false の場合、continue する。

    3. realm info を、settings が与えられたものとして get the realm info した結果とする。

    4. realm info が null の場合、continue する。

    5. body を、params field が realm info に設定された script.RealmCreated production に一致する map とする。

    6. session, "script.realmCreated" および related navigables が与えられたときに event is enabled である場合:

      1. session および bodyEmit an event する。

ここでの順序は よりよく定義されるべきか?

7.6.5.3. script.realmDestroyed イベント
イベント型
script.RealmDestroyed = (
    method: "script.realmDestroyed",
    params: script.RealmDestroyedParameters
    )

    script.RealmDestroyedParameters = {
    realm: script.Realm
    }

    
remote end event trigger は次のとおりである:
document を伴う次の unloading document cleanup steps を定義する:
  1. related navigables を空の set とする。

  2. documentnavigablerelated navigables に append する。

  3. documentworklet global scopes 内の各 worklet global scope について:

    1. realmworklet global scoperelevant Realm とする。

    2. realm idrealmrealm id とする。

    3. params を、 realm field が realm id に設定された script.RealmDestroyedParameters production に一致する map とする。

    4. body を、params field が params に設定された script.RealmDestroyed production に一致する map とする。

    5. "script.realmDestroyed" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:

      1. session および bodyEmit an event する。

  4. environment settings を、 relevant global objectassociated Documentdocument である environment settings object とする。

  5. realmenvironment settingsrealm execution context の Realm component とする。

  6. realm idrealmrealm id とする。

  7. params を、 realm field が realm id に設定された script.RealmDestroyedParameters production に一致する map とする。

  8. body を、params field が params に設定された script.RealmDestroyed production に一致する map とする。

  9. "script.realmDestroyed" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:

    1. session および bodyEmit an event する。

worker event loop event loop が、 worker がその lifecycle の終端に到達したため、または terminate a worker algorithm により早期に破棄されたために破棄されるたびに:

  1. environment settings を、 event loopresponsible event loop である environment settings object とする。

  2. related navigables を、environment settings が与えられたものとして get related navigables した結果とする。

  3. realmenvironment settingsenvironment settings object’s Realm とする。

  4. realm idrealmrealm id とする。

  5. params を、realm field が realm id に設定された script.RealmDestroyedParameters production に一致する map とする。

  6. body を、params field が params に設定された script.RealmDestroyed production に一致する map とする。

7.7. storage モジュール

storage モジュールは、storage に関連する機能および events を含む。

storage partition は、user agent が cookies や local storage などの永続データを 整理できる namespace である。

storage partition key は、storage partition を一意に識別する map である。

7.7.1. 定義

Remote end definition

StorageCommand = (
    storage.DeleteCookies //
    storage.GetCookies //
    storage.SetCookie
    )
    

Local end definition

StorageResult = (
    storage.DeleteCookiesResult /
    storage.GetCookiesResult /
    storage.SetCookieResult
    )
    

7.7.2.

7.7.2.1. storage.PartitionKey 型

Local end definition

storage.PartitionKey = {
    ? userContext: text,
    ? sourceOrigin: text,
    Extensible,
    }
    

storage.PartitionKey 型は storage partition key を表す。

次の standard storage partition key attributes の table は、 remote end が support することを選択できる、よく知られた意味を持つ attributes を列挙する。 実装は追加の extension storage partition key attributes を定義してもよい。

属性 定義
"userContext" user context id
"sourceOrigin" storage partition に access できる resources の origin の serialization

Remote ends は、任意の数の extension storage partition key attributes を support してもよい。他の実装との衝突を避けるため、これらの attributes は vendor および user-agent に対する一意な識別子で始まり、 その後に U+003A (:) が続かなければならない。

remote end は、ゼロ個以上の entries を含む storage partition key attributes の default valuesmap を持つ。 各 key は、storage partition key が standard storage partition に対応する場合は standard storage partition key attributes の table の member でなければならず、そうでない場合は extension storage partition key attribute でなければならない。また values は、ユーザーが明示的な値を提供しない場合に使用される その partition key の default value を表す。正確な entries は 実装定義であり、実装が採用する storage partitioning により決定される。

remote end は、ゼロ個以上の entries を含む required partition key attributeslist を持つ。 各 key は、storage partition key が standard storage partition に対応する場合は standard storage partition key attributes の table の member でなければならず、そうでない場合は extension storage partition key attribute でなければならない。正確な entries は実装定義であり、実装が採用する storage partitioning により決定される。この list は default が利用できない partition keys のみを含む。そのため、この list は default values for storage partition key attributes の keys と entries を共有してはならない。

filter が与えられたときに filter を deserialize する には:
  1. deserialized filter を空の map とする。

  2. filter 内の各 namevalue について:

    1. deserialized name を、 table for cookie conversion 内の JSON key name に対応する field name とする。

    2. name が "value" の場合、deserialized valuevaluedeserialize protocol bytes した結果に設定し、 そうでなければ deserialized valuevalue とする。

    3. deserialized filter[deserialized name] を deserialized valueSet する。

  3. deserialized filter を返す。

partition spec が与えられたときに storage partition spec を展開する には:
  1. partition spec が null の場合:

    1. partition spec を空の map に設定する。

  2. そうでなければ、partition spec["type"] が "context" である場合:

    1. navigable を、partition spec["context"] が与えられたものとして get a navigable することを trying した結果とする。

    2. partition key を、navigableassociated storage partitionkey とする。

    3. data partition key とともに success を返す。

  3. partition key を空の map とする。

  4. default values for storage partition key attributes 内の各 namedefault value について:

    1. value を、存在する場合は partition spec[name]、 そうでなければ default value とする。

    2. partition key[name] を valueSet する。

  5. remote end の required partition key attributes 内の 各 name について:

    1. partition spec[name] が exists する場合:

      1. partition key][name] を partition spec[name] に Set する。

    2. そうでなければ:

      1. underspecified storage partition error code とともに error を返す。

  6. data partition key とともに success を返す。

storage partition key が与えられたときに cookie store を取得する には:
  1. storage partition key が現存する storage partition を一意に識別する場合:

    1. store を、その storage partitioncookie store とする。

    2. data store とともに success を返す。

  2. no such storage partition error code とともに error を返す。

stored cookie および filter が与えられたときに cookie に一致させる には:
  1. filter 内の各 namevalue について:

    1. stored cookie[name] が value と等しくない場合:

      1. false を返す。

  2. true を返す。

cookie store および filter が与えられたときに 一致する cookies を取得する には:
  1. cookies を新しい list とする。

  2. deserialized filter を、filterdeserialize filter した結果に設定する。

  3. cookie store 内の各 stored cookie について:

    1. stored cookie および deserialized filtermatch cookie した結果が true の場合:

      1. stored cookiecookies に append する。

  4. cookies を返す。

7.7.3. コマンド

7.7.3.1. storage.getCookies コマンド

storage.getCookies コマンドは、提供された parameters の set に match する ゼロ個以上の cookies を取得する。

コマンド型
storage.GetCookies = (
    method: "storage.getCookies",
    params: storage.GetCookiesParameters
    )


    storage.CookieFilter = {
    ? name: text,
    ? value: network.BytesValue,
    ? domain: text,
    ? path: text,
    ? size: js-uint,
    ? httpOnly: bool,
    ? secure: bool,
    ? sameSite: network.SameSite,
    ? expiry: js-uint,
    Extensible,
    }

    storage.BrowsingContextPartitionDescriptor = {
    type: "context",
    context: browsingContext.BrowsingContext
    }

    storage.StorageKeyPartitionDescriptor = {
    type: "storageKey",
    ? userContext: text,
    ? sourceOrigin: text,
    Extensible,
    }

    storage.PartitionDescriptor = (
    storage.BrowsingContextPartitionDescriptor /
    storage.StorageKeyPartitionDescriptor
    )

    storage.GetCookiesParameters = {
    ? filter: storage.CookieFilter,
    ? partition: storage.PartitionDescriptor,
    }
    
返却型
storage.GetCookiesResult = {
    cookies: [*network.Cookie],
    partitionKey: storage.PartitionKey,
    }
    
session および command parameters を伴う remote end steps は次のとおりである:
  1. filter を、存在する場合は command parametersfilter field の値、存在しない場合は空の map とする。

  2. partition spec を、存在する場合は command parameterspartition field の値、存在しない場合は null とする。

  3. partition key を、partition specexpand a storage partition spec することを trying した結果とする。

  4. store を、 partition keyget the cookie store することを trying した結果とする。

  5. cookies を、store および filterget matching cookies した結果とする。

  6. serialized cookies を新しい list とする。

  7. cookies 内の各 cookie について:

    1. serialized cookie を、cookie が与えられたものとして serialize cookie した結果とする。

    2. serialized cookieserialized cookies に append する。

  8. body を、cookies field が serialized cookies に、 partitionKey field が partition key に設定された storage.GetCookiesResult production に一致する map とする。

  9. data body とともに success を返す。

7.7.3.2. storage.setCookie コマンド

storage.setCookie コマンドは、cookie store 内に新しい cookie を作成し、 [COOKIES] に従って一致する、その store 内の任意の cookie を置き換える。

コマンド型
storage.SetCookie = (
    method: "storage.setCookie",
    params: storage.SetCookieParameters,
    )


    storage.PartialCookie = {
    name: text,
    value: network.BytesValue,
    domain: text,
    ? path: text,
    ? httpOnly: bool,
    ? secure: bool,
    ? sameSite: network.SameSite,
    ? expiry: js-uint,
    Extensible,
    }

    storage.SetCookieParameters = {
    cookie: storage.PartialCookie,
    ? partition: storage.PartitionDescriptor,
    }
    
返却型
storage.SetCookieResult = {
    partitionKey: storage.PartitionKey
    }
    
session および command parameters を伴う remote end steps は次のとおりである:
  1. cookie speccommand parameterscookie field の値とする。

  2. partition spec を、存在する場合は command parameterspartition field の値、存在しない場合は null とする。

  3. partition key を、partition specexpand a storage partition spec することを trying した結果とする。

  4. store を、partition keyget the cookie store することを trying した結果とする。

  5. deserialized value を、 cookie spec["value"] で deserialize protocol bytes した結果とする。

  6. store 内に、cookie name cookie spec["name"], cookie value deserialized value, cookie domain cookie spec["domain"]、および table for cookie conversion に列挙された 次の cookie concepts の attribute-value list を使用して Create a cookie する:

    Cookie path

    存在する場合は cookie spec["path"]、そうでなければ "/"。

    Cookie secure only

    存在する場合は cookie spec["secure"]、そうでなければ false。

    Cookie HTTP only

    存在する場合は cookie spec["httpOnly"]、そうでなければ false。

    Cookie expiry time

    存在する場合は cookie spec["expiry"]、そうでなければこれが session cookie であることを示すため unset のままとする。

    注: cookie の expiry value は、 Cookie Lifetime Limits に従って remote end により制限される場合がある。

    Cookie same site

    存在する場合は cookie spec["sameSite"]、そうでなければ same site policy が定義されていないことを示すため unset のままとする。

    この手順が cookie を cookie store に挿入せずに中止された場合、 unable to set cookie error code とともに error を返す。

  7. body を、partitionKey field が partition key に設定された storage.SetCookieResult production に一致する map とする。

  8. data body とともに success を返す。

7.7.3.3. storage.deleteCookies コマンド

storage.deleteCookies コマンドは、提供された parameters の set に match する ゼロ個以上の cookies を削除する。

コマンド型
storage.DeleteCookies = (
    method: "storage.deleteCookies",
    params: storage.DeleteCookiesParameters,
    )

    storage.DeleteCookiesParameters = {
    ? filter: storage.CookieFilter,
    ? partition: storage.PartitionDescriptor,
    }
    
返却型
storage.DeleteCookiesResult = {
    partitionKey: storage.PartitionKey
    }
    
session および command parameters を伴う remote end steps は次のとおりである:
  1. filter を、存在する場合は command parametersfilter field の値、存在しない場合は空の map とする。

  2. partition spec を、存在する場合は command parameterspartition field の値、存在しない場合は null とする。

  3. partition key を、partition specexpand a storage partition spec することを trying した結果とする。

  4. store を、partition keyget the cookie store することを trying した結果とする。

  5. cookies を、store および filterget matching cookies した結果とする。

  6. cookies 内の各 cookie について:

    1. cookiestore から削除する。

  7. body を、partitionKey field が partition key に設定された storage.DeleteCookiesResult production に一致する map とする。

  8. data body とともに success を返す。

7.8. log モジュール

log モジュールは、logging に関連する機能および events を含む。

BiDi Sessionlog event buffer を持つ。これは、 navigable id から、 まだ発火されていないその context の log events の list への map である。User agents はこの buffer に最大 size を課してもよいが、 events A と B が同じ context で発生し、A が B より前に発生し、両方が buffer に追加された場合、 B の entry は A の entry より前に削除されてはならないという条件に従う。

session, navigables および event が与えられたときに log event を buffer する には:

  1. buffersessionlog event buffer とする。

  2. navigable ids を新しい list とする。

  3. navigables の各 navigable について:

    1. navigablenavigable idnavigable ids に append する。

  4. navigable ids 内の各 navigable id について:

    1. other navigables を空の list とする。

    2. navigable ids 内の各 other id について:

    3. other idnavigable id と等しくない場合、other idother navigables に append する。

    4. buffernavigable id を含まない場合、 buffer[navigable id] を新しい list とする。

    5. (event, other navigables) を buffer[navigable id] に append する。

注: 各 event が一度だけ発火されるように、 ここでは other navigables を保存する。実際には、これは複数の navigables に関連付けられる可能性がある workers についてのみ関係する。

これを browsing context または top-level traversable のどちらに基づいて key するか? 違いは、ある event が frame 内で発生し、その後 local end が top level navigable の log events に subscribe する前に、その frame が navigate された場合に何が起きるかにある。

7.8.1. 定義

Local end definition

LogEvent = (
    log.EntryAdded
    )
    

7.8.2.

7.8.2.1. log.LogEntry

Local end definition

log.Level = "debug" / "info" / "warn" / "error"

    log.Entry = (
    log.GenericLogEntry /
    log.ConsoleLogEntry /
    log.JavascriptLogEntry
    )

    log.BaseLogEntry = (
    level: log.Level,
    source: script.Source,
    text: text / null,
    timestamp: js-uint,
    ? stackTrace: script.StackTrace,
    )

    log.GenericLogEntry = {
    log.BaseLogEntry,
    type: text,
    }

    log.ConsoleLogEntry = {
    log.BaseLogEntry,
    type: "console",
    method: text,
    args: [*script.RemoteValue],
    }

    log.JavascriptLogEntry = {
    log.BaseLogEntry,
    type: "javascript",
    }
    

各 log event は log.Entry オブジェクトで表される。これは、 追加された log entry の型を表す type property、 severity を表す level property、log entry の origin を表す source property、log message string 自体を持つ text property、および log entry が生成された時刻に対応する timestamp property を持つ。 log.Entry の特定の variants は、異なる sources からの logs を表すために使用され、 entry type に固有の追加 fields を提供する。

7.8.3. イベント

7.8.3.1. log.entryAdded イベント
イベント型
log.EntryAdded = (
    method: "log.entryAdded",
    params: log.Entry,
    )
    

remote end event trigger は次のとおりである:

method, args, および options を伴う次の console steps を定義する:

  1. active BiDi sessions 内の各 session について:

    1. method が "error" または "assert" である場合、 level を "error" とする。method が "debug" または "trace" である場合、 level を "debug" とする。method が "warn" である場合、 level を "warn" とする。そうでなければ level を "info" とする。

    2. timestamp を、UTC における現在の日付と時刻を表す time value とする。

    3. text を空文字列とする。

    4. Type(args[0]) が String であり、かつ args[0] が formatting specifier を含む場合、formatted argsFormatter(args) とする。そうでなければ formatted argsargs とする。

      注: formatter operation は console specification で十分に定義されておらず、 formatting は実装間で一貫しない場合がある。

    5. formatted args 内の各 arg について:

      1. argargs 内の first entry でない場合、 U+0020 SPACE を text に append する。

      2. argprimitive ECMAScript value である場合、 ToString(arg) を text に append する。そうでなければ implementation-defined string を text に append する。

    6. realmcurrent Realm Recordrealm id とする。

    7. serialized args を新しい list とする。

    8. serialization options を、fields が default values に設定された script.SerializationOptions production に一致する map とする。

    9. args の各 arg について:

      1. serialized arg を、 value としての argserialization options, ownership type としての none、serialization internal map としての新しい map, realm および sessionserialize as a remote value した結果とする。

      2. serialized argserialized args に追加する。

    10. source を、current Realm Record が与えられたものとして get the source した結果とする。

    11. stackcurrent stack trace とする。

    12. entrylog.ConsoleLogEntry production に一致する map とし、 level field を level に、text field を text に、timestamp field を timestamp に、 stackTrace field を stack に、method field を method に、 source field を source に、 そして args field を serialized args に設定する。

    13. body を、params field が entry に設定された log.EntryAdded production に一致する map とする。

    14. settingscurrent settings object とする。

    15. related navigables を、settings が与えられたものとして get related navigables した結果とする。

    16. session, "log.entryAdded" および related navigables を伴って event is enabled である場合、session および bodyemit an event する。

      そうでなければ、session, related browsing contexts, および bodybuffer a log event する。

script, line number, column number, message および handled を arguments とする、次の error reporting steps を定義する:

  1. handled が true である場合、戻る。

  2. settingsscriptsettings object とする。

  3. timestamp を、UTC における現在の日付と時刻を表す time value とする。

  4. stack を、報告されている error に対応する exception を伴う stack trace for an exception とする。

  5. source を、current Realm Record が与えられたものとして get the source した結果とする。

  6. entry を、level が "error" に、textmessage に、sourcesource に、timestamptimestamp に、そして stackTrace field が stack に設定された log.JavascriptLogEntry production に一致する map とする。

  7. body を、params field が entry に設定された log.EntryAdded production に一致する map とする。

  8. related navigables を、settings が与えられたものとして get related navigables した結果とする。

  9. active BiDi sessions 内の各 session について:

    1. session, "log.entryAdded" および related navigables を伴って event is enabled である場合、session および bodyemit an event する。

      そうでなければ、session, related browsing contexts, および bodybuffer a log event する。

さらに多くのものが logging を必要とする。CDP には LogEntryAdded types として xml, javascript, network, storage, appcache, rendering, security, deprecation, worker, violation, intervention, recommendation, other がある。これらは、 異なる methods により表される js exception および console API types に加えて存在する。

implementation-defined log types を許可する

session, navigables および include global が与えられたときの、 subscribe priority 10 を伴う remote end subscribe steps は次のとおりである:

  1. sessionlog event buffer 内の各 navigable idevents について:

    1. maybe context を、navigable id が与えられたものとして getting a navigable した結果とする。

    2. maybe contexterror である場合、 navigable idlog event buffer から削除して continue する。

    3. navigablemaybe context の data とする。

    4. top level navigablenavigabletop-level traversable とする。

    5. include global が true であり、かつ top level navigablenavigables 内にない場合、 または include global が false であり、かつ top level navigablenavigables 内にある場合:

      1. events 内の各 (event, other navigables) について:

        1. session および eventEmit an event する。

        2. other navigables 内の各 other context id について:

          1. log event bufferother context id を含む場合、eventlog event buffer[other context id] から削除する。

7.9. input モジュール

input モジュールは、シミュレートされたユーザー入力のための機能を含む。

7.9.1. 定義

remote end definition

InputCommand = (
    input.PerformActions //
    input.ReleaseActions //
    input.SetFiles
    )
    
InputResult = (
    input.PerformActionsResult /
    input.ReleaseActionsResult /
    input.SetFilesResult
    )
    

local end definition

InputEvent = (
    input.FileDialogOpened
    )
    

7.9.2.

7.9.2.1. input.ElementOrigin

input.ElementOrigin 型は、座標 origin として使用される Element を表す。

input.ElementOrigin = {
    type: "element",
    element: script.SharedReference
    }
    
object が与えられたときの is input.ElementOrigin steps は次のとおりである:
  1. objectinput.ElementOrigin production に一致する map である場合、true を返す。

  2. false を返す。

session が与えられたときに input.ElementOrigin から Element を取得する steps は:
  1. origin および navigable が与えられたものとして、次の steps を返す:

    1. Assert: origininput.ElementOrigin に一致する。

    2. documentnavigableactive document とする。

    3. referenceorigin["element"] とする。

    4. environment settings を、 relevant global objectassociated Documentdocument である environment settings object とする。

    5. realmenvironment settingsrealm execution context の Realm component とする。

    6. element を、reference, realm, および sessiondeserialize remote reference することを trying した結果とする。

    7. elementElement を実装していない場合、no such element error code とともに error を返す。

    8. data element とともに success を返す。

7.9.3. コマンド

7.9.3.1. input.performActions コマンド

input.performActions コマンドは、 指定された user input actions の sequence を実行する。

注: このコマンドの動作の詳細な説明については、 actions section of [WEBDRIVER] を参照すること。

コマンド型
input.PerformActions = (
    method: "input.performActions",
    params: input.PerformActionsParameters
    )

    input.PerformActionsParameters = {
    context: browsingContext.BrowsingContext,
    actions: [*input.SourceActions]
    }

    input.SourceActions = (
    input.NoneSourceActions /
    input.KeySourceActions /
    input.PointerSourceActions /
    input.WheelSourceActions
    )

    input.NoneSourceActions = {
    type: "none",
    id: text,
    actions: [*input.NoneSourceAction]
    }

    input.NoneSourceAction = input.PauseAction

    input.KeySourceActions = {
    type: "key",
    id: text,
    actions: [*input.KeySourceAction]
    }

    input.KeySourceAction = (
    input.PauseAction /
    input.KeyDownAction /
    input.KeyUpAction
    )

    input.PointerSourceActions = {
    type: "pointer",
    id: text,
    ? parameters: input.PointerParameters,
    actions: [*input.PointerSourceAction]
    }

    input.PointerType = "mouse" / "pen" / "touch"

    input.PointerParameters = {
    ? pointerType: input.PointerType .default "mouse"
    }

    input.PointerSourceAction = (
    input.PauseAction /
    input.PointerDownAction /
    input.PointerUpAction /
    input.PointerMoveAction
    )

    input.WheelSourceActions = {
    type: "wheel",
    id: text,
    actions: [*input.WheelSourceAction]
    }

    input.WheelSourceAction = (
    input.PauseAction /
    input.WheelScrollAction
    )

    input.PauseAction = {
    type: "pause",
    ? duration: js-uint
    }

    input.KeyDownAction = {
    type: "keyDown",
    value: text
    }

    input.KeyUpAction = {
    type: "keyUp",
    value: text
    }

    input.PointerUpAction = {
    type: "pointerUp",
    button: js-uint,
    }

    input.PointerDownAction = {
    type: "pointerDown",
    button: js-uint,
    input.PointerCommonProperties
    }

    input.PointerMoveAction = {
    type: "pointerMove",
    x: float,
    y: float,
    ? duration: js-uint,
    ? origin: input.Origin,
    input.PointerCommonProperties
    }

    input.WheelScrollAction = {
    type: "scroll",
    x: js-int,
    y: js-int,
    deltaX: js-int,
    deltaY: js-int,
    ? duration: js-uint,
    ? origin: input.Origin .default "viewport",
    }

    input.PointerCommonProperties = (
    ? width: js-uint,
    ? height: js-uint,
    ? pressure: (0.0..1.0),
    ? tangentialPressure: (-1.0..1.0),
    ? twist: (0..359),
    ; 0 .. Math.PI / 2
    ? altitudeAngle: (0.0..1.5707963267948966),
    ; 0 .. 2 * Math.PI
    ? azimuthAngle: (0.0..6.283185307179586),
    )

    input.Origin = "viewport" / "pointer" / input.ElementOrigin
    
返却型
input.PerformActionsResult = EmptyResult
    

session および command parameters を伴う remote end steps は次のとおりである:

  1. navigable idcommand parameterscontext field の値とする。

  2. navigable を、navigable idget a navigable することを trying した結果とする。

  3. input state を、session および navigabletop-level traversableget the input state した結果とする。

  4. actions options を、is element origin steps が is input.ElementOrigin に設定され、かつ get element origin steps が session が与えられたものとして get Element from input.ElementOrigin steps した結果に設定された、新しい actions options とする。

  5. actions by tick を、input state, command parameters, および actions optionsextract an action sequence することを trying した結果とする。

  6. input state, actions by tick, navigable, および actions optionsTry to dispatch actions する。

  7. data null とともに success を返す。

7.9.3.2. input.releaseActions コマンド

input.releaseActions コマンドは、現在の session に関連付けられた input state を reset する。

コマンド型
input.ReleaseActions = (
    method: "input.releaseActions",
    params: input.ReleaseActionsParameters
    )

    input.ReleaseActionsParameters = {
    context: browsingContext.BrowsingContext,
    }
    
返却型
input.ReleaseActionsResult = EmptyResult
    

session および command parameters が与えられたときの remote end steps は次のとおりである:

  1. navigable idcommand parameterscontext field の値とする。

  2. navigable を、navigable idget a navigable することを trying した結果とする。

  3. top-level traversablenavigabletop-level traversable とする。

  4. input state を、session および top-level traversableget the input state した結果とする。

  5. actions options を、is element origin steps が is input.ElementOrigin に設定され、かつ get element origin steps が session が与えられたものとして get Element from input.ElementOrigin steps した結果に設定された、新しい actions options とする。

  6. undo actions を、逆順の input stateinput cancel list とする。

  7. undo actions, 0, navigable, および actions optionsTry to dispatch tick actions する。

  8. session および top-level traversableReset the input state する。

  9. data null とともに success を返す。

7.9.3.3. input.setFiles コマンド

input.setFiles コマンドは、type file を持つ指定された input element の files property を file paths の set に設定する。

コマンド型
input.SetFiles = (
    method: "input.setFiles",
    params: input.SetFilesParameters
    )

    input.SetFilesParameters = {
    context: browsingContext.BrowsingContext,
    element: script.SharedReference,
    files: [*text]
    }
    
返却型
input.SetFilesResult = EmptyResult
    

session および command parameters が与えられたときの remote end steps は次のとおりである:

  1. navigable idcommand parameters["context"] field の値とする。

  2. navigable を、 navigable idget a navigable することを trying した結果とする。

  3. documentnavigableactive document とする。

  4. environment settings を、 relevant global objectassociated Documentdocument である environment settings object とする。

  5. realmenvironment settingsrealm execution context の Realm component とする。

  6. element を、 command parameters["element"], realm, および sessiondeserialize remote reference することを trying した結果とする。

  7. elementElement を実装していない場合、 no such element error code とともに error を返す。

  8. elementHTMLInputElement を実装していない、 elementtypeFile Upload state にない、または elementdisabled である場合、 unable to set file input error code とともに error を返す。

  9. filessize が 1 より大きく、かつ elementmultiple attribute が設定されていない場合、unable to set file input error code とともに error を返す。

  10. filescommand parameters["files"] field の値とする。

  11. selected fileselementselected files とする。

  12. filesselected filesintersectionsizeselected filessize と等しく、かつ filessize と等しい場合、element が与えられたものとして user interaction task source 上で queue an element task し、 bubbles attribute が true に初期化された、element に対する cancel という名前の event を fire する。

    注: ブラウザーにおける cancellation は通常、 file selection の変更により決定される。言い換えれば、変更がない場合、"cancel" event が送信される。

  13. そうでなければ、files を user の selection として element に対して update the file selection する。

  14. 何らかの理由により、remote end が elementselected filesfiles で与えられた paths を持つ files に設定できない場合、 unsupported operation error code とともに error を返す。

    注: 例えば remote ends は、 filesystem 上に現在存在しない files に selected files を設定できない場合がある。

  15. data null とともに success を返す。

7.9.4. イベント

7.9.4.1. input.fileDialogOpened イベント
イベント型
input.FileDialogOpened = (
    method: "input.fileDialogOpened",
    params: input.FileDialogInfo
    )

    input.FileDialogInfo = {
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext,
    ? element: script.SharedReference,
    multiple: bool,
    }
    

WebDriver BiDi file picker options は、boolean である multiple という名前の item を持つ struct である。

remote end event trigger は、 element element および、任意で WebDriver BiDi file picker options file picker options(既定: null)が与えられたときの WebDriver BiDi file dialog opened steps である:

注: 他の user prompt handlers とは異なり、既定の behavior は file dialog が opened されることを許可することである。

  1. navigable を、elementnode documentnavigable とする。

  2. navigable idnavigablenavigable id とする。

  3. user context id を、navigableassociated user contextuser context id とする。

  4. multiplefalse とする。

  5. element が null でなく、かつ elementmultiple attribute が設定されている場合、 multipletrue に設定する。

  6. file picker options が null でなく、かつ file picker optionsmultiple が true である場合、 multipletrue に設定する。

  7. related navigables を、navigable を含む set とする。

  8. "input.fileDialogOpened" および related navigables が与えられたときの set of sessions for which an event is enabled 内の各 session について:

    1. params を、context field が navigable id に、 userContext field が user context id に、かつ multiple field が multiple に設定された input.FileDialogInfo production に一致する map とする。

    2. element が null でない場合:

      1. shared id を、element および sessionget shared id for a node した結果とする。

      2. params["element"] を shared id に設定する。

    3. body を、params field が params に設定された input.fileDialogOpened production に一致する map とする。

    4. session および bodyEmit an event する。

  9. dismissed を false とする。

  10. active BiDi sessions 内の各 session について:

    1. user prompt handlersessionuser prompt handler とする。

    2. user prompt handler が null でない場合:

    3. Assert user prompt handlermap である。

    4. user prompt handler が "file" を contains する場合:

      1. user prompt handler["file"] が "ignore" と等しくない場合、dismissed を true に設定する。

    5. そうでなく、user prompt handler が "default" を contains し、かつ user prompt handler["default"] が "ignore" と等しくない場合、dismissed を true に設定する。

  11. dismissed を返す。

7.10. webExtension モジュール

webExtension モジュールは、web extensions の管理およびそれらとの interaction のための機能を含む。

7.10.1. 定義

remote end definition

WebExtensionCommand = (
    webExtension.Install //
    webExtension.Uninstall
    )
    

local end definition

WebExtensionResult = (
    webExtension.InstallResult /
    webExtension.UninstallResult
    )
    

7.10.2.

7.10.2.1. webExtension.Extension 型
webExtension.Extension = text
    

webExtension.Extension 型は、remote end 内の web extension id を表す。

7.10.3. コマンド

7.10.3.1. webExtension.install コマンド

webExtension.install コマンドは、remote end に web extension を install する。

コマンド型
webExtension.Install = (
    method: "webExtension.install",
    params: webExtension.InstallParameters
    )

    webExtension.InstallParameters = {
    extensionData: webExtension.ExtensionData,
    }

    webExtension.ExtensionData = (
    webExtension.ExtensionArchivePath /
    webExtension.ExtensionBase64Encoded /
    webExtension.ExtensionPath
    )

    webExtension.ExtensionPath = {
    type: "path",
    path: text,
    }

    webExtension.ExtensionArchivePath = {
    type: "archivePath",
    path: text,
    }

    webExtension.ExtensionBase64Encoded = {
    type: "base64",
    value: text,
    }
    
返却型
webExtension.InstallResult = {
    extension: webExtension.Extension
    }
    
bytes が与えられたときに zip archive を extract する には:
  1. zip compression algorithm を使用して bytes を decode する implementation-defined steps を実行する。 TODO: zip decoding のより良い reference を見つける。

  2. 直前の step が失敗した場合(例えば bytes が有効な zip-compressed data を表していなかったため)、error code invalid web extension とともに error を返す。そうでなければ entry を、展開された filesystem entries を含む directory entry とする。

  3. entry を返す。

extension data spec が与えられたときに web extension data spec を expand する には:
  1. typeextension data spec["type"] とする。

  2. type を使用した web extension の install がサポートされていない場合、 unsupported operation error code とともに error を返す。

  3. 次の conditions と関連 steps の list において、関連する condition が true である最初の steps の set を実行する:

    type が文字列 "path" である
    1. pathextension data spec["path"] とする。

    2. locator を、file system の root に対応する root と、path である path を持つ directory locator とする。

    3. entry を、locator が与えられたものとして locate an entry した結果とする。

    type が文字列 "archivePath" である
    1. archive pathextension data spec["path"] とする。

    2. locator を、file system の root に対応する root と、archive path である path を持つ file locator とする。

    3. archive entry を、locator が与えられたものとして locate an entry した結果とする。

    4. archive entry が null である場合、null を返す。

    5. bytesarchive entrybinary data とする。

    6. entry を、bytes が与えられたものとして extract a zip archive することを trying した結果とする。

    type が文字列 "base64" である
    1. bytesextension data spec["value"] を forgiving-base64 decode した結果とする。

    2. bytes が failure である場合、null を返す。

    3. entry を、bytes が与えられたものとして extract a zip archive することを trying した結果とする。

  4. entry を返す。

command parameters を伴う remote end steps は次のとおりである:
  1. web extensions の install がサポートされていない場合、error code unsupported operation とともに error を返す。

  2. extension data speccommand parameters["extensionData"] とする。

  3. extension directory entry を、extension data specexpand a web extension data spec することを trying した結果とする。

  4. extension directory entry が null である場合、invalid web extension error code とともに error を返す。

  5. extension directory entry から web extension を install する implementation-defined steps を実行する。 これが失敗した場合、invalid web extension error code とともに error を返す。 そうでなければ extension id を、新たに install された web extension の unique identifier とする。

  6. result を、 extension field が extension id に設定された webExtension.InstallResult production に一致する map とする。

  7. data result とともに success を返す。

注: Browsers は既定で web extension を一時的にのみ install する場合があり、そのため次回 shutdown 時に自動的に uninstall される。

7.10.3.2. webExtension.uninstall コマンド

webExtension.uninstall コマンドは、 remote end について web extension を uninstall する。

コマンド型
webExtension.Uninstall = (
    method: "webExtension.uninstall",
    params: webExtension.UninstallParameters
    )

    webExtension.UninstallParameters = {
    extension: webExtension.Extension,
    }
    
返却型
webExtension.UninstallResult = EmptyResult
    
command parameters を伴う remote end steps は次のとおりである:
  1. extensioncommand parameters["extension"] とする。

  2. remote endextension と等しい id を持つ web extension を持たない場合、no such web extension error code とともに error を返す。

  3. remote end から web extension を削除する implementation-defined steps を実行する。これが失敗した場合、unknown error error code とともに error を返す。

  4. data null とともに success を返す。

8. 他の仕様へのパッチ

この仕様は、必要な integration points を提供するため、外部仕様へのいくつかの変更を必要とする。 これらの patches は standards process の一部として他の仕様へ commit されるものと想定される。

8.1. HTML

report an error algorithm は、末尾に追加の step を加えて変更される:

  1. 外部仕様で定義された任意の error reporting steps を、script, line, col, message, および error が handled であれば true、そうでなければ false とともに呼び出す。

8.2. Console

他の仕様は console steps を定義できる。

  1. Printer operation が arguments name, printerArgs および options(argument が提供されない場合は undefined) とともに呼び出される時点で、外部仕様で定義された任意の console steps を arguments name, printerArgs, および options とともに呼び出す。

8.3. CSS

8.3.1. device pixel ratio の決定

determine the device pixel ratio algorithm の先頭に、 次の steps を挿入する:

  1. device pixel ratio overrideswindownavigablecontains する場合、device pixel ratio overrides[windownavigable] を返す。

9. 付録

この節は非規範的である。

9.1. 外部仕様

注: この list は網羅的ではなく、最新でない可能性がある。

次の外部仕様は、追加の WebDriver BiDi modules を定義する:

  1. Digital Credentials API

  2. Permissions

  3. nav-speculation

  4. User-Agent Client Hints

  5. Web Bluetooth

索引

この仕様で定義される用語

参照により定義される用語

参考文献

規範的参考文献

[ACCNAME-1.1]
Joanmarie Diggs; Bryan Garaventa; Michael Cooper. Accessible Name and Description Computation 1.1. URL: https://w3c.github.io/accname/
[CONSOLE]
Dominic Farolino; Robert Kowalski; Terin Stock. Console Standard. Living Standard. URL: https://console.spec.whatwg.org/
[COOKIES]
A. Barth. HTTP State Management Mechanism. 2011 年 4 月. Proposed Standard. URL: https://httpwg.org/specs/rfc6265.html
[CORE-AAM-1.1]
Joanmarie Diggs; et al. Core Accessibility API Mappings 1.1. URL: https://w3c.github.io/core-aam/
[CSS-COLOR-ADJUST-1]
Elika Etemad; et al. CSS Color Adjustment Module Level 1. URL: https://drafts.csswg.org/css-color-adjust-1/
[CSS-OVERFLOW-3]
Elika Etemad; Florian Rivoal. CSS Overflow Module Level 3. URL: https://drafts.csswg.org/css-overflow-3/
[CSS-PAINT-API-1]
Ian Kilpatrick; Dean Jackson. CSS Painting API Level 1. URL: https://drafts.css-houdini.org/css-paint-api-1/
[CSS2]
Bert Bos; et al. Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification. URL: https://drafts.csswg.org/css2/
[CSSOM-VIEW-1]
Simon Fraser; Emilio Cobos Álvarez. CSSOM View Module. URL: https://drafts.csswg.org/cssom-view/
[DOM]
Anne van Kesteren. DOM Standard. Living Standard. URL: https://dom.spec.whatwg.org/
[ECMA-402]
ECMAScript Internationalization API Specification. URL: https://tc39.es/ecma402/
[ECMAScript]
ECMAScript Language Specification. URL: https://tc39.es/ecma262/multipage/
[ENCODING]
Anne van Kesteren. Encoding Standard. Living Standard. URL: https://encoding.spec.whatwg.org/
[FETCH]
Anne van Kesteren. Fetch Standard. Living Standard. URL: https://fetch.spec.whatwg.org/
[FS]
Austin Sullivan. File System Standard. Living Standard. URL: https://fs.spec.whatwg.org/
[FULLSCREEN]
Philip Jägenstedt. Fullscreen API Standard. Living Standard. URL: https://fullscreen.spec.whatwg.org/
[GEOLOCATION]
Marcos Caceres; Reilly Grant. Geolocation. URL: https://w3c.github.io/geolocation/
[GEOMETRY-1]
Sebastian Zartner; Yehonatan Daniv. Geometry Interfaces Module Level 1. URL: https://drafts.csswg.org/geometry/
[HR-TIME-3]
Yoav Weiss. High Resolution Time. URL: https://w3c.github.io/hr-time/
[HTML]
Anne van Kesteren; et al. HTML Standard. Living Standard. URL: https://html.spec.whatwg.org/multipage/
[INFRA]
Anne van Kesteren; Domenic Denicola. Infra Standard. Living Standard. URL: https://infra.spec.whatwg.org/
[MIMESNIFF]
Gordon P. Hemsley. MIME Sniffing Standard. Living Standard. URL: https://mimesniff.spec.whatwg.org/
[RESOURCE-TIMING]
Yoav Weiss; Noam Rosenthal. Resource Timing. URL: https://w3c.github.io/resource-timing/
[RFC4648]
S. Josefsson. The Base16, Base32, and Base64 Data Encodings. 2006 年 10 月. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc4648
[RFC5280]
D. Cooper; et al. Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile. 2008 年 5 月. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc5280
[RFC6455]
I. Fette; A. Melnikov. The WebSocket Protocol. 2011 年 12 月. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc6455
[RFC8610]
H. Birkholz; C. Vigano; C. Bormann. Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures. 2019 年 6 月. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc8610
[RFC9110]
R. Fielding, Ed.; M. Nottingham, Ed.; J. Reschke, Ed.. HTTP Semantics. 2022 年 6 月. Internet Standard. URL: https://httpwg.org/specs/rfc9110.html
[RFC9562]
K. Davis; B. Peabody; P. Leach. Universally Unique IDentifiers (UUIDs). 2024 年 5 月. Proposed Standard. URL: https://www.rfc-editor.org/rfc/rfc9562
[SCREEN-ORIENTATION]
Marcos Caceres. Screen Orientation. URL: https://w3c.github.io/screen-orientation/
[SELECTORS-4]
Elika Etemad; Tab Atkins Jr.. Selectors Level 4. URL: https://drafts.csswg.org/selectors/
[SERVICE-WORKERS]
Monica CHINTALA; Yoshisato Yanagisawa. Service Workers Nightly. URL: https://w3c.github.io/ServiceWorker/
[SVG2]
Amelia Bellamy-Royds; et al. Scalable Vector Graphics (SVG) 2. URL: https://w3c.github.io/svgwg/svg2-draft/
[UNICODE]
The Unicode Standard. URL: https://www.unicode.org/versions/latest/
[URL]
Anne van Kesteren. URL Standard. Living Standard. URL: https://url.spec.whatwg.org/
[WEBAUDIO-1.0]
Paul Adenot; Hongchan Choi. Web Audio API. URL: https://webaudio.github.io/web-audio-api/
[WEBDRIVER]
Simon Stewart; David Burns. WebDriver. URL: https://w3c.github.io/webdriver/
[WEBIDL]
Edgar Chen; Timothy Gu. Web IDL Standard. Living Standard. URL: https://webidl.spec.whatwg.org/
[WEBSOCKETS]
Adam Rice. WebSockets Standard. Living Standard. URL: https://websockets.spec.whatwg.org/
[WEBTRANSPORT]
Nidhi Jaju; Victor Vasiliev; Jan-Ivar Bruaroey. WebTransport. URL: https://w3c.github.io/webtransport/

非規範的参考文献

[CSS-VALUES-3]
Tab Atkins Jr.; Elika Etemad. CSS Values and Units Module Level 3. URL: https://drafts.csswg.org/css-values-3/
[HTTP11]
R. Fielding, Ed.; M. Nottingham, Ed.; J. Reschke, Ed.. HTTP/1.1. 2022 年 6 月. Internet Standard. URL: https://httpwg.org/specs/rfc9112.html
[JSON-RPC]
JSON-RPC Working Group. JSON-RPC 2.0 Specification. 2013 年 1 月 4 日. URL: https://www.jsonrpc.org/specification
[RFC6265BIS]
Cookies: HTTP State Management Mechanism. Editor's Draft. URL: https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-rfc6265bis
[TOUCH-EVENTS]
Doug Schepers; et al. Touch Events. URL: https://w3c.github.io/touch-events/
[URLPattern]
Ben Kelly; Jeremy Roman; 宍戸俊哉 (Shunya Shishido). URL Pattern Standard. Living Standard. URL: https://urlpattern.spec.whatwg.org/

CDDL 索引

Remote end definition

Command = {
    id: js-uint,
    CommandData,
    Extensible,
    }

    CommandData = (
    BrowserCommand //
    BrowsingContextCommand //
    EmulationCommand //
    InputCommand //
    NetworkCommand //
    ScriptCommand //
    SessionCommand //
    StorageCommand //
    WebExtensionCommand
    )

    EmptyParams = {
    Extensible
    }

    Extensible = (*text => any)

    js-int = -9007199254740991..9007199254740991
    js-uint = 0..9007199254740991

    SessionCommand = (
    session.End //
    session.New //
    session.Status //
    session.Subscribe //
    session.Unsubscribe
    )

    session.CapabilitiesRequest = {
    ? alwaysMatch: session.CapabilityRequest,
    ? firstMatch: [*session.CapabilityRequest]
    }

    session.CapabilityRequest = {
    ? acceptInsecureCerts: bool,
    ? browserName: text,
    ? browserVersion: text,
    ? platformName: text,
    ? proxy: session.ProxyConfiguration,
    ? unhandledPromptBehavior: session.UserPromptHandler,
    Extensible
    }

    session.ProxyConfiguration = {
    session.AutodetectProxyConfiguration //
    session.DirectProxyConfiguration //
    session.ManualProxyConfiguration //
    session.PacProxyConfiguration //
    session.SystemProxyConfiguration
    }

    session.AutodetectProxyConfiguration = (
    proxyType: "autodetect",
    Extensible
    )

    session.DirectProxyConfiguration = (
    proxyType: "direct",
    Extensible
    )

    session.ManualProxyConfiguration = (
    proxyType: "manual",
    ? httpProxy: text,
    ? sslProxy: text,
    ? session.SocksProxyConfiguration,
    ? noProxy: [*text],
    Extensible
    )

    session.SocksProxyConfiguration = (
    socksProxy: text,
    socksVersion: 0..255,
    )

    session.PacProxyConfiguration = (
    proxyType: "pac",
    proxyAutoconfigUrl: text,
    Extensible
    )

    session.SystemProxyConfiguration = (
    proxyType: "system",
    Extensible
    )


    session.UserPromptHandler = {
    ? alert: session.UserPromptHandlerType,
    ? beforeUnload: session.UserPromptHandlerType,
    ? confirm: session.UserPromptHandlerType,
    ? default: session.UserPromptHandlerType,
    ? file: session.UserPromptHandlerType,
    ? prompt: session.UserPromptHandlerType,
    }

    session.UserPromptHandlerType = "accept" / "dismiss" / "ignore";

    session.Subscription = text

    session.SubscribeParameters = {
    events: [+text],
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    session.UnsubscribeByIDRequest = {
    subscriptions: [+session.Subscription],
    }

    session.UnsubscribeByAttributesRequest = {
    events: [+text],
    }

    session.Status = (
    method: "session.status",
    params: EmptyParams,
    )

    session.New = (
    method: "session.new",
    params: session.NewParameters
    )

    session.NewParameters = {
    capabilities: session.CapabilitiesRequest
    }

    session.End = (
    method: "session.end",
    params: EmptyParams
    )


    session.Subscribe = (
    method: "session.subscribe",
    params: session.SubscribeParameters
    )

    session.Unsubscribe = (
    method: "session.unsubscribe",
    params: session.UnsubscribeParameters,
    )

    session.UnsubscribeParameters = session.UnsubscribeByAttributesRequest / session.UnsubscribeByIDRequest

    BrowserCommand = (
    browser.Close //
    browser.CreateUserContext //
    browser.GetClientWindows //
    browser.GetUserContexts //
    browser.RemoveUserContext //
    browser.SetClientWindowState //
    browser.SetDownloadBehavior
    )

    browser.ClientWindow = text;

    browser.ClientWindowInfo = {
    active: bool,
    clientWindow: browser.ClientWindow,
    height: js-uint,
    state: "fullscreen" / "maximized" / "minimized" / "normal",
    width: js-uint,
    x: js-int,
    y: js-int,
    }

    browser.UserContext = text;

    browser.UserContextInfo = {
    userContext: browser.UserContext
    }

    browser.Close = (
    method: "browser.close",
    params: EmptyParams,
    )

    browser.CreateUserContext = (
    method: "browser.createUserContext",
    params: browser.CreateUserContextParameters,
    )

    browser.CreateUserContextParameters = {
    ? acceptInsecureCerts: bool,
    ? proxy: session.ProxyConfiguration,
    ? unhandledPromptBehavior: session.UserPromptHandler
    }

    browser.GetClientWindows = (
    method: "browser.getClientWindows",
    params: EmptyParams,
    )

    browser.GetUserContexts = (
    method: "browser.getUserContexts",
    params: EmptyParams,
    )

    browser.RemoveUserContext = (
    method: "browser.removeUserContext",
    params: browser.RemoveUserContextParameters
    )

    browser.RemoveUserContextParameters = {
    userContext: browser.UserContext
    }

    browser.SetClientWindowState = (
    method: "browser.setClientWindowState",
    params: browser.SetClientWindowStateParameters
    )

    browser.SetClientWindowStateParameters = {
    clientWindow: browser.ClientWindow,
    (browser.ClientWindowNamedState // browser.ClientWindowRectState)
    }

    browser.ClientWindowNamedState = (
    state: "fullscreen" / "maximized" / "minimized"
    )

    browser.ClientWindowRectState = (
    state: "normal",
    ? width: js-uint,
    ? height: js-uint,
    ? x: js-int,
    ? y: js-int,
    )

    browser.SetDownloadBehavior = (
    method: "browser.setDownloadBehavior",
    params: browser.SetDownloadBehaviorParameters
    )

    browser.SetDownloadBehaviorParameters = {
    downloadBehavior: browser.DownloadBehavior / null,
    ? userContexts: [+browser.UserContext]
    }

    browser.DownloadBehavior = {
    (
        browser.DownloadBehaviorAllowed //
        browser.DownloadBehaviorDenied
    )
    }

    browser.DownloadBehaviorAllowed = (
    type: "allowed",
    destinationFolder: text
    )

    browser.DownloadBehaviorDenied = (
    type: "denied"
    )

    BrowsingContextCommand = (
    browsingContext.Activate //
    browsingContext.CaptureScreenshot //
    browsingContext.Close //
    browsingContext.Create //
    browsingContext.GetTree //
    browsingContext.HandleUserPrompt //
    browsingContext.LocateNodes //
    browsingContext.Navigate //
    browsingContext.Print //
    browsingContext.Reload //
    browsingContext.SetBypassCSP //
    browsingContext.SetViewport //
    browsingContext.TraverseHistory
    )

    browsingContext.BrowsingContext = text;

    browsingContext.Locator = (
    browsingContext.AccessibilityLocator /
    browsingContext.CssLocator /
    browsingContext.ContextLocator /
    browsingContext.InnerTextLocator /
    browsingContext.XPathLocator
    )

    browsingContext.AccessibilityLocator = {
    type: "accessibility",
    value: {
        ? name: text,
        ? role: text,
    }
    }

    browsingContext.CssLocator = {
    type: "css",
    value: text
    }

    browsingContext.ContextLocator = {
    type: "context",
    value: {
        context: browsingContext.BrowsingContext,
    }
    }

    browsingContext.InnerTextLocator = {
    type: "innerText",
    value: text,
    ? ignoreCase: bool
    ? matchType: "full" / "partial",
    ? maxDepth: js-uint,
    }

    browsingContext.XPathLocator = {
    type: "xpath",
    value: text
    }

    browsingContext.Navigation = text;

    browsingContext.ReadinessState = "none" / "interactive" / "complete"

    browsingContext.UserPromptType = "alert" / "beforeunload" / "confirm" / "prompt";

    browsingContext.Activate = (
    method: "browsingContext.activate",
    params: browsingContext.ActivateParameters
    )

    browsingContext.ActivateParameters = {
    context: browsingContext.BrowsingContext
    }

    browsingContext.CaptureScreenshot = (
    method: "browsingContext.captureScreenshot",
    params: browsingContext.CaptureScreenshotParameters
    )

    browsingContext.CaptureScreenshotParameters = {
    context: browsingContext.BrowsingContext,
    ? origin: ("viewport" / "document") .default "viewport",
    ? format: browsingContext.ImageFormat,
    ? clip: browsingContext.ClipRectangle,
    }

    browsingContext.ImageFormat = {
    type: text,
    ? quality: 0.0..1.0,
    }

    browsingContext.ClipRectangle = (
    browsingContext.BoxClipRectangle /
    browsingContext.ElementClipRectangle
    )

    browsingContext.ElementClipRectangle = {
    type: "element",
    element: script.SharedReference
    }

    browsingContext.BoxClipRectangle = {
    type: "box",
    x: float,
    y: float,
    width: float,
    height: float
    }

    browsingContext.Close = (
    method: "browsingContext.close",
    params: browsingContext.CloseParameters
    )

    browsingContext.CloseParameters = {
    context: browsingContext.BrowsingContext,
    ? promptUnload: bool .default false
    }

    browsingContext.Create = (
    method: "browsingContext.create",
    params: browsingContext.CreateParameters
    )

    browsingContext.CreateType = "tab" / "window"

    browsingContext.CreateParameters = {
    type: browsingContext.CreateType,
    ? referenceContext: browsingContext.BrowsingContext,
    ? background: bool .default false,
    ? userContext: browser.UserContext
    }

    browsingContext.GetTree = (
    method: "browsingContext.getTree",
    params: browsingContext.GetTreeParameters
    )

    browsingContext.GetTreeParameters = {
    ? maxDepth: js-uint,
    ? root: browsingContext.BrowsingContext,
    }

    browsingContext.HandleUserPrompt = (
    method: "browsingContext.handleUserPrompt",
    params: browsingContext.HandleUserPromptParameters
    )

    browsingContext.HandleUserPromptParameters = {
    context: browsingContext.BrowsingContext,
    ? accept: bool,
    ? userText: text,
    }

    browsingContext.LocateNodes = (
    method: "browsingContext.locateNodes",
    params: browsingContext.LocateNodesParameters
    )

    browsingContext.LocateNodesParameters = {
    context: browsingContext.BrowsingContext,
    locator: browsingContext.Locator,
    ? maxNodeCount: (js-uint .ge 1),
    ? serializationOptions: script.SerializationOptions,
    ? startNodes: [ + script.SharedReference ]
    }

    browsingContext.Navigate = (
    method: "browsingContext.navigate",
    params: browsingContext.NavigateParameters
    )

    browsingContext.NavigateParameters = {
    context: browsingContext.BrowsingContext,
    url: text,
    ? wait: browsingContext.ReadinessState,
    }

    browsingContext.Print = (
    method: "browsingContext.print",
    params: browsingContext.PrintParameters
    )

    browsingContext.PrintParameters = {
    context: browsingContext.BrowsingContext,
    ? background: bool .default false,
    ? margin: browsingContext.PrintMarginParameters,
    ? orientation: ("portrait" / "landscape") .default "portrait",
    ? page: browsingContext.PrintPageParameters,
    ? pageRanges: [*(js-uint / text)],
    ? scale: (0.1..2.0) .default 1.0,
    ? shrinkToFit: bool .default true,
    }

    browsingContext.PrintMarginParameters = {
    ? bottom: (float .ge 0.0) .default 1.0,
    ? left: (float .ge 0.0) .default 1.0,
    ? right: (float .ge 0.0) .default 1.0,
    ? top: (float .ge 0.0) .default 1.0,
    }

    ; Minimum size is 1pt x 1pt. Conversion follows from
    ; https://www.w3.org/TR/css3-values/#absolute-lengths
    browsingContext.PrintPageParameters = {
    ? height: (float .ge 0.0352) .default 27.94,
    ? width: (float .ge 0.0352) .default 21.59,
    }

    browsingContext.Reload = (
    method: "browsingContext.reload",
    params: browsingContext.ReloadParameters
    )

    browsingContext.ReloadParameters = {
    context: browsingContext.BrowsingContext,
    ? ignoreCache: bool,
    ? wait: browsingContext.ReadinessState,
    }

    browsingContext.SetBypassCSP = (
    method: "browsingContext.setBypassCSP",
    params: browsingContext.SetBypassCSPParameters
    )

    browsingContext.SetBypassCSPParameters = {
    bypass: true / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    browsingContext.SetViewport = (
    method: "browsingContext.setViewport",
    params: browsingContext.SetViewportParameters
    )

    browsingContext.SetViewportParameters = {
    ? context: browsingContext.BrowsingContext,
    ? viewport: browsingContext.Viewport / null,
    ? devicePixelRatio: (float .gt 0.0) / null,
    ? userContexts: [+browser.UserContext],
    }

    browsingContext.Viewport = {
    width: js-uint,
    height: js-uint,
    }

    browsingContext.TraverseHistory = (
    method: "browsingContext.traverseHistory",
    params: browsingContext.TraverseHistoryParameters
    )

    browsingContext.TraverseHistoryParameters = {
    context: browsingContext.BrowsingContext,
    delta: js-int,
    }

    EmulationCommand = (
    emulation.SetForcedColorsModeThemeOverride //
    emulation.SetGeolocationOverride //
    emulation.SetLocaleOverride //
    emulation.SetNetworkConditions //
    emulation.SetScreenOrientationOverride //
    emulation.SetScreenSettingsOverride //
    emulation.SetScriptingEnabled //
    emulation.SetScrollbarTypeOverride //
    emulation.SetTimezoneOverride //
    emulation.SetTouchOverride //
    emulation.SetUserAgentOverride
    )


    emulation.SetForcedColorsModeThemeOverride = (
    method: "emulation.setForcedColorsModeThemeOverride",
    params: emulation.SetForcedColorsModeThemeOverrideParameters
    )

    emulation.SetForcedColorsModeThemeOverrideParameters = {
    theme: emulation.ForcedColorsModeTheme / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.ForcedColorsModeTheme = "light" / "dark"

    emulation.SetGeolocationOverride = (
    method: "emulation.setGeolocationOverride",
    params: emulation.SetGeolocationOverrideParameters
    )

    emulation.SetGeolocationOverrideParameters = {
    (
        (coordinates: emulation.GeolocationCoordinates / null) //
        (error: emulation.GeolocationPositionError)
    ),
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.GeolocationCoordinates = {
    latitude: -90.0..90.0,
    longitude: -180.0..180.0,
    ? accuracy: (float .ge 0.0) .default 1.0,
    ? altitude: float / null .default null,
    ? altitudeAccuracy: (float .ge 0.0) / null .default null,
    ? heading: (0.0...360.0) / null .default null,
    ? speed: (float .ge 0.0) / null .default null,
    }

    emulation.GeolocationPositionError = {
    type: "positionUnavailable"
    }

    emulation.SetLocaleOverride = (
    method: "emulation.setLocaleOverride",
    params: emulation.SetLocaleOverrideParameters
    )

    emulation.SetLocaleOverrideParameters = {
    locale: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetNetworkConditions = (
    method: "emulation.setNetworkConditions",
    params: emulation.SetNetworkConditionsParameters
    )

    emulation.SetNetworkConditionsParameters = {
    networkConditions: emulation.NetworkConditions / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.NetworkConditions = emulation.NetworkConditionsOffline

    emulation.NetworkConditionsOffline = {
    type: "offline"
    }

    emulation.SetScreenSettingsOverride = (
    method: "emulation.setScreenSettingsOverride",
    params: emulation.SetScreenSettingsOverrideParameters
    )

    emulation.ScreenArea = {
    width: js-uint,
    height: js-uint
    }

    emulation.SetScreenSettingsOverrideParameters = {
    screenArea: emulation.ScreenArea / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetScreenOrientationOverride = (
    method: "emulation.setScreenOrientationOverride",
    params: emulation.SetScreenOrientationOverrideParameters
    )

    emulation.ScreenOrientationNatural = "portrait" / "landscape"
    emulation.ScreenOrientationType = "portrait-primary" / "portrait-secondary" / "landscape-primary" / "landscape-secondary"

    emulation.ScreenOrientation = {
    natural: emulation.ScreenOrientationNatural,
    type: emulation.ScreenOrientationType
    }

    emulation.SetScreenOrientationOverrideParameters = {
    screenOrientation: emulation.ScreenOrientation / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetUserAgentOverride = (
    method: "emulation.setUserAgentOverride",
    params: emulation.SetUserAgentOverrideParameters
    )

    emulation.SetUserAgentOverrideParameters = {
    userAgent: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetScriptingEnabled = (
    method: "emulation.setScriptingEnabled",
    params: emulation.SetScriptingEnabledParameters
    )

    emulation.SetScriptingEnabledParameters = {
    enabled: false / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetScrollbarTypeOverride = (
    method: "emulation.setScrollbarTypeOverride",
    params: emulation.SetScrollbarTypeOverrideParameters
    )

    emulation.SetScrollbarTypeOverrideParameters = {
    scrollbarType: "classic" / "overlay" / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetTimezoneOverride = (
    method: "emulation.setTimezoneOverride",
    params: emulation.SetTimezoneOverrideParameters
    )

    emulation.SetTimezoneOverrideParameters = {
    timezone: text / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    emulation.SetTouchOverride = (
    method: "emulation.setTouchOverride",
    params: emulation.SetTouchOverrideParameters
    )

    emulation.SetTouchOverrideParameters = {
    maxTouchPoints: (js-uint .ge 1) / null,
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    NetworkCommand = (
    network.AddDataCollector //
    network.AddIntercept //
    network.ContinueRequest //
    network.ContinueResponse //
    network.ContinueWithAuth //
    network.DisownData //
    network.FailRequest //
    network.GetData //
    network.ProvideResponse //
    network.RemoveDataCollector //
    network.RemoveIntercept //
    network.SetCacheBehavior //
    network.SetExtraHeaders
    )


    network.AuthCredentials = {
    type: "password",
    username: text,
    password: text,
    }

    network.BytesValue = network.StringValue / network.Base64Value;

    network.StringValue = {
    type: "string",
    value: text,
    }

    network.Base64Value = {
    type: "base64",
    value: text,
    }

    network.Collector = text

    network.CollectorType = "blob"

    network.SameSite = "strict" / "lax" / "none" / "default"


    network.Cookie = {
        name: text,
        value: network.BytesValue,
        domain: text,
        path: text,
        size: js-uint,
        httpOnly: bool,
        secure: bool,
        sameSite: network.SameSite,
        ? expiry: js-uint,
        Extensible,
    }

    network.CookieHeader = {
        name: text,
        value: network.BytesValue,
    }

    network.DataType = "request" / "response"

    network.Header = {
    name: text,
    value: network.BytesValue,
    }

    network.Intercept = text

    network.Request = text;

    network.SetCookieHeader = {
        name: text,
        value: network.BytesValue,
        ? domain: text,
        ? httpOnly: bool,
        ? expiry: text,
        ? maxAge: js-int,
        ? path: text,
        ? sameSite: network.SameSite,
        ? secure: bool,
    }

    network.UrlPattern = (
    network.UrlPatternPattern /
    network.UrlPatternString
    )

    network.UrlPatternPattern = {
        type: "pattern",
        ?protocol: text,
        ?hostname: text,
        ?port: text,
        ?pathname: text,
        ?search: text,
    }


    network.UrlPatternString = {
        type: "string",
        pattern: text,
    }


    network.AddDataCollector = (
    method: "network.addDataCollector",
    params: network.AddDataCollectorParameters
    )

    network.AddDataCollectorParameters = {
    dataTypes: [+network.DataType],
    maxEncodedDataSize: js-uint,
    ? collectorType: network.CollectorType .default "blob",
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    }

    network.AddIntercept = (
    method: "network.addIntercept",
    params: network.AddInterceptParameters
    )

    network.AddInterceptParameters = {
    phases: [+network.InterceptPhase],
    ? contexts: [+browsingContext.BrowsingContext],
    ? urlPatterns: [*network.UrlPattern],
    }

    network.InterceptPhase = "beforeRequestSent" / "responseStarted" /
                            "authRequired"

    network.ContinueRequest = (
    method: "network.continueRequest",
    params: network.ContinueRequestParameters
    )

    network.ContinueRequestParameters = {
    request: network.Request,
    ?body: network.BytesValue,
    ?cookies: [*network.CookieHeader],
    ?headers: [*network.Header],
    ?method: text,
    ?url: text,
    }

    network.ContinueResponse = (
    method: "network.continueResponse",
    params: network.ContinueResponseParameters
    )

    network.ContinueResponseParameters = {
    request: network.Request,
    ?cookies: [*network.SetCookieHeader]
    ?credentials: network.AuthCredentials,
    ?headers: [*network.Header],
    ?reasonPhrase: text,
    ?statusCode: js-uint,
    }

    network.ContinueWithAuth = (
    method: "network.continueWithAuth",
    params: network.ContinueWithAuthParameters
    )

    network.ContinueWithAuthParameters = {
    request: network.Request,
    (network.ContinueWithAuthCredentials // network.ContinueWithAuthNoCredentials)
    }

    network.ContinueWithAuthCredentials = (
    action: "provideCredentials", 
    credentials: network.AuthCredentials
    )

    network.ContinueWithAuthNoCredentials = (
    action: "default" / "cancel"
    )

    network.DisownData = (
    method: "network.disownData",
    params: network.DisownDataParameters
    )

    network.DisownDataParameters = {
    dataType: network.DataType,
    collector: network.Collector,
    request: network.Request,
    }

    network.FailRequest = (
    method: "network.failRequest",
    params: network.FailRequestParameters
    )

    network.FailRequestParameters = {
    request: network.Request,
    }

    network.GetData = (
    method: "network.getData",
    params: network.GetDataParameters
    )

    network.GetDataParameters = {
    dataType: network.DataType,
    ? collector: network.Collector,
    ? disown: bool .default false,
    request: network.Request,
    }

    network.ProvideResponse = (
    method: "network.provideResponse",
    params: network.ProvideResponseParameters
    )

    network.ProvideResponseParameters = {
    request: network.Request,
    ?body: network.BytesValue,
    ?cookies: [*network.SetCookieHeader],
    ?headers: [*network.Header],
    ?reasonPhrase: text,
    ?statusCode: js-uint,
    }

    network.RemoveDataCollector = (
    method: "network.removeDataCollector",
    params: network.RemoveDataCollectorParameters
    )

    network.RemoveDataCollectorParameters = {
    collector: network.Collector
    }

    network.RemoveIntercept = (
    method: "network.removeIntercept",
    params: network.RemoveInterceptParameters
    )

    network.RemoveInterceptParameters = {
    intercept: network.Intercept
    }

    network.SetCacheBehavior = (
    method: "network.setCacheBehavior",
    params: network.SetCacheBehaviorParameters
    )

    network.SetCacheBehaviorParameters = {
    cacheBehavior: "default" / "bypass",
    ? contexts: [+browsingContext.BrowsingContext]
    }

    network.SetExtraHeaders = (
    method: "network.setExtraHeaders",
    params: network.SetExtraHeadersParameters
    )

    network.SetExtraHeadersParameters = {
    headers: [*network.Header]
    ? contexts: [+browsingContext.BrowsingContext]
    ? userContexts: [+browser.UserContext]
    }

    ScriptCommand = (
    script.AddPreloadScript //
    script.CallFunction //
    script.Disown //
    script.Evaluate //
    script.GetRealms //
    script.RemovePreloadScript
    )

    script.Channel = text;

    script.ChannelValue = {
    type: "channel",
    value: script.ChannelProperties,
    }

    script.ChannelProperties = {
    channel: script.Channel,
    ? serializationOptions: script.SerializationOptions,
    ? ownership: script.ResultOwnership,
    }

    script.EvaluateResult = (
    script.EvaluateResultSuccess /
    script.EvaluateResultException
    )

    script.EvaluateResultSuccess = {
    type: "success",
    result: script.RemoteValue,
    realm: script.Realm
    }

    script.EvaluateResultException = {
    type: "exception",
    exceptionDetails: script.ExceptionDetails
    realm: script.Realm
    }

    script.ExceptionDetails = {
    columnNumber: js-uint,
    exception: script.RemoteValue,
    lineNumber: js-uint,
    stackTrace: script.StackTrace,
    text: text,
    }

    script.Handle = text;

    script.InternalId = text;

    script.LocalValue = (
    script.RemoteReference /
    script.PrimitiveProtocolValue /
    script.ChannelValue /
    script.ArrayLocalValue /
    { script.DateLocalValue } /
    script.MapLocalValue /
    script.ObjectLocalValue /
    { script.RegExpLocalValue } /
    script.SetLocalValue
    )

    script.ListLocalValue = [*script.LocalValue];

    script.ArrayLocalValue = {
    type: "array",
    value: script.ListLocalValue,
    }

    script.DateLocalValue = (
    type: "date",
    value: text
    )

    script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];

    script.MapLocalValue = {
    type: "map",
    value: script.MappingLocalValue,
    }

    script.ObjectLocalValue = {
    type: "object",
    value: script.MappingLocalValue,
    }

    script.RegExpValue = {
    pattern: text,
    ? flags: text,
    }

    script.RegExpLocalValue = (
    type: "regexp",
    value: script.RegExpValue,
    )

    script.SetLocalValue = {
    type: "set",
    value: script.ListLocalValue,
    }

    script.PreloadScript = text;

    script.Realm = text;

    script.PrimitiveProtocolValue = (
    script.UndefinedValue /
    script.NullValue /
    script.StringValue /
    script.NumberValue /
    script.BooleanValue /
    script.BigIntValue
    )

    script.UndefinedValue = {
    type: "undefined",
    }

    script.NullValue = {
    type: "null",
    }

    script.StringValue = {
    type: "string",
    value: text,
    }

    script.SpecialNumber = "NaN" / "-0" / "Infinity" / "-Infinity";

    script.NumberValue = {
    type: "number",
    value: number / script.SpecialNumber,
    }

    script.BooleanValue = {
    type: "boolean",
    value: bool,
    }

    script.BigIntValue = {
    type: "bigint",
    value: text,
    }

    script.RealmType = "window" / "dedicated-worker" / "shared-worker" / "service-worker" /
                    "worker" / "paint-worklet" / "audio-worklet" / "worklet"

    script.RemoteReference = (
    script.SharedReference /
    script.RemoteObjectReference
    )

    script.SharedReference = {
    sharedId: script.SharedId

    ? handle: script.Handle,
    Extensible
    }

    script.RemoteObjectReference = {
    handle: script.Handle,

    ? sharedId: script.SharedId
    Extensible
    }

    script.RemoteValue = (
    script.PrimitiveProtocolValue /
    script.SymbolRemoteValue /
    script.ArrayRemoteValue /
    script.ObjectRemoteValue /
    script.FunctionRemoteValue /
    script.RegExpRemoteValue /
    script.DateRemoteValue /
    script.MapRemoteValue /
    script.SetRemoteValue /
    script.WeakMapRemoteValue /
    script.WeakSetRemoteValue /
    script.GeneratorRemoteValue /
    script.ErrorRemoteValue /
    script.ProxyRemoteValue /
    script.PromiseRemoteValue /
    script.TypedArrayRemoteValue /
    script.ArrayBufferRemoteValue /
    script.NodeListRemoteValue /
    script.HTMLCollectionRemoteValue /
    script.NodeRemoteValue /
    script.WindowProxyRemoteValue
    )

    script.ListRemoteValue = [*script.RemoteValue];

    script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];

    script.SymbolRemoteValue = {
    type: "symbol",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayRemoteValue = {
    type: "array",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.ObjectRemoteValue = {
    type: "object",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.FunctionRemoteValue = {
    type: "function",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.RegExpRemoteValue = {
    script.RegExpLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.DateRemoteValue = {
    script.DateLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.MapRemoteValue = {
    type: "map",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.SetRemoteValue = {
    type: "set",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue
    }

    script.WeakMapRemoteValue = {
    type: "weakmap",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.WeakSetRemoteValue = {
    type: "weakset",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.GeneratorRemoteValue = {
    type: "generator",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ErrorRemoteValue = {
    type: "error",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ProxyRemoteValue = {
    type: "proxy",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.PromiseRemoteValue = {
    type: "promise",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.TypedArrayRemoteValue = {
    type: "typedarray",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayBufferRemoteValue = {
    type: "arraybuffer",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.NodeListRemoteValue = {
    type: "nodelist",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.HTMLCollectionRemoteValue = {
    type: "htmlcollection",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.NodeRemoteValue = {
    type: "node",
    ? sharedId: script.SharedId,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.NodeProperties,
    }

    script.NodeProperties = {
    nodeType: js-uint,
    childNodeCount: js-uint,
    ? attributes: {*text => text},
    ? children: [*script.NodeRemoteValue],
    ? localName: text,
    ? mode: "open" / "closed",
    ? namespaceURI: text,
    ? nodeValue: text,
    ? shadowRoot: script.NodeRemoteValue / null,
    }

    script.WindowProxyRemoteValue = {
    type: "window",
    value: script.WindowProxyProperties,
    ? handle: script.Handle,
    ? internalId: script.InternalId
    }

    script.WindowProxyProperties = {
    context: browsingContext.BrowsingContext
    }

    script.ResultOwnership = "root" / "none"

    script.SerializationOptions = {
    ? maxDomDepth: (js-uint / null) .default 0,
    ? maxObjectDepth: (js-uint / null) .default null,
    ? includeShadowTree: ("none" / "open" / "all") .default "none",
    }

    script.SharedId = text;

    script.StackFrame = {
    columnNumber: js-uint,
    functionName: text,
    lineNumber: js-uint,
    url: text,
    }

    script.StackTrace = {
    callFrames: [*script.StackFrame],
    }

    script.RealmTarget = {
    realm: script.Realm
    }

    script.ContextTarget = {
    context: browsingContext.BrowsingContext,
    ? sandbox: text
    }

    script.Target = (
    script.ContextTarget /
    script.RealmTarget
    )

    script.AddPreloadScript = (
    method: "script.addPreloadScript",
    params: script.AddPreloadScriptParameters
    )

    script.AddPreloadScriptParameters = {
    functionDeclaration: text,
    ? arguments: [*script.ChannelValue],
    ? contexts: [+browsingContext.BrowsingContext],
    ? userContexts: [+browser.UserContext],
    ? sandbox: text
    }

    script.Disown = (
    method: "script.disown",
    params: script.DisownParameters
    )

    script.DisownParameters = {
    handles: [*script.Handle]
    target: script.Target;
    }

    script.CallFunction = (
    method: "script.callFunction",
    params: script.CallFunctionParameters
    )

    script.CallFunctionParameters = {
    functionDeclaration: text,
    awaitPromise: bool,
    target: script.Target,
    ? arguments: [*script.LocalValue],
    ? resultOwnership: script.ResultOwnership,
    ? serializationOptions: script.SerializationOptions,
    ? this: script.LocalValue,
    ? userActivation: bool .default false,
    }

    script.Evaluate = (
    method: "script.evaluate",
    params: script.EvaluateParameters
    )

    script.EvaluateParameters = {
    expression: text,
    target: script.Target,
    awaitPromise: bool,
    ? resultOwnership: script.ResultOwnership,
    ? serializationOptions: script.SerializationOptions,
    ? userActivation: bool .default false,
    }

    script.GetRealms = (
    method: "script.getRealms",
    params: script.GetRealmsParameters
    )

    script.GetRealmsParameters = {
    ? context: browsingContext.BrowsingContext,
    ? type: script.RealmType,
    }

    script.RemovePreloadScript = (
    method: "script.removePreloadScript",
    params: script.RemovePreloadScriptParameters
    )

    script.RemovePreloadScriptParameters = {
    script: script.PreloadScript
    }

    StorageCommand = (
    storage.DeleteCookies //
    storage.GetCookies //
    storage.SetCookie
    )

    storage.PartitionKey = {
    ? userContext: text,
    ? sourceOrigin: text,
    Extensible,
    }

    storage.GetCookies = (
    method: "storage.getCookies",
    params: storage.GetCookiesParameters
    )


    storage.CookieFilter = {
    ? name: text,
    ? value: network.BytesValue,
    ? domain: text,
    ? path: text,
    ? size: js-uint,
    ? httpOnly: bool,
    ? secure: bool,
    ? sameSite: network.SameSite,
    ? expiry: js-uint,
    Extensible,
    }

    storage.BrowsingContextPartitionDescriptor = {
    type: "context",
    context: browsingContext.BrowsingContext
    }

    storage.StorageKeyPartitionDescriptor = {
    type: "storageKey",
    ? userContext: text,
    ? sourceOrigin: text,
    Extensible,
    }

    storage.PartitionDescriptor = (
    storage.BrowsingContextPartitionDescriptor /
    storage.StorageKeyPartitionDescriptor
    )

    storage.GetCookiesParameters = {
    ? filter: storage.CookieFilter,
    ? partition: storage.PartitionDescriptor,
    }

    storage.SetCookie = (
    method: "storage.setCookie",
    params: storage.SetCookieParameters,
    )


    storage.PartialCookie = {
    name: text,
    value: network.BytesValue,
    domain: text,
    ? path: text,
    ? httpOnly: bool,
    ? secure: bool,
    ? sameSite: network.SameSite,
    ? expiry: js-uint,
    Extensible,
    }

    storage.SetCookieParameters = {
    cookie: storage.PartialCookie,
    ? partition: storage.PartitionDescriptor,
    }

    storage.DeleteCookies = (
    method: "storage.deleteCookies",
    params: storage.DeleteCookiesParameters,
    )

    storage.DeleteCookiesParameters = {
    ? filter: storage.CookieFilter,
    ? partition: storage.PartitionDescriptor,
    }

    InputCommand = (
    input.PerformActions //
    input.ReleaseActions //
    input.SetFiles
    )

    input.ElementOrigin = {
    type: "element",
    element: script.SharedReference
    }

    input.PerformActions = (
    method: "input.performActions",
    params: input.PerformActionsParameters
    )

    input.PerformActionsParameters = {
    context: browsingContext.BrowsingContext,
    actions: [*input.SourceActions]
    }

    input.SourceActions = (
    input.NoneSourceActions /
    input.KeySourceActions /
    input.PointerSourceActions /
    input.WheelSourceActions
    )

    input.NoneSourceActions = {
    type: "none",
    id: text,
    actions: [*input.NoneSourceAction]
    }

    input.NoneSourceAction = input.PauseAction

    input.KeySourceActions = {
    type: "key",
    id: text,
    actions: [*input.KeySourceAction]
    }

    input.KeySourceAction = (
    input.PauseAction /
    input.KeyDownAction /
    input.KeyUpAction
    )

    input.PointerSourceActions = {
    type: "pointer",
    id: text,
    ? parameters: input.PointerParameters,
    actions: [*input.PointerSourceAction]
    }

    input.PointerType = "mouse" / "pen" / "touch"

    input.PointerParameters = {
    ? pointerType: input.PointerType .default "mouse"
    }

    input.PointerSourceAction = (
    input.PauseAction /
    input.PointerDownAction /
    input.PointerUpAction /
    input.PointerMoveAction
    )

    input.WheelSourceActions = {
    type: "wheel",
    id: text,
    actions: [*input.WheelSourceAction]
    }

    input.WheelSourceAction = (
    input.PauseAction /
    input.WheelScrollAction
    )

    input.PauseAction = {
    type: "pause",
    ? duration: js-uint
    }

    input.KeyDownAction = {
    type: "keyDown",
    value: text
    }

    input.KeyUpAction = {
    type: "keyUp",
    value: text
    }

    input.PointerUpAction = {
    type: "pointerUp",
    button: js-uint,
    }

    input.PointerDownAction = {
    type: "pointerDown",
    button: js-uint,
    input.PointerCommonProperties
    }

    input.PointerMoveAction = {
    type: "pointerMove",
    x: float,
    y: float,
    ? duration: js-uint,
    ? origin: input.Origin,
    input.PointerCommonProperties
    }

    input.WheelScrollAction = {
    type: "scroll",
    x: js-int,
    y: js-int,
    deltaX: js-int,
    deltaY: js-int,
    ? duration: js-uint,
    ? origin: input.Origin .default "viewport",
    }

    input.PointerCommonProperties = (
    ? width: js-uint,
    ? height: js-uint,
    ? pressure: (0.0..1.0),
    ? tangentialPressure: (-1.0..1.0),
    ? twist: (0..359),
    ; 0 .. Math.PI / 2
    ? altitudeAngle: (0.0..1.5707963267948966),
    ; 0 .. 2 * Math.PI
    ? azimuthAngle: (0.0..6.283185307179586),
    )

    input.Origin = "viewport" / "pointer" / input.ElementOrigin

    input.ReleaseActions = (
    method: "input.releaseActions",
    params: input.ReleaseActionsParameters
    )

    input.ReleaseActionsParameters = {
    context: browsingContext.BrowsingContext,
    }

    input.SetFiles = (
    method: "input.setFiles",
    params: input.SetFilesParameters
    )

    input.SetFilesParameters = {
    context: browsingContext.BrowsingContext,
    element: script.SharedReference,
    files: [*text]
    }

    WebExtensionCommand = (
    webExtension.Install //
    webExtension.Uninstall
    )

    webExtension.Extension = text

    webExtension.Install = (
    method: "webExtension.install",
    params: webExtension.InstallParameters
    )

    webExtension.InstallParameters = {
    extensionData: webExtension.ExtensionData,
    }

    webExtension.ExtensionData = (
    webExtension.ExtensionArchivePath /
    webExtension.ExtensionBase64Encoded /
    webExtension.ExtensionPath
    )

    webExtension.ExtensionPath = {
    type: "path",
    path: text,
    }

    webExtension.ExtensionArchivePath = {
    type: "archivePath",
    path: text,
    }

    webExtension.ExtensionBase64Encoded = {
    type: "base64",
    value: text,
    }

    webExtension.Uninstall = (
    method: "webExtension.uninstall",
    params: webExtension.UninstallParameters
    )

    webExtension.UninstallParameters = {
    extension: webExtension.Extension,
    }

    

Local end definition

Message = (
    CommandResponse /
    ErrorResponse /
    Event
    )

    CommandResponse = {
    type: "success",
    id: js-uint,
    result: ResultData,
    Extensible
    }

    ErrorResponse = {
    type: "error",
    id: js-uint / null,
    error: ErrorCode,
    message: text,
    ? stacktrace: text,
    Extensible
    }

    ResultData = (
    BrowserResult /
    BrowsingContextResult /
    EmulationResult /
    InputResult /
    NetworkResult /
    ScriptResult /
    SessionResult /
    StorageResult /
    WebExtensionResult
    )

    EmptyResult = {
    Extensible
    }

    Event = {
    type: "event",
    EventData,
    Extensible
    }

    EventData = (
    BrowsingContextEvent //
    InputEvent //
    LogEvent //
    NetworkEvent //
    ScriptEvent
    )

    Extensible = (*text => any)

    js-int = -9007199254740991..9007199254740991
    js-uint = 0..9007199254740991

    ErrorCode = "invalid argument" /
                "invalid selector" /
                "invalid session id" /
                "invalid web extension" /
                "move target out of bounds" /
                "no such alert" /
                "no such network collector" /
                "no such element" /
                "no such frame" /
                "no such handle" /
                "no such history entry" /
                "no such intercept" /
                "no such network data" /
                "no such node" /
                "no such request" /
                "no such script" /
                "no such storage partition" /
                "no such user context" /
                "no such web extension" /
                "session not created" /
                "unable to capture screen" /
                "unable to close browser" /
                "unable to set cookie" /
                "unable to set file input" /
                "unavailable network data" /
                "underspecified storage partition" /
                "unknown command" /
                "unknown error" /
                "unsupported operation"

    SessionResult = (
    session.EndResult /
    session.NewResult /
    session.StatusResult /
    session.SubscribeResult /
    session.UnsubscribeResult
    )

    session.CapabilitiesRequest = {
    ? alwaysMatch: session.CapabilityRequest,
    ? firstMatch: [*session.CapabilityRequest]
    }

    session.CapabilityRequest = {
    ? acceptInsecureCerts: bool,
    ? browserName: text,
    ? browserVersion: text,
    ? platformName: text,
    ? proxy: session.ProxyConfiguration,
    ? unhandledPromptBehavior: session.UserPromptHandler,
    Extensible
    }

    session.ProxyConfiguration = {
    session.AutodetectProxyConfiguration //
    session.DirectProxyConfiguration //
    session.ManualProxyConfiguration //
    session.PacProxyConfiguration //
    session.SystemProxyConfiguration
    }

    session.AutodetectProxyConfiguration = (
    proxyType: "autodetect",
    Extensible
    )

    session.DirectProxyConfiguration = (
    proxyType: "direct",
    Extensible
    )

    session.ManualProxyConfiguration = (
    proxyType: "manual",
    ? httpProxy: text,
    ? sslProxy: text,
    ? session.SocksProxyConfiguration,
    ? noProxy: [*text],
    Extensible
    )

    session.SocksProxyConfiguration = (
    socksProxy: text,
    socksVersion: 0..255,
    )

    session.PacProxyConfiguration = (
    proxyType: "pac",
    proxyAutoconfigUrl: text,
    Extensible
    )

    session.SystemProxyConfiguration = (
    proxyType: "system",
    Extensible
    )


    session.UserPromptHandler = {
    ? alert: session.UserPromptHandlerType,
    ? beforeUnload: session.UserPromptHandlerType,
    ? confirm: session.UserPromptHandlerType,
    ? default: session.UserPromptHandlerType,
    ? file: session.UserPromptHandlerType,
    ? prompt: session.UserPromptHandlerType,
    }

    session.UserPromptHandlerType = "accept" / "dismiss" / "ignore";

    session.Subscription = text

    session.StatusResult = {
    ready: bool,
    message: text,
    }

    session.NewResult = {
    sessionId: text,
    capabilities: {
        acceptInsecureCerts: bool,
        browserName: text,
        browserVersion: text,
        platformName: text,
        setWindowRect: bool,
        userAgent: text,
        ? proxy: session.ProxyConfiguration,
        ? unhandledPromptBehavior: session.UserPromptHandler,
        ? webSocketUrl: text,
        Extensible
    }
    }

    session.EndResult = EmptyResult

    session.SubscribeResult = {
    subscription: session.Subscription,
    }

    session.UnsubscribeResult = EmptyResult

    BrowserResult = (
    browser.CloseResult /
    browser.CreateUserContextResult /
    browser.GetClientWindowsResult /
    browser.GetUserContextsResult /
    browser.RemoveUserContextResult /
    browser.SetClientWindowStateResult /
    browser.SetDownloadBehaviorResult
    )

    browser.ClientWindow = text;

    browser.ClientWindowInfo = {
    active: bool,
    clientWindow: browser.ClientWindow,
    height: js-uint,
    state: "fullscreen" / "maximized" / "minimized" / "normal",
    width: js-uint,
    x: js-int,
    y: js-int,
    }

    browser.UserContext = text;

    browser.UserContextInfo = {
    userContext: browser.UserContext
    }

    browser.CloseResult = EmptyResult

    browser.CreateUserContextResult = browser.UserContextInfo

    browser.GetClientWindowsResult = {
    clientWindows: [ * browser.ClientWindowInfo]
    }

    browser.GetUserContextsResult = {
    userContexts: [ + browser.UserContextInfo]
    }

    browser.RemoveUserContextResult = EmptyResult

    browser.SetClientWindowStateResult = browser.ClientWindowInfo

    browser.SetDownloadBehaviorResult = EmptyResult

    BrowsingContextResult = (
    browsingContext.ActivateResult /
    browsingContext.CaptureScreenshotResult /
    browsingContext.CloseResult /
    browsingContext.CreateResult /
    browsingContext.GetTreeResult /
    browsingContext.HandleUserPromptResult /
    browsingContext.LocateNodesResult /
    browsingContext.NavigateResult /
    browsingContext.PrintResult /
    browsingContext.ReloadResult /
    browsingContext.SetBypassCSPResult /
    browsingContext.SetViewportResult /
    browsingContext.TraverseHistoryResult
    )

    BrowsingContextEvent = (
    browsingContext.ContextCreated //
    browsingContext.ContextDestroyed //
    browsingContext.DomContentLoaded //
    browsingContext.DownloadEnd //
    browsingContext.DownloadWillBegin //
    browsingContext.FragmentNavigated //
    browsingContext.HistoryUpdated //
    browsingContext.Load //
    browsingContext.NavigationAborted //
    browsingContext.NavigationCommitted //
    browsingContext.NavigationFailed //
    browsingContext.NavigationStarted //
    browsingContext.UserPromptClosed //
    browsingContext.UserPromptOpened
    )

    browsingContext.BrowsingContext = text;

    browsingContext.InfoList = [*browsingContext.Info]

    browsingContext.Info = {
    children: browsingContext.InfoList / null,
    clientWindow: browser.ClientWindow,
    context: browsingContext.BrowsingContext,
    originalOpener: browsingContext.BrowsingContext / null,
    url: text,
    userContext: browser.UserContext,
    ? parent: browsingContext.BrowsingContext / null,
    }

    browsingContext.Locator = (
    browsingContext.AccessibilityLocator /
    browsingContext.CssLocator /
    browsingContext.ContextLocator /
    browsingContext.InnerTextLocator /
    browsingContext.XPathLocator
    )

    browsingContext.AccessibilityLocator = {
    type: "accessibility",
    value: {
        ? name: text,
        ? role: text,
    }
    }

    browsingContext.CssLocator = {
    type: "css",
    value: text
    }

    browsingContext.ContextLocator = {
    type: "context",
    value: {
        context: browsingContext.BrowsingContext,
    }
    }

    browsingContext.InnerTextLocator = {
    type: "innerText",
    value: text,
    ? ignoreCase: bool
    ? matchType: "full" / "partial",
    ? maxDepth: js-uint,
    }

    browsingContext.XPathLocator = {
    type: "xpath",
    value: text
    }

    browsingContext.Navigation = text;

    browsingContext.BaseNavigationInfo = (
    context: browsingContext.BrowsingContext,
    navigation: browsingContext.Navigation / null,
    timestamp: js-uint,
    url: text,
    ? userContext: browser.UserContext,
    )

    browsingContext.NavigationInfo = {
    browsingContext.BaseNavigationInfo
    }

    browsingContext.UserPromptType = "alert" / "beforeunload" / "confirm" / "prompt";

    browsingContext.ActivateResult = EmptyResult

    browsingContext.CaptureScreenshotResult = {
    data: text
    }

    browsingContext.CloseResult = EmptyResult

    browsingContext.CreateResult = {
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext
    }

    browsingContext.GetTreeResult = {
    contexts: browsingContext.InfoList
    }

    browsingContext.HandleUserPromptResult = EmptyResult

    browsingContext.LocateNodesResult = {
        nodes: [ * script.NodeRemoteValue ]
    }

    browsingContext.NavigateResult = {
    navigation: browsingContext.Navigation / null,
    url: text,
    }

    browsingContext.PrintResult = {
    data: text
    }

    browsingContext.ReloadResult = browsingContext.NavigateResult

    browsingContext.SetBypassCSPResult = EmptyResult

    browsingContext.SetViewportResult = EmptyResult

    browsingContext.TraverseHistoryResult = EmptyResult

    browsingContext.ContextCreated = (
    method: "browsingContext.contextCreated",
    params: browsingContext.Info
    )

    browsingContext.ContextDestroyed = (
    method: "browsingContext.contextDestroyed",
    params: browsingContext.Info
    )

    browsingContext.NavigationStarted = (
    method: "browsingContext.navigationStarted",
    params: browsingContext.NavigationInfo
    )

    browsingContext.FragmentNavigated = (
    method: "browsingContext.fragmentNavigated",
    params: browsingContext.NavigationInfo
    )

    browsingContext.HistoryUpdated = (
    method: "browsingContext.historyUpdated",
    params: browsingContext.HistoryUpdatedParameters
    )

    browsingContext.HistoryUpdatedParameters = {
    context: browsingContext.BrowsingContext,
    timestamp: js-uint,
    url: text,
    ? userContext: browser.UserContext
    }

    browsingContext.DomContentLoaded = (
    method: "browsingContext.domContentLoaded",
    params: browsingContext.NavigationInfo
    )

    browsingContext.Load = (
    method: "browsingContext.load",
    params: browsingContext.NavigationInfo
    )

    browsingContext.DownloadWillBegin = (
    method: "browsingContext.downloadWillBegin",
    params: browsingContext.DownloadWillBeginParams
    )

    browsingContext.DownloadWillBeginParams = {
    suggestedFilename: text,
    browsingContext.BaseNavigationInfo
    }

    browsingContext.DownloadEnd = (
    method: "browsingContext.downloadEnd",
    params: browsingContext.DownloadEndParams
    )

    browsingContext.DownloadEndParams = {
    (
        browsingContext.DownloadCanceledParams //
        browsingContext.DownloadCompleteParams
    )
    }

    browsingContext.DownloadCanceledParams = (
    status: "canceled",
    browsingContext.BaseNavigationInfo
    )

    browsingContext.DownloadCompleteParams = (
    status: "complete",
    filepath: text / null,
    browsingContext.BaseNavigationInfo
    )

    browsingContext.NavigationAborted = (
    method: "browsingContext.navigationAborted",
    params: browsingContext.NavigationInfo
    )

    browsingContext.NavigationCommitted = (
    method: "browsingContext.navigationCommitted",
    params: browsingContext.NavigationInfo
    )

    browsingContext.NavigationFailed = (
    method: "browsingContext.navigationFailed",
    params: browsingContext.NavigationInfo
    )

    browsingContext.UserPromptClosed = (
    method: "browsingContext.userPromptClosed",
    params: browsingContext.UserPromptClosedParameters
    )

    browsingContext.UserPromptClosedParameters = {
    context: browsingContext.BrowsingContext,
    accepted: bool,
    type: browsingContext.UserPromptType,
    ? userContext: browser.UserContext,
    ? userText: text
    }

    browsingContext.UserPromptOpened = (
    method: "browsingContext.userPromptOpened",
    params: browsingContext.UserPromptOpenedParameters
    )

    browsingContext.UserPromptOpenedParameters = {
    context: browsingContext.BrowsingContext,
    handler: session.UserPromptHandlerType,
    message: text,
    type: browsingContext.UserPromptType,
    ? userContext: browser.UserContext,
    ? defaultValue: text
    }

    EmulationResult = (
    emulation.SetForcedColorsModeThemeOverrideResult /
    emulation.SetGeolocationOverrideResult /
    emulation.SetLocaleOverrideResult /
    emulation.SetScreenOrientationOverrideResult /
    emulation.SetScriptingEnabledResult /
    emulation.SetScrollbarTypeOverrideResult /
    emulation.SetTimezoneOverrideResult /
    emulation.SetTouchOverrideResult /
    emulation.SetUserAgentOverrideResult
    )

    emulation.SetForcedColorsModeThemeOverrideResult = EmptyResult

    emulation.SetGeolocationOverrideResult = EmptyResult

    emulation.SetLocaleOverrideResult = EmptyResult

    emulation.SetNetworkConditionsResult = EmptyResult

    emulation.SetScreenSettingsOverrideResult = EmptyResult

    emulation.SetScreenOrientationOverrideResult = EmptyResult

    emulation.SetUserAgentOverrideResult = EmptyResult

    emulation.SetScriptingEnabledResult = EmptyResult

    emulation.SetScrollbarTypeOverrideResult = EmptyResult

    emulation.SetTimezoneOverrideResult = EmptyResult

    emulation.SetTouchOverrideResult = EmptyResult

    NetworkResult = (
    network.AddDataCollectorResult /
    network.AddInterceptResult /
    network.ContinueRequestResult /
    network.ContinueResponseResult /
    network.ContinueWithAuthResult /
    network.DisownDataResult /
    network.FailRequestResult /
    network.GetDataResult /
    network.ProvideResponseResult /
    network.RemoveDataCollectorResult /
    network.RemoveInterceptResult /
    network.SetCacheBehaviorResult /
    network.SetExtraHeadersResult
    )

    NetworkEvent = (
        network.AuthRequired //
        network.BeforeRequestSent //
        network.FetchError //
        network.ResponseCompleted //
        network.ResponseStarted
    )


    network.AuthChallenge = {
    scheme: text,
    realm: text,
    }

    network.BaseParameters = (
        context: browsingContext.BrowsingContext / null,
        isBlocked: bool,
        navigation: browsingContext.Navigation / null,
        redirectCount: js-uint,
        request: network.RequestData,
        timestamp: js-uint,
        ? userContext: browser.UserContext / null,
        ? intercepts: [+network.Intercept]
    )

    network.BytesValue = network.StringValue / network.Base64Value;

    network.StringValue = {
    type: "string",
    value: text,
    }

    network.Base64Value = {
    type: "base64",
    value: text,
    }

    network.Collector = text

    network.CollectorType = "blob"

    network.SameSite = "strict" / "lax" / "none" / "default"


    network.Cookie = {
        name: text,
        value: network.BytesValue,
        domain: text,
        path: text,
        size: js-uint,
        httpOnly: bool,
        secure: bool,
        sameSite: network.SameSite,
        ? expiry: js-uint,
        Extensible,
    }

    network.DataType = "request" / "response"

    network.FetchTimingInfo = {
        timeOrigin: float,
        requestTime: float,
        redirectStart: float,
        redirectEnd: float,
        fetchStart: float,
        dnsStart: float,
        dnsEnd: float,
        connectStart: float,
        connectEnd: float,
        tlsStart: float,

        requestStart: float,
        responseStart: float,

        responseEnd: float,
    }

    network.Header = {
    name: text,
    value: network.BytesValue,
    }

    network.Initiator = {
        ? columnNumber: js-uint,
        ? lineNumber: js-uint,
        ? request: network.Request,
        ? stackTrace: script.StackTrace,
        ? type: "parser" / "script" / "preflight" / "other"
    }

    network.Intercept = text

    network.Request = text;

    network.RequestData = {
        request: network.Request,
        url: text,
        method: text,
        headers: [*network.Header],
        cookies: [*network.Cookie],
        headersSize: js-uint,
        bodySize: js-uint / null,
        destination: text,
        initiatorType: text / null,
        timings: network.FetchTimingInfo,
    }

    network.ResponseContent = {
        size: js-uint
    }

    network.ResponseData = {
        url: text,
        protocol: text,
        status: js-uint,
        statusText: text,
        fromCache: bool,
        headers: [*network.Header],
        mimeType: text,
        bytesReceived: js-uint,
        headersSize: js-uint / null,
        bodySize: js-uint / null,
        content: network.ResponseContent,
        ?authChallenges: [*network.AuthChallenge],
    }

    network.AddDataCollectorResult = {
    collector: network.Collector
    }

    network.AddInterceptResult = {
    intercept: network.Intercept
    }

    network.ContinueRequestResult = EmptyResult

    network.ContinueResponseResult = EmptyResult

    network.ContinueWithAuthResult = EmptyResult

    network.DisownDataResult = EmptyResult

    network.FailRequestResult = EmptyResult

    network.GetDataResult = {
    bytes: network.BytesValue,
    }

    network.ProvideResponseResult = EmptyResult

    network.RemoveDataCollectorResult = EmptyResult

    network.RemoveInterceptResult = EmptyResult

    network.SetCacheBehaviorResult = EmptyResult

    network.SetExtraHeadersResult = EmptyResult

    network.AuthRequired = (
    method: "network.authRequired",
    params: network.AuthRequiredParameters
    )

    network.AuthRequiredParameters = {
    network.BaseParameters,
    response: network.ResponseData
    }

    network.BeforeRequestSent = (
    method: "network.beforeRequestSent",
    params: network.BeforeRequestSentParameters
    )

    network.BeforeRequestSentParameters = {
    network.BaseParameters,
    ? initiator: network.Initiator,
    }

    network.FetchError = (
    method: "network.fetchError",
    params: network.FetchErrorParameters
    )

    network.FetchErrorParameters = {
    network.BaseParameters,
    errorText: text,
    }

    network.ResponseCompleted = (
    method: "network.responseCompleted",
    params: network.ResponseCompletedParameters
    )

    network.ResponseCompletedParameters = {
    network.BaseParameters,
    response: network.ResponseData,
    }

    network.ResponseStarted = (
    method: "network.responseStarted",
    params: network.ResponseStartedParameters
    )

    network.ResponseStartedParameters = {
    network.BaseParameters,
    response: network.ResponseData,
    }

    ScriptResult = (
    script.AddPreloadScriptResult /
    script.CallFunctionResult /
    script.DisownResult /
    script.EvaluateResult /
    script.GetRealmsResult /
    script.RemovePreloadScriptResult
    )

    ScriptEvent = (
    script.Message //
    script.RealmCreated //
    script.RealmDestroyed
    )

    script.Channel = text;

    script.ChannelValue = {
    type: "channel",
    value: script.ChannelProperties,
    }

    script.ChannelProperties = {
    channel: script.Channel,
    ? serializationOptions: script.SerializationOptions,
    ? ownership: script.ResultOwnership,
    }

    script.EvaluateResult = (
    script.EvaluateResultSuccess /
    script.EvaluateResultException
    )

    script.EvaluateResultSuccess = {
    type: "success",
    result: script.RemoteValue,
    realm: script.Realm
    }

    script.EvaluateResultException = {
    type: "exception",
    exceptionDetails: script.ExceptionDetails
    realm: script.Realm
    }

    script.ExceptionDetails = {
    columnNumber: js-uint,
    exception: script.RemoteValue,
    lineNumber: js-uint,
    stackTrace: script.StackTrace,
    text: text,
    }

    script.Handle = text;

    script.InternalId = text;

    script.LocalValue = (
    script.RemoteReference /
    script.PrimitiveProtocolValue /
    script.ChannelValue /
    script.ArrayLocalValue /
    { script.DateLocalValue } /
    script.MapLocalValue /
    script.ObjectLocalValue /
    { script.RegExpLocalValue } /
    script.SetLocalValue
    )

    script.ListLocalValue = [*script.LocalValue];

    script.ArrayLocalValue = {
    type: "array",
    value: script.ListLocalValue,
    }

    script.DateLocalValue = (
    type: "date",
    value: text
    )

    script.MappingLocalValue = [*[(script.LocalValue / text), script.LocalValue]];

    script.MapLocalValue = {
    type: "map",
    value: script.MappingLocalValue,
    }

    script.ObjectLocalValue = {
    type: "object",
    value: script.MappingLocalValue,
    }

    script.RegExpValue = {
    pattern: text,
    ? flags: text,
    }

    script.RegExpLocalValue = (
    type: "regexp",
    value: script.RegExpValue,
    )

    script.SetLocalValue = {
    type: "set",
    value: script.ListLocalValue,
    }

    script.PreloadScript = text;

    script.Realm = text;

    script.PrimitiveProtocolValue = (
    script.UndefinedValue /
    script.NullValue /
    script.StringValue /
    script.NumberValue /
    script.BooleanValue /
    script.BigIntValue
    )

    script.UndefinedValue = {
    type: "undefined",
    }

    script.NullValue = {
    type: "null",
    }

    script.StringValue = {
    type: "string",
    value: text,
    }

    script.SpecialNumber = "NaN" / "-0" / "Infinity" / "-Infinity";

    script.NumberValue = {
    type: "number",
    value: number / script.SpecialNumber,
    }

    script.BooleanValue = {
    type: "boolean",
    value: bool,
    }

    script.BigIntValue = {
    type: "bigint",
    value: text,
    }

    script.RealmInfo = (
    script.WindowRealmInfo /
    script.DedicatedWorkerRealmInfo /
    script.SharedWorkerRealmInfo /
    script.ServiceWorkerRealmInfo /
    script.WorkerRealmInfo /
    script.PaintWorkletRealmInfo /
    script.AudioWorkletRealmInfo /
    script.WorkletRealmInfo
    )

    script.BaseRealmInfo = (
    realm: script.Realm,
    origin: text
    )

    script.WindowRealmInfo = {
    script.BaseRealmInfo,
    type: "window",
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext,
    ? sandbox: text
    }

    script.DedicatedWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "dedicated-worker",
    owners: [script.Realm]
    }

    script.SharedWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "shared-worker"
    }

    script.ServiceWorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "service-worker"
    }

    script.WorkerRealmInfo = {
    script.BaseRealmInfo,
    type: "worker"
    }

    script.PaintWorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "paint-worklet"
    }

    script.AudioWorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "audio-worklet"
    }

    script.WorkletRealmInfo = {
    script.BaseRealmInfo,
    type: "worklet"
    }

    script.RealmType = "window" / "dedicated-worker" / "shared-worker" / "service-worker" /
                    "worker" / "paint-worklet" / "audio-worklet" / "worklet"

    script.RemoteReference = (
    script.SharedReference /
    script.RemoteObjectReference
    )

    script.SharedReference = {
    sharedId: script.SharedId

    ? handle: script.Handle,
    Extensible
    }

    script.RemoteObjectReference = {
    handle: script.Handle,

    ? sharedId: script.SharedId
    Extensible
    }

    script.RemoteValue = (
    script.PrimitiveProtocolValue /
    script.SymbolRemoteValue /
    script.ArrayRemoteValue /
    script.ObjectRemoteValue /
    script.FunctionRemoteValue /
    script.RegExpRemoteValue /
    script.DateRemoteValue /
    script.MapRemoteValue /
    script.SetRemoteValue /
    script.WeakMapRemoteValue /
    script.WeakSetRemoteValue /
    script.GeneratorRemoteValue /
    script.ErrorRemoteValue /
    script.ProxyRemoteValue /
    script.PromiseRemoteValue /
    script.TypedArrayRemoteValue /
    script.ArrayBufferRemoteValue /
    script.NodeListRemoteValue /
    script.HTMLCollectionRemoteValue /
    script.NodeRemoteValue /
    script.WindowProxyRemoteValue
    )

    script.ListRemoteValue = [*script.RemoteValue];

    script.MappingRemoteValue = [*[(script.RemoteValue / text), script.RemoteValue]];

    script.SymbolRemoteValue = {
    type: "symbol",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayRemoteValue = {
    type: "array",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.ObjectRemoteValue = {
    type: "object",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.FunctionRemoteValue = {
    type: "function",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.RegExpRemoteValue = {
    script.RegExpLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.DateRemoteValue = {
    script.DateLocalValue,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.MapRemoteValue = {
    type: "map",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.MappingRemoteValue,
    }

    script.SetRemoteValue = {
    type: "set",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue
    }

    script.WeakMapRemoteValue = {
    type: "weakmap",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.WeakSetRemoteValue = {
    type: "weakset",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.GeneratorRemoteValue = {
    type: "generator",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ErrorRemoteValue = {
    type: "error",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ProxyRemoteValue = {
    type: "proxy",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.PromiseRemoteValue = {
    type: "promise",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.TypedArrayRemoteValue = {
    type: "typedarray",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.ArrayBufferRemoteValue = {
    type: "arraybuffer",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    }

    script.NodeListRemoteValue = {
    type: "nodelist",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.HTMLCollectionRemoteValue = {
    type: "htmlcollection",
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.ListRemoteValue,
    }

    script.NodeRemoteValue = {
    type: "node",
    ? sharedId: script.SharedId,
    ? handle: script.Handle,
    ? internalId: script.InternalId,
    ? value: script.NodeProperties,
    }

    script.NodeProperties = {
    nodeType: js-uint,
    childNodeCount: js-uint,
    ? attributes: {*text => text},
    ? children: [*script.NodeRemoteValue],
    ? localName: text,
    ? mode: "open" / "closed",
    ? namespaceURI: text,
    ? nodeValue: text,
    ? shadowRoot: script.NodeRemoteValue / null,
    }

    script.WindowProxyRemoteValue = {
    type: "window",
    value: script.WindowProxyProperties,
    ? handle: script.Handle,
    ? internalId: script.InternalId
    }

    script.WindowProxyProperties = {
    context: browsingContext.BrowsingContext
    }

    script.ResultOwnership = "root" / "none"

    script.SerializationOptions = {
    ? maxDomDepth: (js-uint / null) .default 0,
    ? maxObjectDepth: (js-uint / null) .default null,
    ? includeShadowTree: ("none" / "open" / "all") .default "none",
    }

    script.SharedId = text;

    script.StackFrame = {
    columnNumber: js-uint,
    functionName: text,
    lineNumber: js-uint,
    url: text,
    }

    script.StackTrace = {
    callFrames: [*script.StackFrame],
    }

    script.Source = {
    realm: script.Realm,
    ? context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext
    }

    script.AddPreloadScriptResult = {
    script: script.PreloadScript
    }

    script.DisownResult = EmptyResult

    script.CallFunctionResult = script.EvaluateResult

    script.GetRealmsResult = {
    realms: [*script.RealmInfo]
    }

    script.RemovePreloadScriptResult = EmptyResult

    script.Message = (
    method: "script.message",
    params: script.MessageParameters
    )

    script.MessageParameters = {
    channel: script.Channel,
    data: script.RemoteValue,
    source: script.Source,
    }

    script.RealmCreated = (
    method: "script.realmCreated",
    params: script.RealmInfo
    )

    script.RealmDestroyed = (
    method: "script.realmDestroyed",
    params: script.RealmDestroyedParameters
    )

    script.RealmDestroyedParameters = {
    realm: script.Realm
    }


    StorageResult = (
    storage.DeleteCookiesResult /
    storage.GetCookiesResult /
    storage.SetCookieResult
    )

    storage.PartitionKey = {
    ? userContext: text,
    ? sourceOrigin: text,
    Extensible,
    }

    storage.GetCookiesResult = {
    cookies: [*network.Cookie],
    partitionKey: storage.PartitionKey,
    }

    storage.SetCookieResult = {
    partitionKey: storage.PartitionKey
    }

    storage.DeleteCookiesResult = {
    partitionKey: storage.PartitionKey
    }

    LogEvent = (
    log.EntryAdded
    )

    log.Level = "debug" / "info" / "warn" / "error"

    log.Entry = (
    log.GenericLogEntry /
    log.ConsoleLogEntry /
    log.JavascriptLogEntry
    )

    log.BaseLogEntry = (
    level: log.Level,
    source: script.Source,
    text: text / null,
    timestamp: js-uint,
    ? stackTrace: script.StackTrace,
    )

    log.GenericLogEntry = {
    log.BaseLogEntry,
    type: text,
    }

    log.ConsoleLogEntry = {
    log.BaseLogEntry,
    type: "console",
    method: text,
    args: [*script.RemoteValue],
    }

    log.JavascriptLogEntry = {
    log.BaseLogEntry,
    type: "javascript",
    }

    log.EntryAdded = (
    method: "log.entryAdded",
    params: log.Entry,
    )

    InputResult = (
    input.PerformActionsResult /
    input.ReleaseActionsResult /
    input.SetFilesResult
    )

    InputEvent = (
    input.FileDialogOpened
    )

    input.PerformActionsResult = EmptyResult

    input.ReleaseActionsResult = EmptyResult

    input.SetFilesResult = EmptyResult

    input.FileDialogOpened = (
    method: "input.fileDialogOpened",
    params: input.FileDialogInfo
    )

    input.FileDialogInfo = {
    context: browsingContext.BrowsingContext,
    ? userContext: browser.UserContext,
    ? element: script.SharedReference,
    multiple: bool,
    }

    WebExtensionResult = (
    webExtension.InstallResult /
    webExtension.UninstallResult
    )

    webExtension.Extension = text

    webExtension.InstallResult = {
    extension: webExtension.Extension
    }

    webExtension.UninstallResult = EmptyResult

    

課題索引

この「event を待つ」ことを行うための、もっと良い mechanism がきっとあるはずだ。
これが event loop 上の他の tasks より前に実行されることを保証するために、 microtasks のようなものを持つべきか?
これは appendix にするべきか?
1 つの session に対して 2 つ以上の connection をサポートするか?
UTF-8 errors にどの status code が使用されるかを定義しているものはないように見える。
UA が望む場合に listener を閉じられるようにするため、session ending に hook in する必要がある。
sandbox realm の作成を定義する。これは window を wrap する SandboxWindowProxy を返すことになる。
SandboxProxy がどのように動作するかを詳細に定義する
これがどのように動作するかを定義する。
user context の concept または storage との interaction を形式的に定義する最良の方法であるかは不明。
null でない opener を持つ top-level traversables は、その opener と同じ associated user context を持つと 指定するべきか? これが既存の実装で強制されているものか確認する必要がある。
これはかなり不正確な言い方だが、connections の shutdown を開始する前に command への response を送信する、という intent が明確であることを期待する。
これは realms でも動作するように generalize する必要がある。
これは realms でも動作するように generalise する必要がある。
ignore cache flag がどのように動作するかを正確に指定する。これは、 resource の最初の load だけが cache を bypass するのか (すなわち、最初に cache を clear して通常どおり進めるのと同様なのか)、 それとも HTML parser によって直接 load されない resources (例えば scripts や stylesheets により開始される loads)も cache を bypass するのかを 考慮する必要がある。
ここで error により、何が失敗したのか、なぜ失敗したのかについて十分な情報を surface しているか? どの error code が望ましいか? local ends が実際に何が問題だったかを 把握するために implementation-defined strings を parse するような問題が起きるか?
これは update rendering algorithm に、より明示的な形で integrate されるべきである。
最後の top-level traversable を閉じるときの behavior について open discussion がある。 browser を閉じる、session を閉じる、またはこれを implementation に委ねることが考えられる。 [w3c/webdriver-bidi Issue #170]
これは update rendering algorithm に より明示的な形で integrate されるべきである。
記述されている algorithm には race condition がある。なぜなら、 target session history entry を navigate しようとする時点で、 それが存在しない可能性があるためである。history の navigate を待つことをサポートしたら、 これをより robust に処理できる。
`browsingContext.pageShow event を expose したいか? その場合、 bfcache restore のときだけでなく、`pageshow` が emit されることになるたびに これを call する必要があり、data に persisted status も追加する必要がある。
active documents を持つ browsing contexts に対してのみこの event を fire すべきかは不明である。 navigation は、contexts が inaccessible になるが bfcache のためにまだ discard されない、 ということも起こし得る。
この algorithm を screen orientation specification に移動する。
これは navigable に関連しない data の収集を防ぐ。 collector configuration に照らして確認するためには、依然として navigable を retrieve する必要があるが、 ここでは null も受け入れられる可能性がある。
これには auth を cancel する方法がない。
realm 以外の parameters も含めるべきか?
Fetch と同様、これは multiple headers、parsing issues などを扱う正しい方法か不明である。
context に加えて、request を開始した document node の `sharedId` を含めることを検討する。
"request already sent" error を検討する。
error の正確な種類を設定できるようにする [Issue #508]
Fetch の "HTTP-network-or-cache fetch" algorithm で return value を尊重する。
これは error code が間違っている
これは lone surrogates を処理しない
"stale object reference" case を処理する。
WASM types を追加するか?
WindowProxy は Node と同様の style で attributes を取得するべきか?
String / Number / etc. wrapper objects を特別に扱うか?
mirror objects の lifecycle を再検討する。
children と child nodes は異なるものである。childNodeCountchildNodes を reference するべきか、または childrenCount に rename するべきである。
これは error code が間違っている
これは error code が間違っている
TODO: script.evaluate で説明されているように timeout argument を追加する。
nested workers の場合など、realm parents も許可するようにこれを拡張するか? またはすべての ancestor workers を取得する。
literal match だけでなく、より sophisticated な filter system を持つことを望むかもしれない。
ここでの order はより明確に定義されるべきか?
これを browsing context または top-level traversable のどちらに基づいて key するか? 違いは、ある event が frame 内で発生し、その後 local end が top level navigable の log events に subscribe する前に、その frame が navigate された場合に何が起きるかにある。
さらに多くのものが logging を必要とする。CDP には LogEntryAdded types として xml, javascript, network, storage, appcache, rendering, security, deprecation, worker, violation, intervention, recommendation, other がある。これらは、 異なる methods により表される js exception および console API types に加えて存在する。
implementation-defined log types を許可する