1. 序論
この節は非規範的である。
WebDriver は、ユーザーエージェントの イントロスペクションおよび リモート制御のためのプロトコルを定義する。この仕様は、 双方向通信を導入することにより WebDriver を拡張する。WebDriver の厳密な コマンド/レスポンス形式に代えて、これによりイベントを ユーザーエージェントから制御ソフトウェアへストリーミングできるようになり、 ブラウザー DOM のイベント駆動の性質によりよく一致する。
2. 基盤
この仕様は Infra Standard に依存する。[INFRA]
ネットワークプロトコルメッセージは CDDL を用いて定義される。[RFC8610]
この仕様は、map である wait queue を定義する。
この「イベントを待つ」ことを行うための、もっとよい 仕組みがきっとあるはずだ。
並列に実行されているアルゴリズム algorithm が、イベントの集合 events および resume id を awaits するとき:
-
algorithm の実行を一時停止する。
-
表明: wait queue は resume id を含まない。
-
wait queue[resume id] を (events, algorithm) に設定する。
-
wait queue が id を含まない場合、戻る。
-
(events, algorithm) を wait queue[id] とする
-
events 内の各 event について:
-
event が name と等しい場合:
-
wait queue から id を削除する。
-
algorithm 内のステップの実行を、 一時停止された地点から再開し、name および parameters を await の結果として渡す。
これがイベントループ上の他のどのタスクよりも先に 実行されることを保証するために、microtasks のようなものを 持つべきだろうか?
-
-
WebDriver configuration は、次を持つ struct である:
-
item user contexts。これは user contexts と value の間の weak map であり、初期値は空である。
-
item navigables。これは navigables と value の間の weak map であり、 初期値は空である。
WebDriver configuration は associated 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 は:
-
top-level traversable を navigable の top-level traversable とする。
-
configuration の navigables が top-level traversable を含む場合:
-
navigable configuration value を configuration の navigables[top-level traversable] とする。
-
navigable configuration value が unset でない場合、 navigable configuration value を返す。
-
-
user context を navigable の associated user context とする。
-
configuration の user contexts が user context を含む場合:
-
user context configuration value を configuration の user contexts[user context] とする。
-
user context configuration value が unset でない場合、 user context configuration value を返す。
-
-
configuration の global を返す。
注: これは WebDriver configuration を target ごとに格納するための汎用アルゴリズムであり、target は navigable、user context のいずれか、または target が null もしくは省略された場合はグローバルに格納できる。
WebDriver configuration configuration の value value を、任意の target に store するには。これは navigable、 user context、または提供されない場合は null である:
-
target が null である場合、configuration の global を value に設定する。
-
target が user context である場合、configuration の user contexts[target] を value に設定する。
-
target が navigable である場合、configuration の navigables[target] を value に設定する。
注: この汎用アルゴリズムは、
command parameters 内の "userContexts" および "contexts" の存在に応じて、WebDriver
configuration の value
を global、user contexts、または
navigables に格納する。これらの
パラメーター
は相互に排他的である。どちらも提供されない場合、設定はグローバルに格納される。
与えられた command parameters について、WebDriver configuration configuration の value value を store WebDriver configuration するには:
-
command parameters が "
userContexts" を含み、かつ command parameters が "contexts" を含む場合、error を、error code invalid argument とともに返す。 -
affected navigables を空の set とする。
-
command parameters が "
contexts" を含む場合:-
navigables を、command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
navigables の各 navigable について:
-
-
そうでなく、command parameters が "
userContexts" を含む場合:-
user contexts を、command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
user context である associated user context を持つ、すべての top-level traversables のリスト内の 各 top-level traversable について反復する:
-
top-level traversable を affected navigables に追加する。
-
-
configuration の value を user context に store する。
-
-
-
そうでなければ:
-
すべての top-level traversables の各 top-level traversable について反復し、top-level traversable を affected navigables に追加する。
-
configuration の value をStore する。
-
-
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 }
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..9007199254740991js-uint= 0..9007199254740991
3.2. セッション
WebDriver BiDi は、session の概念を WebDriver から拡張する。
session は BiDi flag を持ち、特に明記されない限りこれは false である。
BiDi session は、session であり、その BiDi flag が true に設定されているものである。
-
BiDi sessions を新しい list とする。
-
active sessions 内の各 session について:
-
session が BiDi session である場合、session を BiDi sessions に追加する。
-
-
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
names、event names、またはプロパティ
名を定義してはならない。
外部仕様の作者には、既存のモジュールを拡張するのではなく、新しいモジュールを追加することが推奨される。 既存のモジュールを拡張することが望まれる場合は、その拡張を元のモジュール定義を含む仕様に直接統合することが望ましい。
3.4. コマンド
command は非同期 操作であり、local end によって要求され、remote end 上で実行され、 その結果として result または error のいずれかが local end に返される。 複数の コマンドを同時に実行でき、コマンドは潜在的に 長時間実行されることがある。その結果、コマンドは順序どおりでなく完了することがある。
各 command は次によって定義される:
-
command type。これは、グループを含む
remote end definition断片によって定義される。そのような各グループは 2 つのフィールドを持つ:-
method。これは[module name].[method name]形式の文字列リテラルである。これは command name である。 -
params。これはコマンドに渡されるデータを含むマッピングを定義する。 この map に値が投入されたものが command parameters である。
-
-
result type。これは
local end definition断片によって定義される。 -
コマンドに対して取る動作を定義する remote end steps の集合。 これは BiDi session および command parameters が与えられ、 コマンドの result type のインスタンスを返す。
アクティブなセッションなしで実行できるコマンドは 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 上で関心のある何かが 発生したことを通知する。
-
event type は、グループを含む
local end definition断片によって定義される。そのような各グループは 2 つのフィールドを持つ:-
method。これは[module name].[event name]形式の文字列リテラルである。これは event name である。 -
params。これはイベントデータを含むマッピングを定義する。 この map に値が投入されたものが event parameters である。
-
-
remote end event trigger。これはイベントがいつ トリガーされるか、および event type データを構築するステップを定義する。
-
任意で、remote end subscribe steps の集合。 これは、local end がイベントを購読するときに取るステップを定義する。定義される場合、 これらのステップは、関連付けられた subscribe priority を持つ。これは、複数のイベントが同時に有効化されたときにステップが実行される順序を制御する整数であり、 小さい整数ほど早く実行されるステップを示す。
BiDi session は subscriptions を持ち、これは list of subscriptions である。
BiDi session は known subscription ids を持ち、これは set であり、 local end に発行されたがまだ購読解除されていない、すべての subscription ids を含む。
subscription は、struct であり、 subscription id(文字列)、 event names(event names の set)、 top-level traversable ids(top-level traversables の ID の set) および user context ids(user contexts の ID の set)からなる。
subscription subscription は、subscription の top-level traversable ids が空の set であり、 かつ subscription の user context ids が空の set である場合、 global である。
event name および navigables が与えられたときの set of sessions for which an event is enabled は次である:
-
sessions を新しい set とする。
-
active BiDi sessions 内の各 session について:
-
session、event name および navigables で event is enabled である場合、 session を sessions に追加する。
-
-
sessions を返す。
session、 event name および navigables が与えられたとき、event is enabled であるかどうかを判定するには:
注: shared worker は複数のコンテキストに関連付けられ得るため、 navigables は set である。
-
top-level traversables を、navigables で get top-level traversables したものとする。
-
session の subscriptions 内の各 subscription について:
-
subscription の event names が event name を含まない場合、continue する。
-
subscription が global である場合、true を返す。
-
user context ids が空でない場合:
-
top-level traversables 内の各 navigable について反復する:
-
subscription の user context ids が、 navigable の associated user context の user context id を含む場合、 true を返す。
-
-
-
そうでなければ:
-
subscription top-level traversables を、subscription の top-level traversable ids で get navigables by ids したものとする。
-
top-level traversables と subscription top-level traversables の積集合が空でない場合、true を返す。
-
-
-
false を返す。
event name および session が与えられたときの set of top-level traversables for which an event is enabled は次である:
-
result を新しい set とする。
-
session の subscriptions 内の各 subscription について:
-
subscription の event names が event name を含まない場合、 continue する。
-
subscription が global である場合:
-
remote end の top-level traversables 内の各 traversable について:
-
traversable を result に追加する。
-
-
Break する。
-
-
そうでなく、user context ids が空でない場合:
-
remote end の top-level traversables 内の各 traversable について:
-
subscription の user context ids が traversable の associated user context の user context id を含む場合、 traversable を result に追加する。
-
-
-
そうでなければ:
-
top-level traversables を、subscription の top-level traversable ids で get navigables by ids したものとする。
-
top-level traversables の各項目を result に追加する。
-
-
-
result を返す。
-
events を空の set とする。
-
name が U+002E(ピリオド)を含む場合:
-
name がイベントに対する event name である場合、name を events に追加し、 data events とともに success を返す。
-
error code invalid argument を持つ error を返す
-
-
そうでなければ、name はモジュール内のすべてのイベントを表すものとして解釈される。 name が module name でない場合、error code invalid argument を持つ error を返す。
-
名前 name を持つモジュール内の各 event に対する event name を events に追加する。
-
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 listener は host、port、secure flag、および list of WebSocket resources を持つ。
WebSocket listener listener が作成されたとき、remote end は、listener の host および port によって与えられるホストおよびポート上で、 WebSocket 接続を待ち受け始めなければならない。 listener の secure 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 は、session の session WebSocket connections が connection を含む場合、connection と associated with connection している。
注: 各 WebSocket connection は、最大でも 1 つの BiDi session と関連付けられる。
クライアントが WebSocket 接続を確立するとき、すなわち connection を active listeners の集合内の listener の 1 つに接続して 確立するとき、実装は WebSocket の server-side requirements に従って進めなければならず、受信接続を 受け入れるかどうかを決定するときに次のステップを実行する:
-
resource name を、クライアントの開始ハンドシェイクを読むことから得られるリソース名とする。 resource name が listener の list of WebSocket resources 内にない場合、 これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。
-
resource name がバイト文字列 "
/session" であり、 実装が supports BiDi-only sessions する場合:-
接続を受け入れるべきかどうかを決定するための、その他の実装定義のステップを実行し、 受け入れない場合はこれらのステップの実行を停止し、 要求されたサービスが利用できないかのように動作する。
-
その接続を WebSocket connections not associated with a session に追加する。
-
戻る。
-
-
resource name で Get a session ID for a WebSocket resource し、 session id をその値とする。session id が null である場合、 これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。
-
active sessions のリスト内に、その session ID として session id を持つ session が存在する場合、session をその セッションとする。そうでなければ、これらのステップの実行を停止し、要求されたサービスが利用できないかのように動作する。
-
接続を受け入れるべきかどうかを決定するための、その他の実装定義のステップを実行し、 受け入れない場合はこれらのステップの実行を停止し、 要求されたサービスが利用できないかのように動作する。
-
そうでなければ、connection を session の session WebSocket connections に追加し、サーバーが受信接続を受け入れることを選択するときの WebSocket server-side requirements に従って進める。
WebSocket メッセージが受信されたとき、WebSocket connection connection について、型 type およびデータ data が与えられる場合、remote end は connection、 type および data が与えられたものとして handle an incoming message しなければならない。
WebSocket の終了ハンドシェイクが開始されたとき、または WebSocket 接続が閉じられたとき、WebSocket connection connection について、remote end は connection が与えられたものとして handle a connection closing しなければならない。
注: 終了ハンドシェイクなしに WebSocket 接続が閉じられる可能性があるため、 両方の条件が必要である。
session session が与えられたとき、construct a WebSocket resource name するには:
-
session が null である場合、"
/session" を返す -
文字列 "
/session/" と session の session ID を連結した結果を返す。
WebSocket listener listener および session session が与えられたとき、 construct a WebSocket URL するには:
-
resource name を、session で construct a WebSocket resource name した結果とする。
-
ホストを listener の host に設定し、ポートを listener の port に設定し、パスを resource name に設定して構築した WebSocket URI を返す。 listener の secure flag が設定されている場合は wss-URI 構成に従い、そうでなければ ws-URL 構成に従う。
resource name が与えられたとき、get a session ID for a WebSocket resource するには:
-
resource name がバイト文字列 "
/session/" で始まらない場合、null を返す。 -
session id を、resource name 内の "
/session/" 接頭辞に続くバイト列とする。 -
session id が UUID の文字列表現でない場合、null を返す。
-
session id を返す。
-
active listeners 内に、 remote end が再利用したい既存の WebSocket listener が存在する場合、 listener をその listener とする。そうでなければ、listener を、 implementation-defined な host、port、 secure flag、および空の list of WebSocket resources を持つ新しい WebSocket listener とする。
-
resource name を、session で construct a WebSocket resource name した結果とする。
-
resource name を、 listener に対する list of WebSocket resources に追加する。
-
listener を、remote end の active listeners に追加する。
-
listener を返す。
注: 複数のセッションを処理する intermediary node は、1 つまたは多数の WebSocket listener を使用できる。WebDriver は、 endpoint node が同時に最大 1 つのセッションをサポートすると定義しているため、 listener は 1 つだけであることが想定される。
注: endpoint
node では、上記ステップにおける host は
通常 "localhost" になる。
-
type が text でない場合、connection、 null、および invalid argument が与えられたものとして send an error response し、最後に 戻る。
-
Assert: data は scalar value string である。そうでなければ、WebSocket の UTF-8 符号化データ内のエラー処理 が、すでに WebSocket connection を失敗させているためである。
UTF-8 エラーにどの status code が使用されるかを定義しているものはないように思われる。
-
connection と associated with connection している BiDi Session が存在する場合、 session をそのセッションとする。そうでなく、connection が WebSocket connections not associated with a session 内にある場合、session を null とする。そうでなければ、戻る。
-
parsed を、data が与えられたものとして JSON を Infra values に構文解析する結果とする。 これが例外を投げる場合、connection、 null、および invalid argument が与えられたものとして send an error response し、 最後に戻る。
-
session が null でなく、かつ active sessions 内にない場合、戻る。
-
parsed を
remote end definitionに対して照合する。 これが 一致になる場合:-
matched を、一致したデータを表す map とする。
-
Assert: matched は "
id"、"method"、および "params" を含む。 -
command id を matched["
id"] とする。 -
method を matched["
method"] とする -
command を、command name method を持つ command とする。
-
session が null であり、かつ command が static command でない場合、 connection、command id、および invalid session id が与えられたものとして send an error response し、戻る。
-
次のステップを並列に実行する:
-
result を、 session および command parameters matched["
params"] が与えられたものとして、 command に対する remote end steps を実行した結果とする。 -
result が error である場合、 connection、command id、および result の error code が与えられたものとして send an error response し、最後に 戻る。
-
value を result の data とする。
-
Assert: value は、command name method を持つ command に対応する result type の定義に一致する。
-
method が "
session.new" である場合、session を active sessions のリスト内の、その session ID が value の "sessionId" プロパティと等しいエントリーとし、connection を session の session WebSocket connections に追加し、 connection を WebSocket connections not associated with a session から削除する。 -
response を、
local end definition内のCommandResponse生成規則に一致する新しい map とする。idフィールドは command id に設定され、valueフィールドは value に設定される。 -
serialized を、response が与えられたものとして serialize an infra value to JSON bytes した結果とする。
-
serialized からなる WebSocket メッセージを送信する。 これは connection 上で行う。
-
-
-
そうでなければ:
-
command id を null とする。
-
parsed が map であり、かつ parsed["
id"] が存在し、0 以上の integer である場合、command id をその integer に設定する。 -
error code を invalid argument とする。
-
parsed が map であり、かつ parsed["
method"] が存在し、 string であるが、parsed["method"] が set of all command names 内にない場合、 error code を unknown command に設定する。 -
connection、command id、および error code が与えられたものとして Send an error response する。
-
settings object settings が与えられたとき、get related navigables するには:
-
related navigables を空の set とする。
-
settings の relevant global object が
Windowである場合:-
navigable を、relevant global object の associated
Documentの node navigable とする。 -
navigable が null でない場合、navigable を related navigables に追加する。
-
-
そうでなく、settings によって指定される global object が
WorkerGlobalScopeである場合、 global object の owner set 内の各 owner について:-
navigable を null とする。
-
owner が Document である場合、navigable を owner の node navigable に設定する。
-
navigable が null でない場合、navigable を related navigables に追加する。
-
-
related navigables を返す。
context ids の list navigable ids が与えられたとき、get navigables by ids するには:
list of navigables navigables が与えられたとき、get top-level traversables するには:
-
result を空の set とする。
-
navigables 内の各 navigable について:
-
navigable の top-level traversable を result に追加する。
-
-
result を返す。
context ids の list navigable ids が与えられたとき、get valid navigables by ids するには:
-
result を空の set とする。
-
navigable ids 内の各 navigable id について:
-
navigable を、navigable id で get a navigable することを試みた結果とする。
-
navigable を result に追加する。
-
-
data result とともに success を返す。
context ids の list navigable ids が与えられたとき、 get valid top-level traversables by ids するには:
-
result を空の set とする。
-
navigable ids 内の各 navigable id について:
-
navigable を、navigable id で get a navigable することを試みた結果とする。
-
navigable が top-level traversable でない場合、 error を、error code invalid argument とともに返す。
-
navigable を result に追加する。
-
-
data result とともに success を返す。
-
Assert: body は
Event生成規則に一致する。 -
serialized を、body が与えられたものとして serialize an infra value to JSON bytes した結果とする。
-
session の session WebSocket connections 内の各 connection について反復する:
-
serialized からなる WebSocket メッセージを送信する。 これは connection 上で行う。
-
-
error data を、
local end definition内のErrorResponse生成規則に一致する新しい map とする。idフィールドは command id に設定され、errorフィールドは error code に設定され、messageフィールドは、発生したエラーの人間可読な定義を含む 実装定義の文字列に設定され、stacktraceフィールドは任意で、 エラーが発生した時点のアクティブなスタックフレームのスタックトレース報告を含む 実装定義の文字列に設定される。 -
response を、error data が与えられたものとして serialize an infra value to JSON bytes した結果とする。
注: command id は null になり得る。その場合、
idフィールドも null に設定され、 response から省略されるわけではない。 -
response からなる WebSocket メッセージを送信する。 これは connection 上で行う。
WebSocket connection connection が与えられたとき、handle a connection closing するには:
-
connection と associated with connection している BiDi session が存在する場合:
-
session を、connection と associated with connection している BiDi session とする。
-
connection を session の session WebSocket connections から削除する。
-
-
そうでなく、WebSocket connections not associated with a session が connection を含む場合、connection をその set から削除する。
注: これはどの session も終了させない。
session が与えられたとき、close the WebSocket connections するには:
-
session の session WebSocket connections 内の各 connection について:
-
connection で WebSocket の終了ハンドシェイクを開始する。
注: これにより、connection に対して handle a connection closing のステップが実行されることになり、connection に関連付けられたリソースが クリーンアップされる。
-
4.1. 接続の確立
WebDriver クライアントは、値 true で WebSocket URL capability を要求することにより、 双方向接続にオプトインする。
-
flags が "
bidi" を含む場合、戻る。 -
webSocketUrl を、capabilities から "
webSocketUrl" という名前のプロパティを取得する結果とする。 -
webSocketUrl が undefined である場合、戻る。
-
Assert: webSocketUrl は true である。
-
listener を、session が与えられたものとして start listening for a WebSocket connection した結果とする。
-
webSocketUrl を、listener および session で construct a WebSocket URL した結果に設定する。
-
capabilities 上の "
webSocketUrl" という名前のプロパティを webSocketUrl に設定する。 -
session の BiDi flag を true に設定する。
-
"
bidi" を flags に追加する。
実装は、HTTP Session ではない BiDi Session を クライアントが確立できるようにもするべきである。この場合、WebSocket サーバーへの URL は 帯域外で伝達される。これを許可する実装は supports BiDi-only sessions する。そのような実装が WebDriver セッションを開始する要求を 受け入れる準備ができた時点で、次を行わなければならない:
-
null が与えられたものとして Start listening for a WebSocket connection する。
5. サンドボックス化されたスクリプト実行
自動化ツールに共通する要件は、文書の DOM に アクセスできるが、その文書を含む navigable 内で実行されるスクリプトによって DOM API に加えられた変更についての情報を持たないスクリプトを 実行することである。
BiDi session は sandbox map を持ち、これは weak
map であり、その
キーは Window
オブジェクト、値は文字列と
SandboxWindowProxy
オブジェクトの間の map である。
注: ここでのサンドボックスの定義は、既存実装の 振る舞いを成文化しようとするものである。これは、仕様では以前は内部的なものと みなされていた実装の一部、特にプラットフォームオブジェクトの内部状態 (これは通常、ブラウザーエンジンの主たる実装言語におけるネイティブオブジェクトとして 実装される)と ECMAScript から見える状態との区別を公開する。既存のサンドボックス 実装はエンジン内の低レベルで行われているため、実装が仕様のすべての詳細に 収束するには遅い過程になる可能性がある。当面の間、実装者には 仕様との差異について詳細な文書を提供することが推奨され、この機能の利用者には サンドボックス内で実行されるスクリプトがすべての実装で動作することを 明示的にテストすることが推奨される。
5.1. サンドボックスレルム
各サンドボックスは一意の ECMAScript Realm である。しかし、sandbox realm は
Window
realm 内の既存のプラットフォームオブジェクトへのアクセスを、
SandboxProxy
オブジェクトを介して提供する。
-
name が空文字列である場合、error を error code invalid argument とともに返す。
-
window を navigable の active window とする。
-
sandbox map が window を含まない場合、sandbox map[window] を新しい map に設定する。
-
sandboxes を sandbox map[window] とする。
-
sandboxes が name を含まない場合、 sandboxes[name] を navigable で create a sandbox realm したものに設定する。
-
data sandboxes[name] とともに success を返す。
sandbox realm の作成を定義する。これは window をラップする
SandboxWindowProxy
を返すことになる。
target realm が与えられたとき、get a sandbox name するには:
-
realms maps を、sandbox map の値を取得するものとする。
-
realms maps 内の各 realms map について:
-
realms map 内の各 name → realm について:
-
realm が target realm である場合、name を返す。
-
-
-
null を返す。
5.2. サンドボックスプロキシオブジェクト
SandboxProxy オブジェクトは、別の realm からの
オブジェクトへのサンドボックス化されたアクセスを仲介する exotic object である。
Sandbox proxy objects は、次の制限を強制するように設計されている:
-
プラットフォームオブジェクトにはアクセスできるが、プロパティアクセスは Web IDL で定義されたプロパティのみを返し、ECMAScript で定義されたプロパティは返さない (基礎となるインターフェイスに存在しない "expando" プロパティ、 または基礎となるインターフェイス内のプロパティをシャドウする ECMAScript で定義されたプロパティのいずれも返さない)。
-
プロパティの設定は、Web IDL で定義された setter steps を実行するか、 proxy object 上にプロパティを設定する。これは、サンドボックス外で書き込まれたプロパティには アクセスできないが、インターフェイスメンバーは通常どおり使用できることを意味する。
SandboxProxy
interface object は存在しない。
SandboxProxy
がどのように機能するかを詳細に定義する
-
object が
SandboxProxyまたはSandboxWindowProxyである間、object をその wrapped object に設定する。 -
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 context は user context id を持ち、 これは user context の作成時に設定される一意の文字列である。
navigable は associated user context を持ち、これは user context である。
新しい top-level traversable が作成されると、その associated user context は set 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 navigable の associated user context は、 その parent の associated 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 contexts を set of user contexts に 追加してもよい。
注: ここでいう「いつでも」には実装の 起動中も含まれるため、ある実装は常に set of user contexts 内に 複数のエントリーを持つことがある。
実装は、default user context を除き、任意の empty user context を set of user contexts からいつでも 削除してもよい。 ただし、そのような user contexts を削除する必要はない。 empty user contexts でない User contexts は、 set of user contexts から削除されてはならない。
BiDi session は user context to accept insecure certificates override map を持ち、これは user contexts と boolean の間の map である。
BiDi session は user context to proxy configuration map を持ち、これは user contexts と proxy configuration の間の map である。
emulated network conditions struct は、次を持つ struct である:
-
offline という名前の item。これは boolean または null である。
BiDi session は emulated network conditions を持ち、これは struct であり、 default network conditions という名前の item を持つ。これは emulated network conditions struct または null であり、また user context network conditions という名前の item を持つ。これは user contexts と emulated network conditions struct の間の weak map であり、 さらに navigable network conditions という名前の item を持つ。これは navigables と emulated network conditions struct の間の weak map である。
user context が set of user contexts から削除されたとき、 remove user context subscriptions する。
remove user context subscriptions するには:
-
active sessions 内の各 session について:
-
subscriptions to remove を set とする。
-
session の subscriptions 内の各 subscription について:
-
subscription の user context ids が、 navigable の associated user context の user context id を含む場合;
-
navigable の associated user context の user context id を、 subscription の user context ids から削除する。
-
subscription の user context ids が 空である場合:
-
subscription を subscriptions to remove に追加する。
-
-
-
-
subscriptions to remove を session の subscriptions から削除する。
-
-
set of user contexts 内の各 user context について:
-
user context の user context id が user context id と等しい場合:
-
user context を返す。
-
-
null を返す。
user context ids が与えられたとき、get valid user contexts するには:
-
result を空の set とする。
-
user context ids の各 user context id について:
-
user context を、user context id で get user context したものに設定する。
-
user context が null である場合、error を error code no such user context とともに返す。
-
user context を result に追加する。
-
-
result を返す。
7. モジュール
7.1. session モジュール
session モジュールは、remote end のステータスを監視するための コマンドおよびイベントを含む。
7.1.1. 定義
SessionCommand = (
session.End //
session.New //
session.Status //
session.Subscribe //
session.Unsubscribe
)
SessionResult = (
session.EndResult /
session.NewResult /
session.StatusResult /
session.SubscribeResult /
session.UnsubscribeResult
)
-
session を active sessions から削除する。
-
active sessions が 空である場合、 webdriver-active flag を false に設定する。
session が与えられたとき、cleanup the session するには:
-
session で Close the WebSocket connections する。
-
set of user contexts 内の各 user context について:
-
session の user context to accept insecure certificates override map[user context] を削除する。
-
session の user context to proxy configuration map[user context] を削除する。
-
-
session の blocked request map 内の各 request id → (request, phase, response) について:
-
"
continue request"、request id および (response, "incomplete") で Resume する。
-
-
session の network collectors 内の各 collector について:
-
collector id を collector の collector とする。
-
collected network data 内の各 collected data について、collected data および collector id で remove collector from data する。
-
-
active sessions が 空である場合、 cleanup remote end state する。
-
実装固有のクリーンアップステップを実行する。
-
default cache behavior を "
default" に設定する。 -
現在の 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 を取り、次である:
-
value が boolean でない場合、error を code invalid argument とともに返す。
-
data value とともに success を返す。
webSocketUrl" capability に対する
matched capability serialization
algorithm は、パラメーター value を取り、次である:
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 は次である:
-
body を、次のプロパティを持つ新しい map とする:
- "ready"
- remote end の readiness state。
- "message"
- remote end の readiness state を説明する実装定義の文字列。
-
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 は次である:
-
session が null でない場合、error code session not created を持つ error を返す。
-
実装が何らかの理由で新しいセッションを開始できない場合、 error code session not created を持つ error を返す。
-
flags を、"
bidi" を含む set とする。 -
capabilities json を、command parameters および flags で process capabilities することを試みた結果とする。
-
capabilities を、capabilities json で convert a JSON-derived JavaScript value to an Infra value したものとする。
-
session を、capabilities および flags で create a session することを試みた結果とする。
-
session の BiDi flag を true に設定する。
注: このセッションの connection は、 呼び出し元によって現在の connection に設定される。
-
body を、
session.NewResult生成規則に一致する 新しい map とし、sessionIdフィールドを session の session ID に設定し、capabilitiesフィールドを capabilities に設定する。 -
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 は次である:
-
session で End the session する。
-
data null とともに success を返し、並列に次の ステップを実行する:
-
このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。
これは かなり不正確な表現だが、意図としては接続の シャットダウンを開始する前にコマンドへのレスポンスを送信する、ということが明確であることを期待している。
-
session で Cleanup 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, }
-
event names を空の set とする。
-
command parameters["
events"] 内の各エントリー name について、 event names を、event names と、 name で obtain a set of event names することを 試みた結果との union とする。 -
input user context ids を、command parameters[
userContexts] で create a set したものとする。 -
input context ids を、command parameters[
contexts] で create a set したものとする。 -
input user context ids が空でなく、かつ input context ids が空でない場合、 error を error code invalid argument とともに返す。
-
subscription navigables を set とする。
-
top-level traversable context ids を set とする。
-
input context ids が空でない場合:
-
navigables を、 input context ids で get valid navigables by ids することを 試みた結果とする。
-
subscription navigables を、navigables で get top-level traversables したものに設定する。
-
subscription navigables 内の各 navigable について:
-
navigable の navigable id を top-level traversable context ids に追加する。
-
-
-
そうでなく、input user context ids が空でない場合:
-
input user context ids の各 user context id について反復する:
-
user context を、user context id で get user context したものとする。
-
user context が null である場合、error を error code no such user context とともに返す。
-
user context である associated user context を持つ、すべての top-level traversables のリスト内の 各 top-level traversable について反復する:
-
top-level traversable を subscription navigables に追加する。
-
-
-
-
そうでなければ、subscription navigables を、remote end 内のすべての top-level traversables の set に設定する。
-
subscription を、 subscription id が UUID の文字列表現に設定され、 event names が event names に設定され、 top-level traversable ids が top-level traversable context ids に設定され、 user context ids が input user context ids に設定された subscription とする。
-
subscribe step events を新しい map とする。
-
event names 内の各 event name について:
-
event name event name を持つ event が remote end subscribe steps を定義していない場合、 continue する。
-
existing navigables を、session および event name で set of top-level traversables for which an event is enabled したものとする。
-
subscribe step events[event name] を、 subscription navigables と existing navigables の difference に設定する。
-
-
subscription を session の subscriptions に追加する。
-
subscription の subscription id を session の known subscription ids に追加する。
-
subscribe step events を、キー event name one および event name two を持つ 2 つのエントリーが与えられたときの次の less than アルゴリズムを用いて昇順に並べ替える:
-
event one を、名前 event name one を持つ event とする
-
event two を、名前 event name two を持つ event とする
-
event one の subscribe priority が event two の subscribe priority より小さい場合は true を返し、そうでなければ false を返す。
-
-
subscription が global である場合、include global を true とし、 そうでなければ include global を false とする。
-
subscribe step events 内の各 event name → navigables について:
-
event name event name を持つ event について、 session、navigables および include global が与えられたものとして remote end subscribe steps を実行する。
-
-
body を、
session.SubscribeResult生成規則に一致する 新しい map とし、subscriptionフィールドを subscription の subscription id に設定する。 -
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
-
command parameters が "
subscriptions" を含まない場合:注: この条件は、 command parameters が session.UnsubscribeByAttributesRequest 生成規則に一致することを意味する。
-
event names を空の set とする。
-
command parameters["
events"] 内の各エントリー name について、 event names を、 event names と、name で obtain a set of event names することを 試みた結果との union とする。 -
new subscriptions を list とする。
-
matched events を set とする。
-
session の subscriptions の各 subscription について:
-
subscription の event names と event names のintersection が空の set である場合:
-
subscription が global でない場合:
-
subscription event names を、subscription の event names のclone とする。
-
event names の各 event name について:
-
subscription event names が空でない場合:
-
cloned subscription を、 subscription id が subscription の subscription id に設定され、 event names が subscription event names を含む新しい set に設定された subscription とする。
-
cloned subscription を new subscriptions に追加する。
-
-
-
matched events が event names と等しくない場合、error を error code invalid argument とともに返す。
-
session の subscriptions を new subscriptions に設定する。
-
-
そうでなければ:
-
subscriptions を、command parameters[
subscriptions] で create a set したものとする。 -
unknown subscription ids を、subscriptions と session の known subscription ids の間の difference とする。
-
unknown subscription ids が空でない場合:
-
error を error code invalid argument とともに返す。
-
-
subscriptions to remove を空の set とする。
-
session の subscriptions 内の各 subscription について:
-
subscriptions が subscription の subscription id を含む場合:
-
subscription を subscriptions to remove に追加する。
-
-
-
session の known subscription ids を、 session の known subscription ids と subscriptions の間の difference に設定する。
-
subscriptions to remove 内の各項目を session の subscriptions から削除する。
-
-
data null とともに success を返す。
7.2. browser モジュール
browser モジュールは、 remote end のブラウザープロセスを管理するためのコマンドを含む。
7.2.1. 定義
BrowserCommand = (
browser.Close //
browser.CreateUserContext //
browser.GetClientWindows //
browser.GetUserContexts //
browser.RemoveUserContext //
browser.SetClientWindowState //
browser.SetDownloadBehavior
)
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 traversable の active document を、その visibility state が
"visible" であるときにレンダリングするために使用される
viewport を含む矩形領域を表し、
traversable の表示に関連付けられたブラウザー固有のユーザーインターフェイス要素
(例: URL バー、ツールバー、または OS のウィンドウ装飾)も表す。
client window は client window id を持ち、 これはそのウィンドウを一意に識別する文字列である。
client window は x-coordinate を持ち、これは web-exposed screen area の左端とウィンドウの左端との間の CSS ピクセル数、または特定のウィンドウについてそれが意味をなさない場合は ゼロである。
client window は y-coordinate を持ち、これは web-exposed screen area の上端とウィンドウの上端との間の CSS ピクセル数、または特定のウィンドウについてそれが意味をなさない場合は ゼロである。
client window は width を持ち、これは CSS ピクセルにおけるウィンドウ矩形の幅である。
client window は height を持ち、これは CSS ピクセルにおけるウィンドウ矩形の高さである。
window の maximize the client window を行うには、実装はプラットフォームにおける window の最大化の概念に対応する ステップを実行するか、 window の x-coordinate が可能な限り 0 に近くなり、 その y-coordinate が可能な限り 0 に近くなり、 その width が web-exposed screen area の幅に可能な限り近くなり、その height が web-exposed screen area の高さに可能な限り近くなるように window を配置するべきである。これらのいずれかの選択肢がサポートされる場合、 maximize client window is supported である。
window の minimize the
client window を行うには、実装はプラットフォームにおける window の最小化の概念に対応する
ステップを実行するか、
そうでなければ window に関連付けられた
top-level traversables 内のすべての active documents の
visibility state
が "hidden" になり、かつ window の width および height がどちらも可能な限り 0 に近くなるように、
window を隠すべきである。これらのいずれかの選択肢が
サポートされる場合、minimize client window is supported である。
window の restore the
client window を行うには、実装はそれが
プラットフォーム定義の最大化状態でも、プラットフォーム定義の
最小化状態でもなく、かつ window に関連付けられた 1 つ以上の top-level traversable
が存在する場合は、そのうち少なくとも 1 つが "visible" 状態の
active document を持つことを保証するべきである。
これがサポートされる場合、restore client
window is supported である。
window が与えられたとき、get the client window state するには:
-
documents を空の list とする。
-
visible documents を空の list とする。
-
各 top-level traversable traversable について:
-
traversable の client window が window でない場合、 continue する。
-
document を traversable の active document とする。
-
document を documents に追加する。
-
document の visibility state が "
visible" である場合、 document を visible documents に追加する。
-
-
visible documents 内の各 document について:
-
document の fullscreen element が null でない場合、 "
fullscreen" を返す。
-
-
visible documents が空であるが documents が 空でない場合、または window がその他の OS 固有の 最小化状態にある場合、"
minimized" を返す。注: これは通常、必ずしもそうとは限らないが、 window の width および height が 0 に等しいことを意味する。
-
window が OS 固有の最大化状態にある場合、 "
maximized" を返す。注: これは通常、必ずしもそうとは限らないが、 window の width が web-exposed screen area の幅に等しく、 window の height が web-exposed screen area の高さに等しいことを意味する。
-
"
normal" を返す。
window および state が与えられたとき、set the client window state するには:
-
current state を、window で get the client window state したものとする。
-
current state が "
fullscreen"、"maximized"、または "minimized" であり、かつ state と等しい場合、data null とともに success を返す。 -
次の条件と関連するステップのリストにおいて、 関連する条件が true である最初のステップ集合を実行する:
- "
fullscreen" - fullscreen is supported でない場合、error を error code unsupported operation とともに返す。
- "
normal" - window について restore client window is supported でない場合、error を error code unsupported operation とともに返す。
- "
maximize" - window について maximize client window is supported でない場合、error を error code unsupported operation とともに返す。
- "
minimize" - window について minimize client window is supported でない場合、error を error code unsupported operation とともに返す。
- "
-
documents を空の list とする。
-
各 top-level traversable traversable について:
-
traversable に関連付けられた client window が window でない場合、 continue する。
-
document を traversable の active document とする。
-
document を documents に追加する。
-
-
documents が空である場合、 error を error code no such client window とともに返す。
-
current state が "
fullscreen" である場合:-
documents 内の各 document について:
-
document で Fully exit fullscreen する。
注: これは、 fullscreen でない window 内の文書に対しては何もしない。
-
-
-
current state が "
maximized" または "minimized" である場合:-
window で Restore the client window する。
-
-
state の値について分岐する:
- "
fullscreen" -
-
documents 内の各 document について:
-
document の visibility state が "
visible" である場合、 document の document element で fullscreen an element する。 -
Break する。
-
-
- "
maximize" - 1. window で Maximize the client window する。
- "
minimize" - 1. window で Minimize the client window する。
- "
-
data null とともに success を返す。
7.2.3. 型
7.2.3.1. browser.ClientWindow 型
browser.ClientWindow = text;
browser.ClientWindow は client 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 id を、client window の client window id とする。
-
state を、client window で get the client window state したものとする。
-
client window がオペレーティングシステムから送られるキーボード入力を 受け取ることができる場合、active を true とし、そうでなければ active を false とする。
注: これは、client window である client window を持つ top-level traversable が system focus を持つことを意味する場合もあれば、 ブラウザー自体のユーザーインターフェイスが現在フォーカスを持つことを意味する場合もある。
-
client window info を、
browser.ClientWindowsInfo生成規則に一致する map とし、clientWindowフィールドを client window id に、stateフィールドを state に、xフィールドを client window の x-coordinate に、yフィールドを client window の y-coordinate に、widthフィールドを client window の width に、heightフィールドを client window の height に、activeフィールドを active に設定したものとする。 -
client window info を返す
7.2.3.3. browser.UserContext 型
browser.UserContext = text;
browser.UserContext
は user
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 で End the session する。
-
active sessions が空でない場合、 実装は unable to close browser の error code を持つ error を返してもよく、その後 次のステップを並列に実行する:
-
このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。
-
session で Cleanup the session する。
注: ブラウザーが複数の自動化 セッションを持つ場合の挙動は、現在未指定である。任意のセッションが ブラウザーを閉じられるのか、最後に開かれたセッションだけが実際に ブラウザーを閉じられるのか、あるいは最初に開始されたセッションだけが可能なのかもしれない。この挙動は、 この仕様の将来のバージョンで完全に指定されるかもしれない。
-
-
active sessions 内の各 active session について:
-
active session で End the session する。
-
active session で Cleanup the session する
-
-
data null とともに success を返し、次のステップを並列に実行する。
-
このコマンドへのレスポンスで Send a WebSocket message ステップが呼び出されるまで待つ。
-
session で Cleanup the session する。
-
top-level traversables を、どれでも Close する。ただし prompting to unload しない。
-
自動化下の 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 は次である:
-
user context を新しい user context とする。
-
command parameters が "
acceptInsecureCerts" を含む場合:注: "
acceptInsecureCerts" が 設定されている場合、それは accept insecure TLS flag の挙動を上書きする。-
acceptInsecureCerts を command parameters["
acceptInsecureCerts"] とする: -
acceptInsecureCerts が true であり、endpoint node が insecure TLS connections の受け入れをサポートしていない場合、 unsupported operation の error code を持つ error を返す。
-
session の user context to accept insecure certificates override map[user context] を acceptInsecureCerts に設定する。
-
-
command parameters が "
unhandledPromptBehavior" を含む場合、 unhandled prompt behavior overrides map[user context] を command parameters["unhandledPromptBehavior"] に設定する。 -
command parameters が "
proxy" を含む場合:-
proxy configuration を command parameters["
proxy"] とする。 -
remote end が user context ごとに proxy settings を構成できない場合、 または proxy configuration で proxy を構成できない場合、 unsupported operation の error code を持つ error を返す。
-
session の user context to proxy configuration map[user context] を proxy configuration に設定する。
-
-
user context を set of user contexts に追加する。
-
user context info を、
browser.UserContextInfo生成規則に一致する map とし、userContextフィールドを user context の user context id に設定したものとする。 -
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 は次である:
-
client window ids を空の set とする。
-
client windows を空の list とする。
-
各 top-level traversable traversable について:
-
client window を、traversable に関連付けられた client window とする
-
client window id を、client window の client window id とする。
-
client window ids が client window id を含む場合、continue する。
-
client window id を client window ids に追加する。
-
client window info を、client window で get the client window info したものとする。
-
client window info を client windows に追加する。
-
-
result を、
browser.GetClientWindowsResult生成規則に一致する map とし、clientWindowsフィールドを client windows に設定したものとする。 -
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 は次である:
-
user contexts を空の list とする。
-
set of user contexts 内の各 user context について:
-
user context info を、
browser.UserContextInfo生成規則に一致する map とし、userContextフィールドを user context の user context id に設定したものとする。 -
user context info を user contexts に追加する。
-
-
result を、
browser.GetUserContextsResult生成規則に一致する map とし、userContextsフィールドを user contexts に設定したものとする。 -
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 は次である:
-
user context id を command parameters["
userContext"] とする。 -
user context id が
"default"である場合、error を error code invalid argument とともに返す。 -
user context を、user context id で get user context したものに設定する。
-
user context が null である場合、error を error code no such user context とともに返す。
-
各 top-level traversable navigable について:
-
navigable の associated user context が user context である場合:
-
navigable を閉じる。ただし prompting to unload しない。
-
-
-
user context を set of user contexts から削除する。
-
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 は次である:
-
実装が client window state の設定をまったくサポートしていない場合、 unsupported operation の error code を持つ error を返す。
-
command parameters["
clientWindow"] の client window id を持つ client window が存在する場合、client window をその client window とする。 そうでなければ、no such client window の error code を持つ error を返す。 -
client window および command parameters["
state"] で set the client window state することを試みる。 -
command parameters["
state"] が "normal" である場合:-
command parameters が "
x" を含み、かつ実装が client windows の位置指定をサポートする場合、client window の x-coordinate を、 command parameters["x"] に可能な限り近い値に設定する。 -
command parameters が "
y" を含み、かつ実装が client windows の位置指定をサポートする場合、client window の y-coordinate を、 command parameters["y"] に可能な限り近い値に設定する。 -
command parameters が "
width" を含み、かつ実装が client windows のリサイズをサポートする場合、 client window の width を command parameters["width"] に可能な限り近い値に設定する。 -
command parameters が "
width" を含み、かつ実装が client windows のリサイズをサポートする場合、 client window の width を command parameters["width"] に可能な限り近い値に設定する。
-
-
client window info を、client window で get the client window info したものとする。
-
data client window info とともに success を返す。
注: 単純化のため、これはすべての client window 操作を 同期的なものとしてモデル化している。したがって、返される client window の寸法は、 window が新しい状態に到達した後のものになることが期待される。
7.2.4.7. browser.setDownloadBehavior コマンド
download behavior struct は、次を持つ struct である:
remote end は download behavior を持ち、これは struct であり、 default download behavior という名前の item を持つ。これは download behavior struct または null であり、さらに user context download behavior という名前の item を持つ。これは user contexts と download 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
-
user context を navigable の associated user context とする。
-
download behavior の user context download behavior が user context を含む場合、download behavior の user context download behavior[user context] を返す。
session および command parameters を伴う remote end steps は次である:
-
command parameters["
downloadBehavior"] が null である場合、 download behavior を null とする。 -
そうでなければ:
-
command parameters["
downloadBehavior"]["type"] が "allowed" である場合、allowed を true とし、そうでなければ allowed を false とする。 -
command parameters["
downloadBehavior"] が "destinationFolder" を含む場合、destinationFolder を command parameters["downloadBehavior"]["destinationFolder"] とし、 そうでなければ destinationFolder を null とする。 -
download behavior を、allowed が allowed に設定され、 destinationFolder が destinationFolder に設定された download behavior struct とする。
-
-
実装が要求された download behavior をサポートしていない場合、 error を error code unsupported operation とともに返す。
-
command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
download behavior が null である場合、user context を download behavior の user context download behavior から削除する。
-
そうでなければ、download behavior の user context download behavior[user context] を download behavior に設定する。
-
-
-
そうでなければ、download behavior の default download behavior を download behavior に設定する。
-
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. 定義
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
)
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 end は device pixel ratio overrides を持ち、これは navigables と device pixel ratio overrides の間の weak map である。 これは初期状態では空である。
注: この map は最後のセッションが終了しても クリアされない。すなわち device pixel ratio overrides はどの WebDriver セッションよりも長く存続する。
viewport dimensions は、次を持つ struct である:
viewport configuration は、次を持つ struct である:
-
viewport という名前の item。これは viewport dimensions または null である;
-
devicePixelRatio という名前の item。これは float または null である。
unhandled prompt behavior struct は、次を持つ struct である:
-
alertという名前の item。これは string または null である; -
beforeUnloadという名前の item。これは string または null である; -
confirmという名前の item。これは string または null である; -
defaultという名前の item。これは string または null である; -
fileという名前の item。これは string または null である; -
promptという名前の item。これは string または null である。
remote end は viewport overrides map を持ち、これは user contexts と viewport configuration の間の weak map である。
remote end は locale overrides map を持ち、これは navigables または user contexts と string の間の weak map である。
screen settings は
struct であり、
height という名前の
item を持つ。これは integer であり、
width という名前の item を持つ。これは integer
であり、
x という名前の item を持つ。これは integer
であり、
y という名前の item を持つ。これは integer
である。
remote end は screen settings overrides を持ち、これは struct であり、 user context screen settings という名前の item を持つ。これは user contexts と screen settings の間の weak map であり、 さらに navigable screen settings という名前の item を持つ。これは navigables と screen settings の間の weak map である。
remote end は timezone overrides map を持ち、これは navigables または user contexts と string の間の weak map である。
remote end は unhandled prompt behavior overrides map を持ち、これは user contexts と unhandled prompt behavior struct の間の weak map である。
remote end は scripting 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 id は window handle と同じでなければならない。
各 navigable は、associated storage partition も持つ。 これは、その navigable がデータを永続化するために使用する storage partition である。
各 navigable は、関連付けられた original opener も持つ。 これは、その navigable を開かせた navigable または null であり、初期状態では null に設定される。
-
navigable id が null である場合、data null とともに success を返す。
-
navigable id navigable id を持つ navigable が存在しない場合、 no such frame の error code を持つ error を返す
-
navigable を、id navigable id を持つ navigable とする。
-
data navigable とともに success を返す。
7.3.2.2. browsingContext.Info 型
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 のプロパティを表す。
TODO: これが文書順のリストを返すようにする
-
child navigables を、navigable の child navigable であるすべての navigables を含む set とする。
-
child navigables を返す。
-
navigable id を、navigable の navigable id とする。
-
parent navigable を navigable の parent とする。
-
parent navigable が null でない場合、parent id を parent navigable の navigable id とする。 そうでなければ、 parent id を null とする。
-
document を navigable の active document とする。
-
url を、document の URL が与えられたものとして URL serializer を実行した結果とする。
注: これは URL の fragment component を含む。
-
child infos を null とする。
-
max depth が null である、または max depth が 0 より大きい場合:
-
child navigables を、navigable が与えられたものとして get the child navigables したものとする。
-
max depth が null でない場合、child depth を max depth - 1 とし、そうでなければ null とする。
-
child infos を空の list に設定する。
-
child navigables の各 child navigable について:
-
info を、 child navigable、child depth および false が与えられたものとして get the navigable info した結果とする。
-
info を child infos に追加する
-
-
-
user context を navigable の associated user context とする。
-
navigable の original opener が null でない場合、 opener id を navigable の original opener の navigable id とし、 そうでなければ null とする。
-
top-level traversable を navigable の top-level traversable とする。
-
client window id を、top-level traversable に関連付けられた client window の client window id とする。
-
navigable info を、
browsingContext.Info生成規則に一致する map とし、contextフィールドを navigable id に、include parent id がtrueである場合はparentフィールドを parent id に設定し、そうでなければ未設定とし、urlフィールドを url に、userContextフィールドを user context の user context id に、originalOpenerフィールドを opener id に、childrenフィールドを child infos に、clientWindowフィールドを client window id に設定したものとする。 -
navigable info を返す。
default")と ignore cache(デフォルト: false)が
与えられたとき、await a
navigation するには:
-
navigation id を、真のランダムまたは擬似ランダムな数値に基づく UUID の文字列表現とする。
-
navigable を resource request で navigate し、source
Documentとして navigable の active 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 をバイパスするのかを考慮する必要がある。
-
(event received, navigation status) を、 «"
navigation started", "navigation failed", "fragment navigated"» および navigation id が与えられたものとして await したものとする。 -
Assert: navigation status の id は navigation id である。
-
navigation status の status が "
complete" である場合:-
body を、
browsingContext.NavigateResult生成規則に一致する map とし、navigationフィールドを navigation id に、urlフィールドを navigation status の url が与えられたものとして URL serializer を実行した結果に設定したものとする。 -
data body とともに success を返す。
注: これは、そのナビゲーションが fragment の変更だけを 引き起こした場合である。
-
-
navigation status の status が "
canceled" である場合、 unknown error の error code を持つ error を返す。TODO: ここでエラーを扱うにはこれが正しい方法か?
-
Assert: navigation status の status は "
pending" であり、navigation id は null でない。 -
wait condition が "
committed" である場合、event name を "committed" とする。 -
そうでなく、wait condition が "
interactive" である場合、event name を "domContentLoaded" とする。 -
そうでなければ、event name を "
load" とする。 -
(event received, status) を、 «event name, "
download started", "navigation aborted", "navigation failed"» および navigation id が与えられたものとして await したものとする。 -
event received が "
navigation failed" である場合、 unknown error の error code を持つ error を返す。ここでの error により、何が失敗し、なぜ失敗したのかについて十分な情報を 表面化できているか? どの error code が望ましいか? local ends が実装定義の文字列を 解析して、実際に何が問題だったのかを把握しようとする問題は生じるか?
-
body を、
browsingContext.NavigateResult生成規則に一致する map とし、navigationフィールドを status の id に、urlフィールドを status の url が与えられたものとして URL serializer を実行した結果に設定したものとする。 -
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 型
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 id を、navigable の navigable id とする。
-
navigation id を navigation status の id とする。
-
timestamp を、UTC での現在の日付および時刻を表す time value とする。
-
url を navigation status の url とする。
-
user context id を、navigable の associated user context の user context id とする。
-
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 は次である:
-
navigable id を command parameters["
context"] フィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
navigable で activate a navigable した結果を返す。
-
navigable の system visibility state が visible になるように、実装固有のステップを実行する。 これが不可能である場合、error code unsupported operation を持つ error を返す。
注: これは、現在 visible である navigables を hidden にする副作用を持ち得る。
注: これは、window を最小化解除すること、または system visibility state の変更に関連するその他の副作用により、 基礎となる OS 状態を変更し得る。
-
navigable がフォーカスされていない場合、navigable に system focus を設定するための実装固有のステップを実行する。
注: これは、他の仕様で義務付けられている場合を除き、 focused area of the document を変更しない。
-
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 が正の width dimension および height dimension を持つことを保証する。
-
x を rect の x coordinate とする。
-
y を rect の y coordinate とする。
-
width を rect の width dimension とする。
-
height を rect の height dimension とする。
-
width が 0 未満である場合、x を x + width に設定し、 その後 width を -width に設定する。
-
height が 0 未満である場合、y を y + height に設定し、 その後 height を -height に設定する。
-
x coordinate x、y coordinate y、width dimension width および height dimension height を持つ新しい
DOMRectReadOnlyを返す。
-
rect1 を、rect1 で normalize rect したものとする。
-
rect2 を、rect2 で normalize rect したものとする。
-
x1_0 を rect1 の x coordinate とする。
-
x2_0 を rect2 の x coordinate とする。
-
x1_1 を、rect1 の x coordinate に rect1 の width dimension を加えたものとする。
-
x2_1 を、rect2 の x coordinate に rect2 の width dimension を加えたものとする。
-
x_0 を «x1_0, x2_0» の最大要素とする。
-
x_1 を «x1_1, x2_1» の最小要素とする。
-
y1_0 を rect1 の y coordinate とする。
-
y2_0 を rect2 の y coordinate とする。
-
y1_1 を、rect1 の y coordinate に rect1 の height dimension を加えたものとする。
-
y2_1 を、rect2 の y coordinate に rect2 の height dimension を加えたものとする。
-
y_0 を «y1_0, y2_0» の最大要素とする。
-
y_1 を «y1_1, y2_1» の最小要素とする。
-
x_1 が x_0 未満である場合、width を 0 とする。そうでなければ width を x_1 - x_0 とする。
-
y_1 が y_0 未満である場合、height を 0 とする。そうでなければ height を y_1 - y_0 とする。
-
x coordinate x_0、y coordinate y_0、width dimension width および height dimension height を持つ新しい
DOMRectReadOnlyを返す。
-
ratio を、document の default view が与えられたものとして determine the device pixel ratio したものとする。
-
paint width を、rect の width dimension に ratio を掛け、 最も近い整数に丸めたものとする。これにより device pixels における rect の幅と一致する。
-
paint height を、rect の height dimension に ratio を掛け、 最も近い整数に丸めたものとする。これにより device pixels における rect の高さと一致する。
-
canvas を、
widthpaint width およびheightpaint height を持つ新しいHTMLCanvasElementとする。 -
canvas context を、canvas および null で 2D context creation algorithm を実行した結果とする。
-
canvas の context mode を 2D に設定する。
-
rect により覆われる document の領域を表す framebuffer の領域を canvas context に描画することと等価な、実装固有のステップを完了する。 その際、framebuffer 内の各 pixel は canvas context 内の pixel に対応し、viewport coordinates における (rect の x coordinate, rect の y coordinate) が canvas context 内の (0,0) に対応し、(rect の x coordinate + rect の width dimension, rect の y coordinate + rect の height dimension) が (paint width, paint height) に対応するようにする。
-
canvas を返す。
-
format が null でない場合、type を format の
typeフィールドとし、quality を format のqualityフィールドとする。 -
そうでなければ、type を "image/png" とし、quality を undefined とする。
-
file を、type および quality を伴う canvas の a serialization of the bitmap as a file とする。
-
encoded string を file の forgiving-base64 encode とする。
-
data encoded string とともに success を返す。
-
origin が
"viewport"である場合:-
viewport を document の visual viewport とする。
-
viewport rect を、 x coordinate viewport の page left、y coordinate viewport の page top、width dimension viewport width、および height dimension viewport height を持つ
DOMRectReadOnlyとする。 -
data viewport rect とともに success を返す。
-
-
Assert: origin は
"document"である。 -
document element を document の document element とする。
-
document rect を、x coordinate 0、y coordinate 0、width dimension document element の scroll height、 および height dimension document element の scroll width を持つ
DOMRectReadOnlyとする。 -
data document rect とともに success を返す。
session および command parameters を伴う remote end steps は次である:
-
navigable id を、 command parameters に
contextフィールドが存在する場合はその値とし、 そうでなければ null とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
実装が何らかの理由で navigable の screenshot をキャプチャできない場合、 unsupported operation の error code を持つ error を返す。
-
document を navigable の active document とする。
-
document について、次に run the animation frame callbacks algorithm が 呼び出された直後:
-
origin を、command parameters に
contextフィールドが存在する場合はその値とし、そうでなければ "viewport" とする。 -
origin rect を、origin および document が与えられたものとして get the origin rectangle することを試みた結果とする。
-
clip rect を origin rect とする。
-
command parameters が "
clip" を含む場合:-
clip を command parameters["
clip"] とする。 -
最初に一致する条件の下のステップを実行する:
- clip が
browsingContext.ElementClipRectangle生成規則に一致する: -
-
environment settings を、その relevant global object の associated
Documentが document である environment settings object とする。 -
realm を、environment settings の realm execution context の Realm component とする。
-
element を、clip["
element"]、 realm および session で deserialize remote reference することを試みた結果とする。 -
element が
Elementを実装していない場合、no such element の error code を持つ error を返す。 -
element の node document が document でない場合、no such element の error code を持つ error を返す。
-
viewport rect を、"
viewport" および document が 与えられたものとして get the origin rectangle したものとする。 -
element rect を、 element について get the bounding box したものとする。
-
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とする。
-
- clip が
browsingContext.BoxClipRectangle生成規則に一致する: -
-
clip x を、clip["
x"] に origin rect の x coordinate を加えたものとする。 -
clip y を、clip["
y"] に origin rect の y coordinate を加えたものとする。 -
clip rect を、 x coordinate clip x、 y coordinate clip y、width clip["
width"]、および height clip["height"] を持つDOMRectReadOnlyとする。
-
- clip が
-
-
注: すべての座標はここで文書の原点から測定される。
-
rect を origin rect と clip rect の rectangle intersection とする。
-
rect の width dimension が 0 である、または rect の height dimension が 0 である場合、 error code unable to capture screen を持つ error を返す。
-
canvas を、document および rect で render document to a canvas したものとする。
-
format を command parameters の
formatフィールドとする。 -
encoding result を、canvas および format で encode a canvas as Base64 することを試みた結果とする。
-
body を、
browsingContext.CaptureScreenshotResult生成規則に一致する map とし、dataフィールドを encoding result に設定したものとする。 -
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
-
navigable id を command parameters の
contextフィールドの値とする。 -
prompt unload を command parameters の
promptUnloadフィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
Assert: navigable は null でない。
-
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
prompt unload が true である場合:
-
navigable を閉じる。
-
-
そうでなければ:
-
Close navigable without prompting to unload.
-
-
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 }
-
type を command parameters の
typeフィールドの値とする。 -
reference navigable id を、command parameters に
referenceContextフィールドが存在する場合はその値とし、そうでなければ null とする。 -
reference navigable id が null でない場合、reference navigable を reference navigable id で get a navigable することを試みた結果とする。そうでなければ reference navigable を null とする。
-
reference navigable が null でなく、かつ top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
実装が何らかの理由で新しい top-level traversable を作成できない場合、 unsupported operation の error code を持つ error を返す。
-
reference navigable が null である場合、user context を default user context とし、 そうでなければ reference navigable の associated user context とする。
-
user context id を、 command parameters に
userContextフィールドが存在する場合はその値とし、 そうでなければ null とする。 -
user context id が null でない場合、user context を user context id で get user context することを試みた結果に設定する。
-
user context が null である場合、no such user context の error code を持つ error を返す。
-
実装が何らかの理由で associated user context user context を持つ新しい top-level traversable を作成できない場合、 unsupported operation の error code を持つ error を返す。
-
traversable を、null および空文字列で create a new top-level traversable steps を試み、 新しく作成された top-level traversable の associated user context を user 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 navigable の top-level traversable の直後に置かれるべきである。
-
-
type が "
window" であり、実装が別々の OS windows 内の複数の top-level traversable をサポートする場合、作成された top-level traversable は新しい OS window 内にあるべきである。 -
そうでなければ、top-level traversable がユーザーにどのように提示されるかの詳細は 実装定義である。
-
-
command parameters の
backgroundフィールドの値が false である場合:-
activate result を、新しく作成された navigable で activate a navigable した結果とする。
-
activate result が error である場合、 activate result を返す。
注:
backgroundが true である場合、 作成された navigable について focusing steps を呼び出さない。 -
-
body を、
browsingContext.CreateResult生成規則に一致する map とし、contextフィールドを traversable の navigable id に、userContextproperty を traversable の associated user context の user context id に設定したものとする。 -
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 }
-
root id を、command parameters に
rootフィールドが存在する場合は その値とし、そうでなければ null とする。 -
max depth を、command parameters に
maxDepthフィールドが存在する場合はその値とし、そうでなければ null とする。 -
navigables を空の list とする。
-
root id が null でない場合、 root id が与えられたものとして get a navigable することを試みた結果を navigables に追加する。 そうでなければ、すべての top-level traversables を navigables に追加する。
-
navigables infos を空の list とする。
-
navigables の各 navigable について:
-
info を、 navigable、max depth、および true が与えられたものとして get the navigable info した結果とする。
-
info を navigables infos に追加する
-
-
body を、
browsingContext.GetTreeResult生成規則に一致する map とし、contextsフィールドを navigables infos に設定したものとする。 -
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 は次である:
-
navigable id を command parameters の
contextフィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
accept を、 command parameters に
acceptフィールドが存在する場合はその値とし、 そうでなければ true とする。 -
userText を、 command parameters に
userTextフィールドが存在する場合はその値とし、 そうでなければ空文字列とする。 -
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 alert の error code を持つ error を返す。
-
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 ] }
-
returned nodes を空の list とする。
-
parse result を、selector が与えられたものとして parse a selector した結果とする。
-
parse result が failure である場合、invalid selector の error code を持つ error を返す。
-
context nodes の各 context node について:
-
elements を、 parse result および navigable の active document の root を用い、 scoping root context node を用いて match a selector against a tree した結果とする。
-
elements 内の各 element について:
-
-
data returned nodes とともに success を返す。
与えられた navigable、context nodes、 selector、および maximum returned node count で locate nodes using XPath するには:
注: XPath 仕様が保守されていない状態であるため、 このアルゴリズムは XPath DOM APIs への呼び出しを行うかのように記述されている。 しかしこれは、ECMAScript runtime を経由せずに、基礎となるアルゴリズムへ直接アクセスする 仕様内部の呼び出しと等価であると理解されるべきである。
-
returned nodes を空の list とする。
-
context nodes の各 context node について:
-
evaluate result を、navigable の active document 上で、引数 selector、 context node、null、 ORDERED_NODE_SNAPSHOT_TYPE、 および null を用いて evaluate を呼び出した結果とする。 これが "SyntaxError" DOMException を投げる場合、 invalid selector の error code を持つ error を返す; そうでなく、これが他の例外を投げる場合、unknown error の error code を持つ error を返す。
-
index を 0 とする。
-
length を、evaluate result から
snapshotLengthプロパティを 取得した結果とする。 -
index が length 未満である間、繰り返す:
-
node を、evaluate result を this とし、index を引数として snapshotItem を呼び出した結果とする。
-
node を returned nodes に追加する。
-
maximum returned node count が null でなく、かつ returned nodes の size が maximum returned node count に等しい場合、 data returned nodes とともに success を返す。
-
index を index + 1 に設定する。
-
-
-
data returned nodes とともに success を返す。
-
selector が空文字列である場合、 invalid selector の error code を持つ error を返す。
-
returned nodes を空の list とする。
-
ignore case が false である場合、search text を selector とする。そうでなければ、 search text を、Unicode Default Case Conversion algorithm に従って、 selector で toUppercase した結果とする。
-
context nodes 内の各 context node について:
-
context node が
DocumentまたはDocumentFragmentを実装している場合:注: document または document fragment をたどるとき、
documentとdocument.documentElementで検索結果が等価になるように、max depthは意図的に減らされない。 -
context node が
HTMLElementを実装していない場合、continue する。 -
node inner text を、 context node を this 値として innerText getter steps を呼び出した結果とする。
-
ignore case が false である場合、node text を node inner text とする。そうでなければ、 node text を、Unicode Default Case Conversion algorithm に従って、 node inner text で toUppercase した結果とする。
-
search text が node text の code point substring である場合、 次のステップを実行する:
-
child nodes を空の list とし、 context node の children 内の各 node child について:
-
child を child nodes に追加する。
-
-
child nodes の size が 0 に等しい、または max depth が 0 に等しい場合、 次のステップを実行する:
-
そうでなければ、次のステップを実行する:
-
max depth が null である場合、child max depth を null とし、 そうでなければ max depth - 1 とする。
-
child node matches を、 child nodes、selector、child max depth、match type、 ignore case、および maximum returned node count で locate nodes using inner text した結果とする。
-
child node matches の size が 0 に等しく、かつ match type が
"partial"である場合、context node を returned nodes に追加する。そうでなければ、 child node matches で returned nodes を 拡張する。
-
-
-
-
maximum returned node count が null でない場合、returned nodes 内で index が maximum returned node count 以上であるすべての entries を削除する。
-
data returned nodes とともに success を返す。
-
returned nodes が null である場合:
-
returned nodes を空の list に設定する。
-
-
context nodes 内の各 context node について:
-
match を true とする。
-
context node が
Elementを実装している場合:-
selector が "
role" を含む場合:-
role を context node の computed role とする。
-
selector["
role"] が role でない場合:-
match を false に設定する。
-
-
-
selector が "
name" を含む場合:-
name を context node の accessible name とする。
-
selector["
name"] が name でない場合:-
match を false に設定する。
-
-
-
-
そうでなければ、match を false に設定する。
-
match が true である場合:
-
child nodes を空の list とし、 context node の children 内の各 node child について:
-
child nodes、 selector、maximum returned node count、および returned nodes で collect nodes using accessibility attributes することを試みる。
-
-
returned nodes を返す。
-
selector が "
role" を含まず、 かつ selector が "name" を含まない場合、 invalid selector の error code を持つ error を返す。 -
context nodes、 selector、maximum returned node count、および null で collect nodes using accessibility attributes した結果を返す。
-
navigable id を command parameters["
context"] とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
Assert: navigable は null でない。
-
realm を、 navigable の navigable id および null で get a realm from a navigable することを試みた結果とする。
-
locator を command parameters["
locator"] とする。 -
command parameters が "
startNodes" を含む場合、 start nodes parameter を command parameters["startNodes"] とする。 そうでなければ、start nodes parameter を null とする。 -
command parameters が "
maxNodeCount" を含む場合、 maximum returned node count を command parameters["maxNodeCount"] とする。 そうでなければ、maximum returned node count を null とする。 -
context nodes を空の list とする。
-
start nodes parameter が null である場合、navigable の active document を context nodes に追加する。 そうでなければ、start nodes parameter 内の各 serialized start node について:
-
start node を、 serialized start node、realm、および session が与えられたものとして deserialize shared reference することを試みた結果とする。
-
start node を context nodes に追加する。
-
-
context nodes の size が 0 より大きいことを Assert する。
-
type を locator["
type"] とする。 -
次の条件と関連するステップのリストにおいて、関連する条件が true である最初の ステップセットを実行する:
- type が文字列 "
css" である -
-
selector を locator["
value"] とする。 -
result nodes を、navigable、context nodes、 selector、および maximum returned nodes が与えられたものとして locate nodes using css することを試みた結果とする。
-
- type が文字列 "
xpath" である -
-
selector を locator["
value"] とする。 -
result nodes を、navigable、context nodes、 selector、および maximum returned nodes が与えられたものとして locate nodes using xpath することを試みた結果とする。
-
- type が文字列 "
innerText" である -
-
selector を locator["
value"] とする。 -
locator が
maxDepthを含む場合、max depth を locator["maxDepth"] とする。そうでなければ、max depth を null とする。 -
locator が
ignoreCaseを含む場合、 ignore case を locator["ignoreCase"] とする。そうでなければ、ignore case を false とする。 -
locator が
matchTypeを含む場合、 match type を locator["matchType"] とする。そうでなければ、match type を "full" とする。 -
result nodes を、 context nodes、selector、max depth、 match type、 ignore case および maximum returned node count が与えられたものとして locate nodes using inner text することを試みた結果とする。
-
- type が文字列 "
accessibility" である -
-
selector を locator["
value"] とする。 -
result nodes を、 context nodes、selector、および maximum returned node count が与えられたものとして locate nodes using accessibility attributes したものとする。
-
- type が文字列 "
context" である -
-
start nodes parameter が null でない場合、 error code "
invalid argument" を持つ error を返す。 -
selector を locator["
value"] とする。 -
context id を selector["
context"] とする。 -
child navigable を、 context id で get a navigable することを試みた結果とする。
-
child navigable の parent が navigable でない場合、 error code "
invalid argument" を持つ error を返す。 -
result nodes を、child navigable が与えられたものとして locate the container element したものとする。
-
Assert: result nodes 内の各 node について、 node の node navigable は navigable である。
-
- type が文字列 "
-
Assert: maximum returned node count は null である、または result nodes の size は maximum returned node count 以下である。
-
command parameters が "
serializationOptions" を含む場合、 serialization options を command parameters["serializationOptions"] とする。 そうでなければ、serialization options を、 フィールドを既定値に設定したscript.SerializationOptions生成規則に一致する map とする。 -
result ownership を "none" とする。
-
serialized nodes を空の list とする。
-
result nodes 内の各 result node について:
-
serialized node を、 result node、serialization options、result ownership、 serialization internal map としての新しい map、 realm および session で serialize as a remote value した結果とする。
-
serialized node を serialized nodes に追加する。
-
-
result を、
browsingContext.LocateNodesResult生成規則に一致する map とし、nodesフィールドを serialized nodes に設定したものとする。 -
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, }
-
navigable id を command parameters の
contextフィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
Assert: navigable は null でない。
-
wait condition を "
committed" とする。 -
command parameters が
waitを含み、 かつ command parameters[wait] が "none" でない場合、 wait condition を command parameters[wait] に設定する。 -
url を command parameters の
urlフィールドの値とする。 -
document を navigable の active document とする。
-
base を document の base URL とする。
-
url record を、base URL base で url に URL parser を適用した結果とする。
-
url record が failure である場合、invalid argument の error code を持つ error を返す。
-
request を、URL が url record である新しい request とする。
-
navigable、 request および wait condition で await 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-lengthsbrowsingContext.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 は次である:
-
navigable id を command parameters の
contextフィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
実装が何らかの理由で navigable のページ分割された表現を提供できない場合、 unsupported operation の error code を持つ error を返す。
-
margin を、command parameters に
marginフィールドが存在する場合は その値とし、そうでなければフィールドを既定値に設定したbrowsingContext.PrintMarginParametersに一致する map とする。 -
page size を、command parameters に
pageフィールドが存在する場合はその値とし、 そうでなければフィールドを既定値に設定したbrowsingContext.PrintPageParametersに一致する map とする。
注: 最小ページサイズは 1 ポイントであり、 absolute lengths に従うと (2.54 / 72) cm である。
-
page ranges を、command parameters に
pageRangesフィールドが存在する場合は その値とし、そうでなければ空の list とする。 -
document を navigable の active document とする。
-
document について、次に run the animation frame callbacks algorithm が呼び出された直後:
これは update rendering algorithm に、より明示的な方法で統合されるべきである。
-
pdf data を、 document のページ分割された表現を生成する UA 固有のステップを取り、 CSS media type を
printに設定し、 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 に合わせて リサイズする
- command parameters["
-
page ranges が空でない場合、 pages を、page ranges および pdf data に含まれるページ数で parse a page range することを 試みた結果とし、 one-based index が pages に含まれない任意のページを pdf data から削除する。
-
encoding result を、pdf data に対して Base64 Encode を呼び出した結果とする。
-
encoded data を encoding result の data とする。
-
body を、
browsingContext.PrintResult生成規則に一致する map とし、dataフィールドを encoded data に設定したものとする。 -
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
-
navigable id を command parameters の
contextフィールドの値とする。 -
navigable を、navigable id で get a navigable することを試みた結果とする。
-
Assert: navigable は null でない。
-
ignore cache を、command parameters に
ignoreCacheフィールドが存在する場合はその値とし、 そうでなければ false とする。 -
wait condition を "
committed" とする。 -
command parameters が
waitを含み、 かつ command parameters[wait] が "none" でない場合、 wait condition を command parameters[wait] に設定する。 -
document を navigable の active document とする。
-
url を document の URL とする。
-
request を、URL が url である新しい request とする。
-
navigable、 request、wait condition、history handling "
reload"、および ignore cache ignore cache で await 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 end は bypass CSP configuration を持ち、これは associated type boolean を持つ WebDriver configuration である。
navigable navigable が与えられたとき、 WebDriver BiDi CSP is bypassed steps は次である:
-
top-level traversable を navigable の top-level traversable とする。
-
bypass CSP enabled を、top-level traversable についての bypass CSP configuration の get WebDriver configuration value の結果とする。
-
Assert: bypass CSP enabled は
trueまたは unset である。 -
bypass CSP enabled が unset である場合、false を返す。
-
true を返す。
command parameters が与えられたときの remote end steps は次である:
-
bypass を command parameters["
bypass"] とする。 -
bypass が null である場合、bypass を unset に設定する。
-
command parameters について、 bypass CSP configuration bypass を store WebDriver configuration することを試みる。
-
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
-
device pixel ratio が null でない場合:
-
指定された navigable に現在読み込まれている document について:
-
select an image source from a source set steps が実行されるとき、画像を選択する際に 実装の pixel density が device pixel ratio に設定されたかのように振る舞う。
-
resolution media feature の目的では、 実装の resolution が page zoom によってスケールされた device pixel ratio dppx であるかのように振る舞う。
-
-
device pixel ratio overrides[navigable] を device pixel ratio に設定する。
注: これは § 8.3.1 Determine the device pixel ratio のパッチにより効果を持つ。
-
-
そうでなければ:
-
指定された navigable に現在読み込まれている document について:
-
select an image source from a source set steps が実行されるとき、 これらのステップの以前の呼び出しによって行われた変更なしに、 実装の既定の挙動を使用する。
-
resolution media feature の目的では、 これらのステップの以前の呼び出しによって行われた変更なしに、 実装の既定の挙動を使用する。
-
-
device pixel ratio overrides から navigable を削除する。
-
-
指定された navigable に現在読み込まれている document について evaluate media queries and report changes を実行する。
-
viewport が null でない場合、navigable の layout viewport の width を CSS pixels における viewport の width に設定し、 navigable の layout viewport の height を CSS pixels における viewport の height に設定する。
-
そうでなければ、navigable の layout viewport を 実装定義の既定値に設定する。
新しい navigable navigable に document を作成した後、かつ run WebDriver BiDi preload scripts algorithm が 呼び出される前:
TODO: 代わりに html spec の hook として移動する。
-
user context を navigable の associated user context とする。
-
navigable が top-level traversable である場合:
-
navigable について Update geolocation override する。
-
navigable について Update emulated forced colors theme する。
-
screen orientation overrides map が user context を含む場合、 navigable および screen orientation overrides map[user context] で set emulated screen orientation する。
-
-
viewport overrides map が user context を含む場合:
-
navigable が top-level traversable であり、かつ viewport overrides map[user context] の viewport が null でない場合:
-
navigable および viewport overrides map[user context] の viewport で Set viewport する。
-
-
viewport overrides map[user context] の devicePixelRatio が null でない場合:
-
navigable および viewport overrides map[user context] の devicePixelRatio で Set device pixel ratio override する。
-
-
-
navigable について Update scrollbar type override する。
command parameters を伴う remote end steps は次である:
-
実装が何らかの理由で、指定された command parameters を用いて layout viewport parameters を調整できない場合、 unsupported operation の error code を持つ error を返す。
-
command parameters が "
userContexts" を含み、 かつ command parameters が "context" を含む場合、 invalid argument の error code を持つ error を返す。 -
navigables を set とする。
-
command parameters の
contextフィールドが存在する場合:-
navigable id を command parameters の
contextフィールドの値とする。 -
navigable を、 navigable id で get a navigable することを試みた結果とする。
-
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
navigable を navigables に追加する。
-
-
そうでなく、command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
viewport overrides map[user context] を struct に設定する。
-
command parameters が "
viewport" を含む場合:-
viewport overrides map[user context] の viewport を command parameters["
viewport"] に設定する。
-
-
command parameters が "
devicePixelRatio" を含む場合:-
viewport overrides map[user context] の devicePixelRatio を command parameters["
devicePixelRatio"] に設定する。
-
-
For each user context が associated user context である すべての top-level traversables のリストの 各 top-level traversable について:
-
top-level traversable を navigables に追加する。
-
-
-
-
そうでなければ、invalid argument の error code を持つ error を返す。
-
command parameters が
viewportフィールドを含む場合:-
viewport を command parameters["
viewport"] とする。 -
navigables の各 navigable について:
-
navigable および viewport で Set viewport する。
-
navigable の active document で CSSOM View § 13.1 Resizing viewports steps を実行する。
-
-
-
command parameters が
devicePixelRatioフィールドを含む場合:-
device pixel ratio を command parameters["
devicePixelRatio"] とする。 -
navigables の各 navigable について:
-
navigable およびすべての descendant navigables について:
-
navigable および device pixel ratio で Set device pixel ratio override する。
-
-
-
-
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
-
navigable を、command parameters["
context"] で get a navigable することを試みた結果とする。 -
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
Assert: navigable は null でない。
-
delta を command parameters["
delta"] とする。 -
resume id を一意な文字列とする。
-
navigable の session history traversal queue 上に Queue a task して、次のステップを実行する:
-
all steps を、navigable について getting all used history steps した結果とする。
-
current index を、all steps 内における navigable の current session history step の index とする。
-
target index を current index に delta を加えたものとする。
-
all steps[target index] が存在しない場合、 valid entry を false とし、そうでなければ true とする。
-
"
check history"、resume id、および valid entry で Resume する。
-
-
is valid entry を、«"
check history"» および resume id で await したものとする。 -
is valid entry が false である場合、error code no such history entry を持つ error を返す。
-
delta および navigable が与えられたものとして Traverse the history by a delta する。
記述されている アルゴリズムには競合状態がある。なぜなら、ナビゲートを試みる時点で 対象の session history entry が存在しない可能性があるためである。 history のナビゲートを待機することをサポートすれば、これをより堅牢に扱える。
-
TODO: history traversal の完了待機をサポートする。
-
body を、
browsingContext.TraverseHistoryResult生成規則に一致する map とする。 -
data body とともに success を返す。
context および navigation status navigation status が与えられたとき、 WebDriver BiDi page show steps は次である:
`browsingContext.pageShow event を公開したいか?その場合、 これを bfcache restore の時だけでなく、`pageshow` が発火されようとするたびに呼び出す必要があり、 また persisted status を data に追加する必要がある。
context および navigation status navigation status が与えられたとき、 WebDriver BiDi pop state steps は次である:
7.3.4. イベント
7.3.4.1. browsingContext.contextCreated イベント
- イベント型
-
browsingContext.ContextCreated= (method:"browsingContext.contextCreated",params: browsingContext.Info )
session および navigable が与えられたとき、 Recursively emit context created events するには:
-
session および navigable で Emit a context created event する。
-
navigable の各 child navigable child について:
-
session および child が与えられたものとして Recursively emit context created events する。
-
session および navigable が与えられたとき、 Emit a context created event するには:
-
params を、navigable、0、および true が与えられたものとして get the navigable info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.ContextCreated生成規則に一致する map とする。 -
session および body で Emit an event する。
remote end event trigger は、 navigable navigable および navigable opener navigable が与えられたときの WebDriver BiDi navigable created steps である:
-
opener navigable が提供されている場合、navigable の original opener を opener navigable に設定する。
-
navigable についての navigable cache behavior が "
bypass" である場合、 navigable から発生する network requests について、実装固有の resource caches を無効にする実装定義のステップを実行する。 -
related navigables を、navigable を含む set とする。
-
"
browsingContext.contextCreated" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および navigable が与えられたものとして Emit a context created event する。
-
session、navigables および include global が与えられたとき、 subscribe priority 1 を伴う remote end subscribe steps は次である:
-
navigables 内の各 navigable について:
-
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 は、 navigable navigable が与えられたときの WebDriver BiDi navigable destroyed steps である:
-
params を、navigable、null、および true が与えられたものとして get the navigable info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.ContextDestroyed生成規則に一致する map とする。 -
related navigables を、navigable の parent が null でない場合はそれを含む set とし、そうでなければ空の set とする。
-
"
browsingContext.contextDestroyed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
subscriptions to remove を空の set とする。
-
session の subscriptions 内の各 subscription について:
-
subscription の top-level traversable ids が navigable の navigable id を 含む場合:
-
navigable の navigable id を subscription の top-level traversable ids から削除する。
-
subscription の top-level traversable ids が空である場合:
-
subscription を subscriptions to remove に追加する。
-
-
-
-
subscriptions to remove を session の subscriptions から削除する。
-
このイベントを active documents を持つ browsing contexts に対してのみ発火すべきかは不明である。navigation によって、contexts が アクセス不能になるが、bfcache のためまだ破棄されないこともある。
7.3.4.3. browsingContext.navigationStarted イベント
- イベント型
-
browsingContext.NavigationStarted= (method:"browsingContext.navigationStarted",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.NavigationStarted生成規則に一致する map とする。 -
navigation id を navigation status の id とする。
-
related navigables を navigable を含む set とする。
-
"
navigation started"、navigation id、および navigation status で Resume する。 -
"
browsingContext.navigationStarted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.4. browsingContext.fragmentNavigated イベント
- イベント型
-
browsingContext.FragmentNavigated= (method:"browsingContext.fragmentNavigated",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.FragmentNavigated生成規則に一致する map とする。 -
navigation id を navigation status の id とする。
-
related navigable を、navigable を含む set とする。
-
"
fragment navigated"、navigation id、および navigation status で Resume する。 -
"
browsingContext.fragmentNavigated" および related navigable が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit 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 }
-
url を、 navigable の active browsing context の active document の URL が与えられたものとして URL serializer を実行した結果とする。
-
user context id を、navigable の associated user context の user context id とする。
-
timestamp を、UTC における現在の日付と時刻を表す time value とする。
-
params を、
browsingContext.HistoryUpdatedParameters生成規則に一致する map とし、urlフィールドを url に、timestampフィールドを timestamp に、contextフィールドを navigable の navigable id に、userContextフィールドを user context id に設定したものとする。 -
body を、
paramsフィールドを params に設定した、browsingContext.HistoryUpdated生成規則に一致する map とする。 -
related browsing contexts を、 navigable の active browsing context を含む set とする。
-
"
browsingContext.historyUpdated" および related browsing contexts が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.6. browsingContext.domContentLoaded イベント
- イベント型
-
browsingContext.DomContentLoaded= (method:"browsingContext.domContentLoaded",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.DomContentLoaded生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
navigation id を navigation status の id とする。
-
"
domContentLoaded"、navigation id、および navigation status で Resume する。 -
"
browsingContext.domContentLoaded" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.7. browsingContext.load イベント
- イベント型
-
browsingContext.Load= (method:"browsingContext.load",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.Load生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
navigation id を navigation status の id とする。
-
"
load"、navigation id および navigation status で Resume する。 -
"
browsingContext.load" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.8. browsingContext.downloadWillBegin イベント
- イベント型
-
browsingContext.DownloadWillBegin= (method:"browsingContext.downloadWillBegin",params: browsingContext.DownloadWillBeginParams )browsingContext.DownloadWillBeginParams= {suggestedFilename: text, browsingContext.BaseNavigationInfo }
-
navigation info を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
params を、
browsingContext.DownloadWillBeginParams生成規則に一致する map とし、contextフィールドを navigation info["context"] に、navigationフィールドを navigation info["navigation"] に、timestampフィールドを navigation info["timestamp"] に、urlフィールドを navigation info["url"] に、そしてsuggestedFilenameフィールドを navigation status の suggestedFilename に設定したものとする。 -
body を、
paramsフィールドを params に設定した、browsingContext.DownloadWillBegin生成規則に一致する map とする。 -
navigation id を navigation status の id とする。
-
related navigables を、navigable を含む set とする。
-
"
download started"、navigation id、および navigation status で Resume する。 -
"
browsingContext.downloadWillBegin" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
-
download behavior を、navigable で get download behavior したものとする。
-
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 )
-
navigation info を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
navigation info["
status"] は "complete" または "canceled" のいずれかに等しいと Assert する。 -
navigation info["
status"] が "complete" である場合、 params をbrowsingContext.DownloadCompleteParams生成規則に一致する map とし、filepathフィールドを navigation status の downloadedFilepath に、contextフィールドを navigation info["context"] に、navigationフィールドを navigation info["navigation"] に、timestampフィールドを navigation info["timestamp"] に、そしてurlフィールドを navigation info["url"] に設定したものとする。注: completed downloads において、 何らかの理由で filepath が利用できない場合、
filepathは null になり得る。 -
そうでなければ、params を
browsingContext.DownloadCanceledParams生成規則に一致する map とし、contextフィールドを navigation info["context"] に、navigationフィールドを navigation info["navigation"] に、timestampフィールドを navigation info["timestamp"] に、そしてurlフィールドを navigation info["url"] に設定したものとする。 -
body を、
paramsフィールドを params に設定した、browsingContext.DownloadEnd生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
"
browsingContext.downloadEnd" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.10. browsingContext.navigationAborted イベント
- イベント型
-
browsingContext.NavigationAborted= (method:"browsingContext.navigationAborted",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.NavigationAborted生成規則に一致する map とする。 -
navigation id を navigation status の id とする。
-
related navigables を、navigable を含む set とする。
-
"
navigation aborted"、navigation id、および navigation status で Resume する。 -
"
browsingContext.navigationAborted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.11. browsingContext.navigationCommitted イベント
- イベント型
-
browsingContext.NavigationCommitted= (method:"browsingContext.navigationCommitted",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.NavigationCommitted生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
navigation id を navigation status の id とする。
-
"
navigation committed"、navigation id、および navigation status で Resume する。 -
"
browsingContext.navigationCommitted" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
7.3.4.12. browsingContext.navigationFailed イベント
- イベント型
-
browsingContext.NavigationFailed= (method:"browsingContext.navigationFailed",params: browsingContext.NavigationInfo )
-
params を、navigable および navigation status が与えられたものとして get the navigation info した結果とする。
-
body を、
paramsフィールドを params に設定した、browsingContext.NavigationFailed生成規則に一致する map とする。 -
navigation id を navigation status の id とする。
-
related navigables を、navigable を含む set とする。
-
"
navigation failed"、navigation id、および navigation status で Resume する。 -
"
browsingContext.navigationFailed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit 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 }
Window
window、文字列 type、boolean accepted、および省略可能な text user
text
(既定値: null)が与えられたときの WebDriver
BiDi user prompt closed steps である。
-
navigable を window の navigable とする。
-
navigable id を navigable の navigable id とする。
-
user context id を、navigable の associated user context の user context id とする。
-
params を、
contextフィールドを navigable id に、userContextフィールドを user context id に、acceptedフィールドを accepted に、typeフィールドを type に設定し、かつ user text が null でなければuserTextフィールドを user text に設定し、そうでなければ省略した、browsingContext.UserPromptClosedParameters生成規則に一致する map とする。 -
body を、
paramsフィールドを params に設定した、BrowsingContextUserPromptClosedEvent生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
"
browsingContext.userPromptClosed" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit 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 }
-
user context を navigable の associated user context とする。
-
unhandled prompt behavior overrides map が user context を含む場合:
-
unhandled prompt behavior override を unhandled prompt behavior overrides map[user context] とする。
-
unhandled prompt behavior override[type] が null でない場合、 unhandled prompt behavior override[type] を返す。
-
unhandled prompt behavior override[
"default"] が null でない場合、 unhandled prompt behavior override["default"] を返す。
-
-
handler configuration を、type で get the prompt handler したものとする。
-
handler configuration の handler を返す。
Window
window、文字列 type、文字列 message、および省略可能な text default
value
(既定値: null)が与えられたときの WebDriver
BiDi user prompt opened steps である。
-
navigable を window の navigable とする。
-
navigable id を navigable の navigable id とする。
-
user context id を、navigable の associated user context の user context id とする。
-
handler を、type および navigable で get navigable’s user prompt handler したものとする。
-
params を、
contextフィールドを navigable id に、userContextフィールドを user context id に、typeフィールドを type に、messageフィールドを message に、defaultValueフィールドを default value が null でなければ default value に設定し、 そうでなければ省略し、 かつhandlerフィールドを handler に設定した、browsingContext.UserPromptOpenedParameters生成規則に一致する map とする。 -
body を、
paramsフィールドを params に設定した、browsingContext.UserPromptOpened生成規則に一致する map とする。 -
related navigables を、navigable を含む set とする。
-
"
browsingContext.userPromptOpened" および related navigables が与えられたものとして、 set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
-
handler が "
ignore" である場合、handler を "none" に設定する。 -
handler を返す。
7.4. emulation モジュール
emulation モジュールは、ブラウザー API のエミュレーションに関するコマンドおよびイベントを含む。
7.4.1. 定義
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 session は emulated user agent を持つ。これは struct であり、 string または null である default user agent という名前の item、 user contexts と string の間の weak map である user context user agent という名前の item、および navigables と string の間の weak map である navigable user agent という名前の item を持つ。
BiDi session は emulated maxTouchPoints を持つ。これは struct であり、 integer または null であり初期値が null である default という名前の item、 user contexts と integer の間の weak map であり初期値が空である user contexts という名前の item、 および navigables と integer の間の weak map であり初期値が空である navigables という名前の item を持つ。
screen orientation override は、次を持つ struct である:
remote end は screen orientation overrides map を持つ。これは user contexts と screen 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 end は forced colors mode theme override configuration を持つ。これは associated type string を持つ WebDriver configuration である。
-
theme を、navigable についての forced colors mode theme override configuration の get WebDriver configuration value の結果とする。
-
Assert: theme は "
light"、"dark" または unset である。 -
theme が unset である場合、theme を "
none" に設定する。 -
navigable および theme で Set emulated forced colors theme data する。
command parameters を伴う remote end steps は次である:
-
theme を command parameters["
theme"] とする。 -
theme が null である場合、theme を unset に設定する。
-
実装が theme の設定をサポートしない場合、 unsupported operation の error code を持つ error を返す。
-
affected navigables を、command parameters について forced colors mode theme override configuration theme を store WebDriver configuration することを試みた結果とする。
-
affected navigables の各 navigable について:
-
navigable について Update emulated forced colors theme する。
-
-
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 である:
-
float である
latitudeという名前の item; -
float である
longitudeという名前の item; -
float である
accuracyという名前の item; -
float または null である
altitudeという名前の item; -
float または null である
altitudeAccuracyという名前の item; -
float または null である
headingという名前の item; -
float または null である
speedという名前の item。
remote end は geolocation override configuration を持つ。これは associated type geolocation override を持つ WebDriver configuration である。
-
emulated position data を、 navigable についての geolocation override configuration の get WebDriver configuration value の結果とする。
-
emulated position data が unset である場合、emulated position data を null に設定する。
-
navigable および emulated position data で Set emulated position data する。
command parameters を伴う remote end steps は次である:
-
command parameters が "
coordinates" を含み、 command parameters["coordinates"] が "altitudeAccuracy" を含み、 かつ command parameters["coordinates"] が "altitude" を含まない場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
error" を含む場合:-
command parameters["
error"]["type"] が "positionUnavailable" に等しいことを Assert する。 -
emulated position data を、
codeフィールドを POSITION_UNAVAILABLE に、messageフィールドを空文字列に設定した、 GeolocationPositionError 生成規則に一致する map とする。注:
messageは geolocation 仕様に従って実装に無視される。
-
-
そうでなければ、emulated position data を command parameters["
coordinates"] とする。 -
emulated position data が null である場合、emulated position data を unset に設定する。
-
affected navigables を、command parameters について geolocation override configuration emulated position data を store WebDriver configuration することを試みた結果とする。
-
affected navigables の各 navigable について:
-
navigable について Update geolocation override する。
-
-
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 が与えられたとき、次である:
-
related navigables を、 environment settings が与えられたものとして get related navigables した結果とする。
-
related navigables の各 navigable について:
-
top-level traversable を navigable の top-level traversable とする。
-
user context を top-level traversable の associated user context とする。
-
locale overrides map が top-level traversable を含む場合、 locale overrides map[top-level traversable] を返す。
-
locale overrides map が user context を含む場合、 locale overrides map[user context] を返す。
-
-
null を返す
command parameters を伴う remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argument の error code を持つ error を返す。 -
emulated locale を command parameters["
locale"] とする。 -
emulated locale が null でなく、かつ IsStructurallyValidLanguageTag(emulated locale) が false を返す場合、invalid argument の error code を持つ error を返す。
-
navigables を set とする。
-
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。
-
-
そうでなければ:
-
command parameters の
userContextsフィールドが存在することを Assert する。 -
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated locale が null である場合、user context を locale overrides map から削除する。
-
そうでなければ、locale overrides map[user context] を emulated locale に設定する。
-
For each user context が associated user context である すべての top-level traversables のリストの各 top-level traversable について:
-
top-level traversable を navigables に追加する。
-
-
-
-
navigables の各 navigable について:
-
emulated locale が null である場合、 navigable を locale overrides map から削除する。
-
そうでなければ、locale overrides map[navigable] を emulated locale に設定する。
-
-
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.NetworkConditionsOfflineemulation.NetworkConditionsOffline= {type:"offline"} - 戻り値型
-
emulation.SetNetworkConditionsResult= EmptyResult
apply network conditions するには:
-
各 WebSocket object webSocket について:
-
realm を webSocket の relevant Realm とする。
-
environment settings を、その realm execution context の Realm component が realm である environment settings object とする。
-
environment settings で WebDriver BiDi network is offline した結果が true である場合:
-
webSocket について Fail the WebSocket connection する。
-
-
-
各 WebTransport object webTransport について:
-
realm を webSocket の relevant Realm とする。
-
environment settings を、その realm execution context の Realm component が realm である environment settings object とする。
-
environment settings で WebDriver BiDi network is offline した結果が true である場合:
-
webTransport について Cleanup WebTransport する。
-
-
command parameters および session を伴う remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "context" を含む場合、 invalid argument の error code を持つ error を返す。 -
emulated network conditions を null とする。
-
command parameters["
networkConditions"] が null でなく、かつ command parameters["networkConditions"]["type"] が "offline" に等しい場合、emulated network conditions を offline を true に設定した新しい emulated network conditions struct に設定する。 -
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
navigables の各 navigable について:
-
emulated network conditions が null である場合、 navigable を session の emulated network conditions の navigable network conditions から削除する
-
そうでなければ、session の emulated network conditions の navigable network conditions[navigable] を emulated network conditions に設定する。
-
-
-
command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated network conditions が null である場合、 user context を session の emulated network conditions の user context network conditions から削除する。
-
そうでなければ、session の emulated network conditions の user context network conditions[user context] を emulated network conditions に設定する。
-
-
-
command parameters が "
userContexts" を含まず、 かつ command parameters が "context" を含まない場合、 session の emulated network conditions の default network conditions を emulated network conditions に設定する。 -
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 が与えられたとき、次である:
-
top-level traversable を navigable の top-level traversable とする。
-
user context を top-level traversable の associated user context とする。
-
screen settings overrides が top-level traversable を含む場合、 screen settings overrides[top-level traversable] を返す。
-
screen settings overrides が user context を含む場合、 screen settings overrides[user context] を返す。
-
null を返す
WebDriver BiDi emulated total screen area steps は、navigable navigable が与えられたとき、次である:
-
top-level traversable を navigable の top-level traversable とする。
-
user context を top-level traversable の associated user context とする。
-
screen settings overrides が top-level traversable を含む場合、 screen settings overrides[top-level traversable] を返す。
-
screen settings overrides が user context を含む場合、 screen settings overrides[user context] を返す。
-
null を返す
command parameters を伴う remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argument の error code を持つ error を返す。 -
emulated screen area を command parameters["
screenArea"] とする。 -
emulated screen area が null でない場合:
-
navigables を set とする。
-
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
target を navigable screen settings とする。
-
navigables の各 navigable について:
-
data null とともに success を返す。
-
-
そうでなければ:
-
command parameters の
userContextsフィールドが存在することを Assert する。 -
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
target を user context screen settings とする。
-
user contexts の各 user context について:
-
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 仕様へ移動する。
-
emulated screen orientation が null である場合:
-
navigable の current orientation angle を 実装定義の既定値に設定する。
-
navigable の current orientation type を 実装定義の既定値に設定する。
-
-
そうでなければ:
-
emulated orientation type を emulated screen orientation["
type"] とする。 -
emulated orientation angle を、 screen orientation values lists で定義されるとおり、 emulated screen orientation["
natural"] orientations を持つ screen についての emulated orientation type に関連付けられた角度とする。 -
current orientation angle を emulated orientation angle に設定する。
-
current orientation type を emulated orientation type に設定する。
-
-
navigable の active document で、 screen orientation change steps を実行する。
command parameters を伴う remote end steps は次である:
-
実装が何らかの理由で、指定された command parameters を用いて screen orientations parameters を調整できない場合、 unsupported operation の error code を持つ error を返す。
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argument の error code を持つ error を返す。 -
emulated screen orientation を command parameters["
screenOrientation"] とする。 -
navigables を set とする。
-
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。
-
-
そうでなく、command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated screen orientation が null である場合、 user context を screen orientation overrides map から削除する。
-
そうでなければ、screen orientation overrides map[user context] を emulated screen orientation に設定する。
-
For each user context が associated user context である すべての top-level traversables のリストの各 top-level traversable について:
-
top-level traversable を navigables に追加する。
-
-
-
-
navigables の各 navigable について:
-
user context を navigable の associated user context とする。
-
emulated screen orientation が null であり、かつ screen orientation overrides map が user context を含む場合、navigable および screen orientation overrides map[user context] で set emulated screen orientation する。
-
そうでなければ、navigable および emulated screen orientation で set emulated screen orientation する。
-
-
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
-
related navigables を、environment settings で get related navigables した結果とする。
-
related navigables の各 navigable について:
-
top-level navigable を navigable の top-level traversable とする。
-
user context を top-level navigable の associated user context とする。
-
active BiDi sessions 内の各 session について:
-
session の emulated user agent の navigable user agent が top-level navigable を含む場合、session の emulated user agent の navigable user agent[top-level navigable] を返す。
-
-
active BiDi sessions 内の各 session について:
-
session の emulated user agent の user context user agent が user context を含む場合、session の emulated user agent の user context user agent[user context] を返す。
-
-
-
active BiDi sessions 内の各 session について:
-
default emulated user agent を session の emulated user agent の default user agent とする。
-
default emulated user agent が null でない場合、 default emulated user agent を返す。
-
-
null を返す。
session および command parameters が与えられたときの remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
emulated user agent を command parameters["
userAgent"] とする。 -
command parameters が "
contexts" を含む場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
navigables の各 navigable について:
-
emulated user agent が null である場合、 navigable を session の emulated user agent の navigable user agent から削除する。
-
そうでなければ、session の emulated user agent の navigable user agent[navigable] を emulated user agent に設定する。
-
-
data null とともに success を返す。
-
-
command parameters が "
userContexts" を含む場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated user agent が null である場合、 user context を session の emulated user agent の user context user agent から削除する。
-
そうでなければ、session の emulated user agent の user context user agent[user context] を emulated user agent に設定する。
-
-
data null とともに success を返す。
-
-
session の emulated user agent の default user agent を emulated user agent に設定する。
-
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 のエミュレーションのみが サポートされる。
-
navigable を、settings の relevant global object の associated
Documentの node navigable とする。 -
top-level traversable を navigable の top-level traversable とする。
-
scripting enabled overrides map が top-level traversable を含む場合、 scripting enabled overrides map[top-level traversable] を返す。
-
user context を top-level traversable の associated user context とする。
-
scripting enabled overrides map が user context を含む場合、 scripting enabled overrides map[user context] を返す。
-
true を返す。
command parameters を伴う remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argument の error code を持つ error を返す。 -
emulated scripting enabled status を command parameters["
enabled"] とする。 -
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
navigables の各 navigable について:
-
emulated scripting enabled status が null である場合、 navigable を scripting enabled overrides map から削除する。
-
そうでなければ、scripting enabled overrides map[navigable] を emulated scripting enabled status に設定する。
-
-
-
command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated scripting enabled status が null である場合、 user context を scripting enabled overrides map から削除する。
-
そうでなければ、scripting enabled overrides map[user context] を emulated scripting enabled status に設定する。
-
-
-
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 end は scrollbar type override configuration を持ち、 これは WebDriver configuration であり、associated type string を持つ。
-
scrollbar type override を、 navigable についての scrollbar type override configuration の get WebDriver configuration value の結果とする。
-
Assert: scrollbar type override は "
classic"、 "overlay" または unset である。 -
scrollbar type override が "
classic" である場合、 navigable の active document が classic scrollbars を使用するようにする implementation-defined steps を実行し、戻る。 -
scrollbar type override が "
overlay" である場合、 navigable の active document が overlay scrollbars を使用するようにする implementation-defined steps を実行し、戻る。 -
Assert: scrollbar type override は unset である。
-
navigable の active document が implementation-defined default scrollbar type を 使用するようにする implementation-defined steps を実行する。
command parameters が与えられたときの remote end steps は次である:
-
scrollbar type override を command parameters["
scrollbarType"] とする。 -
scrollbar type override が null である場合、scrollbar type override を unset に設定する。
-
実装が scrollbar type override の設定をサポートしない場合、unsupported operation の error code を持つ error を返す。
-
affected navigables を、command parameters について scrollbar type override configuration scrollbar type override を store WebDriver configuration することを試みた結果とする。
-
affected navigables の各 navigable について:
-
navigable について Update scrollbar type override する。
-
-
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
-
emulated timezone を null とする。
-
realm を current Realm Record とする。
-
environment settings を、その realm execution context の Realm component が realm である environment settings object とする。
-
related navigables を、 environment settings が与えられたものとして get related navigables した結果とする。
-
related navigables の各 navigable について:
-
top-level traversable を navigable の top-level traversable とする。
-
user context を top-level traversable の associated user context とする。
-
timezone overrides map が top-level traversable を含む場合、 emulated timezone を timezone overrides map[top-level traversable] に設定する。
-
そうでなく、timezone overrides map が user context を含む場合、 emulated timezone を timezone overrides map[user context] に設定する。
-
-
emulated timezone が null でない場合、emulated timezone を返す。
-
SystemTimeZoneIdentifier 仕様の要件に従った implementation-defined steps の結果を返す。
command parameters を伴う remote end steps は次である:
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
userContexts" を含まず、 かつ command parameters が "contexts" を含まない場合、 invalid argument の error code を持つ error を返す。 -
emulated timezone を command parameters["
timezone"] とする。 -
emulated timezone が null でなく、かつ IsTimeZoneOffsetString(emulated timezone) が false を返し、かつ AvailableNamedTimeZoneIdentifiers が emulated timezone を含まない場合、 invalid argument の error code を持つ error を返す。
-
navigables を set とする。
-
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。
-
-
そうでなければ:
-
command parameters の
userContextsフィールドが存在することを Assert する。 -
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
emulated timezone が null である場合、 user context を timezone overrides map から削除する。
-
そうでなければ、timezone overrides map[user context] を emulated timezone に設定する。
-
For each user context が associated user context である すべての top-level traversables のリストの各 top-level traversable について:
-
top-level traversable を navigables に追加する。
-
-
-
-
navigables の各 navigable について:
-
emulated timezone が null である場合、navigable を timezone overrides map から削除する。
-
そうでなければ、timezone overrides map[navigable] を emulated timezone に設定する。
-
-
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
-
related navigables を、environment settings で get related navigables した結果とする。
-
related navigables の各 navigable について:
-
top-level navigable を navigable の top-level traversable とする。
-
user context を top-level navigable の associated user context とする。
-
active BiDi sessions 内の各 session について:
-
session の emulated maxTouchPoints の navigables が top-level navigable を含む場合、 session の emulated maxTouchPoints の navigables[top-level navigable] を返す。
-
-
active BiDi sessions 内の各 session について:
-
session の emulated maxTouchPoints の user contexts が user context を含む場合、session の emulated maxTouchPoints の user contexts[user context] を返す。
-
-
-
active BiDi sessions 内の各 session について:
-
emulated maxTouchPoints を session の emulated maxTouchPoints の default とする。
-
emulated maxTouchPoints が null でない場合、emulated maxTouchPoints を返す。
-
-
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 を実行してもよい。
-
command parameters が "
userContexts" を含み、 かつ command parameters が "contexts" を含む場合、invalid argument の error code を持つ error を返す。 -
maxTouchPoints を command parameters["
maxTouchPoints"] とする。 -
command parameters の
contextsフィールドが存在する場合:-
navigables を、 command parameters["
contexts"] で get valid top-level traversables by ids することを試みた結果とする。 -
navigables の各 navigable について:
-
maxTouchPoints が null である場合、 navigable を session の emulated maxTouchPoints の navigables から削除する。
-
そうでなければ、session の emulated maxTouchPoints の navigables[navigable] を maxTouchPoints に設定する。
-
-
data null とともに success を返す。
-
-
command parameters の
userContextsフィールドが存在する場合:-
user contexts を、 command parameters["
userContexts"] で get valid user contexts することを試みた結果とする。 -
user contexts の各 user context について:
-
maxTouchPoints が null である場合、 user context を session の emulated maxTouchPoints の user contexts から削除する。
-
そうでなければ、session の emulated maxTouchPoints の user contexts[user context] を maxTouchPoints に設定する。
-
-
data null とともに success を返す。
-
-
session の emulated maxTouchPoints の default を maxTouchPoints に設定する。
-
data null とともに success を返す。
7.5. network モジュール
network モジュールは、network requests に関するコマンドおよびイベントを含む。
7.5.1. 定義
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
)
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 end は before request sent map を持ち、これは初期状態では
空の map である。これは、network.beforeRequestSent イベントがすでに送信された
network events を追跡するために使用される。
remote end は default cache behavior を持ち、これは string である。
これは初期状態では "default" である。
remote end は navigable cache behavior map を持ち、これは top-level traversables と cache behavior を表す strings の間の weak map である。これは初期状態では空である。
BiDi session は extra headers を持ち、これは struct であり、 default headers という名前の item を持つ。これは header list である(初期状態では空の header list に設定される)。また、 user context headers という名前の item を持ち、これは user contexts と header lists の間の weak map である。さらに、 navigable headers という名前の item を持ち、 これは navigables と header lists の間の weak map である。
7.5.2. ネットワークデータ収集
network data は、次を持つ struct である:
-
bytes という名前の item。これは
network.BytesValueまたは null である。 -
collectors という名前の item。これは
network.Collectorの list である。 -
pending という名前の item。これは boolean である。
-
request という名前の item。これは request id である。
-
size という名前の item。これは js-uint または null である。
-
type という名前の item。これは
network.DataTypeである。
collector は、次を持つ struct である:
-
max encoded item size という名前の item。これは js-uint である。
-
contexts という名前の item。これは list of navigable id である。
-
data types という名前の item。これは list of
network.DataTypeである。 -
collector という名前の item。これは
network.Collectorである。 -
collector type という名前の item。これは
network.CollectorTypeである。 -
user contexts という名前の item。これは list of
browser.UserContextである。
注: max encoded item size は item ごとの制限(response または request)を定義し、 特定の collector によって収集されるサイズを制限しない。収集されたすべての resources の合計サイズは max total collected size によって制限される。
BiDi session は network collectors
を持ち、これは
network.Collector
と collector の間の
map
である。これは初期状態では空である。
remote end は collected network data を持ち、これは network data の list である。 これは初期状態では空である。
remote end は max total collected size を持ち、これは collected network data において network data の収集に割り当てられる サイズを表す js-uint である。その値は実装定義である。
注: これにより、実装は resource usage limits を設定できる。 limits は、画像や webpage で使用される fonts など、browser によって完全に decode され処理される data の収集に users が依存できる程度に十分大きいことが期待される。
-
navigable を null とする。
-
request の client が environment settings object である場合:
-
environment settings を request の client とする
-
environment settings の global object が active window である navigable が存在する場合、 navigable をその navigable に設定する。
-
-
navigable を返す。
-
-
collector の contexts が navigable の navigable id を含む場合、true を返す。
-
そうでなければ、false を返す。
-
-
collector の user contexts が空でない場合:
-
user context を navigable の associated user context とする。
-
collector の user contexts が user context の user context id を含む場合、true を返す。
-
そうでなければ、false を返す。
-
-
true を返す。
-
request の body が null である場合、戻る。
-
active BiDi sessions 内の各 session について:
-
session の network collectors が空でない場合:
-
collected data を、 network data とし、 bytes を null に設定し、 cloned body を request の body の clone に設定し、 collectors を空の list に設定し、 pending を true に設定し、 request を request の request id に設定し、 size を null に設定し、 type を "request" に設定したものとする。
-
collected data を collected network data に追加する。
-
戻る。
-
-
-
response body が null である場合、戻る。
-
active BiDi sessions 内の各 session について:
-
session の network collectors が空でない場合:
-
collected data を、 network data とし、 bytes を null に設定し、 cloned body を response body の clone に設定し、 collectors を空の list に設定し、 pending を true に設定し、 request を request の request id に設定し、 size を null に設定し、 type を "response" に設定したものとする。
-
collected data を collected network data に追加する。
-
戻る。
-
-
-
collected network data の各 collected data について:
-
null を返す。
-
collected data を、request の request id および "response" で get collected data したものとする。
-
collected data が null である場合、戻る。
-
collected data の pending を false に設定する。
-
"
network data collected" および (request の request id, "response") で Resume する。
-
collected data を、request の request id および "request" で get collected data したものとする。
-
collected data が null である場合、戻る。
注: これは、request が作成されたときに collectors が設定されておらず、 WebDriver BiDi clone network request body が対応する body を clone しない場合に起こり得る。 または、そもそも body が null であった場合にも起こり得る。
-
request、collected data、null、および "request" で Maybe collect network data する。
-
response の status が redirect status である場合、戻る。
注: redirects については、最終 response body のみが保存される。
-
collected data を、request の request id および "response" で get collected data したものとする。
-
collected data が null である場合、戻る。
注: これは、response が作成されたときに collectors が設定されておらず、 WebDriver BiDi clone network response body が対応する body を clone しない場合に起こり得る。 または、そもそも body が null であった場合にも起こり得る。
-
size を、response の response body info の encoded size とする。
注: fetch stream から取得される bytes は decoded data に対応するが、size limits を計算するためには encoded (network) size が使用される、 という不一致がある。実装は、getData で clients に返される data が decoded data と同一である限り、 decoded data を保存するよりも少ない size を使用する storage model を採用してもよい。 storage と performance の潜在的な tradeoff は実装次第である。
-
request、collected data、size および "response" で Maybe collect network data する。
-
collected data の pending を false に設定する。
-
navigable を、 request で get navigable for request したものとする。
-
navigable が null である場合:
-
collected data を collected network data から削除する。
-
"
network data collected" および (request の request id, data type) で Resume する。 -
戻る。
これは navigable に関係しない data の収集を防ぐ。 collector configuration に照らして確認するために navigable を取得する必要はまだあるが、 ここで null を受け入れることもできる。
-
-
top-level navigable を navigable の top-level traversable とする。
-
collectors を空の list とする。
-
active BiDi sessions 内の各 session について:
-
session の network collectors 内の各 collector について:
-
collector の data types が data type を含み、かつ collector および top-level navigable で match collector for navigable した場合:
-
collector を collectors に追加する。
-
-
-
-
collectors が空である場合:
-
collected data を collected network data から削除する。
-
"
network data collected" および (request の request id, data type) で Resume する。 -
戻る。
-
-
bytes を null とする。
-
nullOrBytes が与えられたときの processBody を、このステップとする:
-
nullOrBytes が null でない場合:
-
bytes を、 nullOrBytes で serialize protocol bytes した結果に設定する。
-
size が null である場合、size を bytes の length に設定する。
-
-
-
processBodyError を、このステップとする: 何もしない。
-
processBody および processBodyError が与えられたものとして、collected data の cloned body を Fully read する。
-
bytes が null でない場合:
-
collectors 内の各 collector について:
-
size が collector の max encoded item size 以下である場合、 collector の collector を collected data の collectors に追加する。
-
-
collected data の collectors が空でない場合:
-
size が与えられたものとして Allocate size to record data する。
-
collected data の bytes を bytes に設定する。
-
collected data の size を size に設定する。
-
-
そうでなければ、collected data を collected network data から削除する。
-
-
"
network data collected" および (request の request id, data type) で Resume する。
-
available size を max total collected size とする。
-
already collected data を空の list とする。
-
collected network data 内の各 collected data について:
-
size が available size より大きい場合:
-
collected data の collectors が collector id を含む場合:
-
collector id を collected data の collectors から削除する。
-
collected data の collectors が空である場合:
-
collected data を collected network data から削除する。
-
-
7.5.3. ネットワークインターセプト
network intercept は、remote ends が network requests および responses をインターセプトし、 変更できるようにする仕組みである。
BiDi session は intercept map を持ち、
これは intercept id と、active network intercepts のプロパティを定義する
url patterns、phases、および contexts の field を持つ
struct との間の
map
である。これは初期状態では空である。
BiDi session は blocked request
map を持ち、これは現在 active に block されている
requests を追跡するために使用される。これは request
id
と、request、phase、および
response の field を持つ struct との間の
map
である。
これは初期状態では空である。
session、event、request、および navigable id が与えられたとき、get the network intercepts するには:
-
session intercepts を session の intercept map とする。
-
intercepts を空の list とする。
-
最初に一致する条件の下にある steps を実行する:
- event が "
network.beforeRequestSent" である - phase を "
beforeRequestSent" に設定する。 - event が "
network.responseStarted" である - phase を "
responseStarted" に設定する。 - event が "
network.authRequired" である - phase を "
authRequired" に設定する。 - event が "
network.responseCompleted" である - intercepts を返す。
- event が "
-
url を、request の URL で URL serializer を実行した結果とする。
-
session intercepts の各 intercept id → intercept について:
-
intercept の
contextsが null でない場合:-
intercept の
contextsが navigable id を含まない場合:-
続行する。
-
-
-
intercept の
phasesが phase を含む場合:-
url patterns を intercept の
url patternsとする。 -
url patterns が空である場合:
-
intercept id を intercepts に追加する。
-
続行する。
-
-
url patterns 内の各 url pattern について:
-
url pattern および url で match URL pattern した場合:
-
intercept id を intercepts に追加する。
-
中断する。
-
-
-
-
-
intercepts を返す。
-
blocked requests を session の blocked request map とする。
-
request id を command parameters["
request"] とする。 -
blocked requests が request id を含まない場合、 no such request の error code を持つ error を返す。
-
(request, phase, response) を blocked requests[request id] とする。
-
phase が "
beforeRequestSent" であり、かつ command が "continueResponse" である場合、"invalid argument" の error code を持つ error を返す。TODO: 別の error を検討する
-
response が null である場合:
-
Assert: phase は "
beforeRequestSent" である。 -
response を新しい response に設定する。
-
-
command parameters が "
statusCode" を含む場合:-
responses の status を command parameters["
statusCode"] に設定する。
-
-
command parameters が "
reasonPhrase" を含む場合:-
responses の status message を、 command parameters["
reasonPhrase"] で UTF-8 encode した結果に設定する。
-
-
command parameters が "
headers" を含む場合:-
headers を、 command parameters["
headers"] で create a headers list することを試みた結果とする。 -
response の header list を headers に設定する。
-
-
command parameters が "
cookies" を含む場合:-
command parameters が "
headers" を含む場合、headers を response の header list とする。そうでなければ:
-
headers を空の header list とする。
-
response の headers list 内の各 header について:
-
name を header の name とする。
-
name を byte-lowercase したものが `
set-cookie` でない場合:-
header を headers に追加する
-
-
-
-
command parameters["
cookies"] 内の各 cookie について:-
header value を、cookie で serialize set-cookie header した結果とする。
-
(`
Set-Cookie`, header value) を headers に追加する。 -
response の header list を headers に設定する。
-
-
-
command parameters が "
credentials" を含む場合:-
credentials を command parameters["
credentials"] とする。 -
Assert: credentials["
type"] は "password" である。 -
response の authentication credentials を (credentials["
username"], credentials["password"]) に設定する
-
-
response を返す
7.5.4. 型
7.5.4.1. network.AuthChallenge 型
network.AuthChallenge= {scheme: text,realm: text, }
response が与えられたとき、extract challenges するには:
-
response の status が 401 である場合、header name を `
WWW-Authenticate` とする。そうでなく、response の status が 407 である場合、 header name を `Proxy-Authenticate` とする。そうでなければ null を返す。 -
challenges を新しい list とする。
-
response の header list 内の各 (name, value) について:
Fetch と同様に、 複数 headers、parsing issues などを処理する正しい方法であるかどうかは不明である。
-
name が header name に対する byte-case-insensitive match である場合:
-
header challenges を、value を challenges の list に parse した結果とする。各 challenge は scheme および parameters の list からなり、 各 parameter は tuple (name, value) であり、[RFC9110] の規則に従う。
-
header challenges 内の各 header challenge について:
-
scheme を header challenge の scheme とする。
-
realm を空文字列とする。
-
header challenge の parameters 内の各 (param name, param value) について:
-
param name が `
realm` と等しい場合、 realm を param value で UTF-8 decode した結果とする。
-
-
challenge を、
schemefield を scheme に設定し、realmfield を realm に設定した、network.AuthChallengeproduction に一致する新しい map とする。
-
-
challenge を challenges に追加する。
-
-
-
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` を含めることを検討する。
-
request data を、request で get the request data した結果とする。
-
navigation を request の navigation id とする。
-
navigable id を null とする。
-
top-level navigable id を null とする。
-
user context id を null とする。
-
request の client が environment settings object である場合:
-
environment settings を request の client とする。
-
environment settings の global object が active window である navigable が存在する場合、navigable id をその navigable の navigable id に設定し、top-level navigable id をその navigable の top-level traversable の navigable id に設定し、 user context id をその navigable の associated user context の user context id に設定する。
-
-
intercepts を、 session、event、request、および top-level navigable id で get the network intercepts した結果とする。
-
redirect count を request の redirect count とする。
-
timestamp を、UTC における現在の日付と時刻を表す time value とする。
-
intercepts が空でない場合、 is blocked を true とし、そうでなければ is blocked を false とする。
-
params を、
network.BaseParametersproduction に一致する map とし、requestfield を request data に設定し、 navigation field をnavigationに設定し、contextfield を navigable id に設定し、userContextfield を user context id に設定し、timestampfield を timestamp に設定し、redirectCountfield を redirect count に設定し、isBlockedfield を is blocked に設定し、is blocked が true である場合はinterceptsfield を intercepts に設定し、そうでなければ省略する。 -
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 で表される。
注: これは
network.BytesValue
として encode された bytes を受け取り、
byte sequence を返す。
-
protocol bytes が
network.StringValueproduction に一致する場合、 bytes を、protocol bytes["value"] で UTF-8 encode した結果とする。 -
そうでなく、protocol bytes が
network.Base64Valueproduction に一致する場合、bytes を、protocol bytes["value"] で forgiving-base64 decode した結果とする。 -
bytes を返す。
注: これは byte sequence
を受け取り、
network.BytesValue
を返す。
-
text を、bytes で UTF-8 decode without BOM or fail した結果とする。
-
text が failure である場合、value を bytes で forgiving-base64 encode した結果に設定した、
network.Base64Valueproduction に一致する map を返す。 -
value を text に設定した、
network.StringValueproduction に一致する 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 の異なる種類を表す。
7.5.4.7. network.Cookie 型
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 を表す。
-
name を、stored cookie の name field で UTF-8 decode した結果とする。
-
value を、stored cookie の value で serialize protocol bytes した結果とする。
-
domain を stored cookie の domain field とする。
-
path を stored cookie の path field とする。
-
expiry を、設定されている場合は unix timestamp として表された stored cookie の expiry-time field とし、そうでなければ null とする。
-
size を、stored cookie が
Cookieheader で表されるときの形式で serialize した結果の byte length とする。 -
http only を、stored cookie の http-only-flag が true である場合は true とし、 そうでなければ false とする。
-
secure を、stored cookie の secure-only-flag が true である場合は true とし、 そうでなければ false とする。
-
same site を、stored cookie の same-site-flag が "
None" である場合は "none"、"Lax" である場合は "lax"、"Strict" である場合は "strict"、または "Default" である場合は "default" とする -
network.Cookieproduction に一致する map を返す。namefield を name に設定し、valuefield を value に設定し、domainfield を domain に設定し、pathfield を path に設定し、expiryfield を expiry が null でない場合はそれに設定し、そうでなければ省略し、sizefield を size に設定し、httpOnlyfield を http only に設定し、securefield を secure に設定し、sameSitefield を same site に設定する。
7.5.4.8. network.CookieHeader 型
network.CookieHeader= {name: text,value: network.BytesValue, }
network.CookieHeader 型は、Cookie request header 内にある
cookie data の subset を表す。
-
name を、protocol cookie["
name"] で UTF-8 encode した結果とする。 -
value を、protocol cookie["
value"] で deserialize protocol bytes した結果とする。 -
header value を、name、 `
=`、および value を連結して形成される byte sequence とする -
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 の client の time origin を基準とした、
request の
各部分の時刻を表す。
-
global を request の client とする。
-
global が null である場合、すべての fields を 0 に設定した
network.FetchTimingInfoproduction に一致する map を返す。 -
time origin を、global で get time origin timestamp した結果とする。
-
timings を request の fetch timing info とする。
-
connection timing を、timings の final connection timing info が null でない場合はそれとし、 そうでなければ新しい connection timing info とする。
-
request time を、timings の start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
redirect start を、timings の redirect start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
redirect end を、timings の redirect end time および global が与えられたものとして convert fetch timestamp した結果とする。
-
fetch start を、timings の post-redirect start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
DNS start を、connection timing の domain lookup start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
DNS end を、connection timing の domain lookup end time および global が与えられたものとして convert fetch timestamp した結果とする。
-
TLS start を、connection timing の secure connection start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
connect start を、connection timing の connection start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
connect end を、connection timing の connection end time および global が与えられたものとして convert fetch timestamp した結果とする。
-
request start を、timings の final network-request start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
response start を、timings の final network-response start time および global が与えられたものとして convert fetch timestamp した結果とする。
-
response end を、timings の end time および global が与えられたものとして convert fetch timestamp した結果とする。
-
network.FetchTimingInfoproduction に一致する map を返す。timeOriginfield を time origin に設定し、requestTimefield を request time に設定し、redirectStartfield を redirect start に設定し、redirectEndfield を redirect end に設定し、fetchStartfield を fetch start に設定し、dnsStartfield を DNS start に設定し、dnsEndfield を DNS end に設定し、connectStartfield を connect start に設定し、connectEndfield を connect end に設定し、tlsStartfield を TLS start に設定し、requestStartfield を request start に設定し、responseStartfield を response start に設定し、responseEndfield を 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 を、name bytes で UTF-8 decode した結果とする。
Assert: header names は ASCII-only に制約されているため、これは失敗し得ない。
-
value を、value bytes で serialize protocol bytes した結果とする。
-
namefield を name に設定し、valuefield を value に設定した、network.Headerproduction に一致する map を返す。
-
name を、protocol header["
name"] で UTF-8 encode した結果とする。 -
value を、protocol header["
value"] で deserialize protocol bytes した結果とする。 -
header (name, value) を返す。
-
headers を空の header list とする。
-
protocol headers 内の各 header について:
-
deserialized header を、header で deserialize header した結果とする。
-
deserialized header の name が field-name token production に一致しない場合、 "
invalid argument" の error code を持つ error を返す。 -
deserialized header の value が header value production に一致しない場合、 "
invalid argument" の error code を持つ error を返す。 -
deserialized header を headers に追加する。
-
-
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 の initiator type が "
fetch" または "xmlhttprequest" である場合:-
stack trace を current stack trace とする。
-
stack trace の size が 1 以上である場合、line number を stack trace[0] 内の
lineNumberfield の value とし、 column number を stack trace[0] 内のcolumnNumberfield の value とする。 そうでなければ、line number および column number を 0 とする。
そうでなければ、stack trace、column number、および line number をすべて null とする。
TODO: Chrome は parser-inserted resources について、current parser position を column number / line number として含める。
-
-
network.Initiatorproduction に一致する map を返す。columnNumberfield を、column number が null でない場合はそれに設定し、 そうでなければ省略する。lineNumberfield を、line number が null でない場合はそれに設定し、そうでなければ省略する。stackTracefield を 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 するには:
-
request id を request の request id とする。
-
url を、request の URL で URL serializer を実行した結果とする。
-
method を request の method とする。
-
body size を null とする。
-
body を request の body とする。
-
body が byte sequence である場合、body size をその sequence の length に設定する。そうでなく、body が body である場合、 body size をその body の length に設定する。
-
headers size を、request の headers list が [HTTP11] によって義務付けられるとおりに serialized されたときの bytes 単位の size とする。
注: header compression を許可する protocols については、これは network 上で送信される headers の compressed size である。
-
headers を空の list とする。
-
cookies を空の list とする。
-
request の headers list 内の各 (name, value) について:
-
name および value で serialize header した結果を headers に追加する。
-
name が "
Cookie" に対する byte-case-insensitive match である場合:-
request に含まれる、user agent の cookie store 内の各 cookie について:
注: [COOKIES] は、 store 内のどの cookies を request に含められるかについて、いくつかの baseline requirements を定義するが、user agents は追加の constraints を課してもよい。
-
cookie が与えられたものとして serialize cookie した結果を cookies に追加する。
-
-
-
-
destination を request の destination とする。
-
initiator type を request の initiator type とする。
-
timings を、request で get the fetch timings した結果とする。
-
network.RequestDataproduction に一致する map を返す。requestfield を request id に設定し、urlfield を url に設定し、methodfield を method に設定し、headersfield を headers に設定し、cookies field を cookies に設定し、headersSizefield を headers size に設定し、bodySizefield を body size に設定し、destinationfield を destination に設定し、initiatorTypefield を initiator type に設定し、timingsfield を timings に設定する。
7.5.4.16. network.ResponseContent 型
Remote end definition
および local end definition
network.ResponseContent= {size: js-uint }
network.ResponseContent 型は、network request に対する decoded response を表す。
-
network.ResponseContentproduction に一致する新しい map を返す。sizefield を response の response body info の decoded 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 するには:
-
protocol を空文字列とする。
-
response の final connection timing info が null でない場合、protocol を response の final connection timing info の ALPN negotiated protocol に設定する。
-
protocol が空文字列であるか、または "
unknown" と等しい場合:-
protocol が "
http" または "https" のいずれかと等しく、かつ response に関連付けられた HTTP Response がある場合。注: [FETCH] は、HTTP network response と response object の関係について明確ではない。
-
http version を HTTP Response の Status line の HTTP-version [HTTP11] とする。
-
http version が "
HTTP/" で始まる場合:-
version を、 5 から http version の length までの http version の code unit substring とする。
-
version が "
0.9" である場合、protocol を "http/0.9" に設定し、そうでなく version が "1.0" である場合、 protocol を "http/1.0" に設定し、そうでなく version が "1.1" である場合、protocol を "http/1.1" に設定する。
-
-
-
protocol を返す。
-
url を、response の URL で URL serializer を実行した結果とする。
-
protocol を、response が与えられたものとして get the protocol した結果に設定する。
-
status を response の status とする。
-
status text を response の status message とする。
-
response の cache state が "
local" である場合、 from cache を true とし、そうでなければ false とする。 -
headers を空の list とする。
-
mime type を、response に対する computed mime type の essence とする。
注: これは browser が実際に使用している MIME type であり、 [MIMESNIFF] 仕様の正確な algorithm に従っていない場合でも同様である。
-
response の headers list 内の各 (name, value) について:
-
name および value で serialize header した結果を headers に追加する。
-
-
bytes received を、response に関連付けられた HTTP response の一部として transmitted された bytes の総数とする。
-
headers size を、HTTP response の header fields section の一部として transmitted された bytes の数とする。
-
body size を response の response body info の encoded size とする。
-
content を、response で get the response content info した結果とする。
-
auth challenges を、 response で extract challenges した結果とする。
-
network.ResponseDataproduction に一致する map を返す。urlfield を url に設定し、protocolfield を protocol に設定し、statusfield を status に設定し、statusTextfield を status text に設定し、fromCachefield を from cache に設定し、headersfield を headers に設定し、mimeTypefield を mime type に設定し、bytesReceivedfield を bytes received に設定し、headersSizefield を headers size に設定し、bodySizefield を body size に設定し、contentfield を content に設定し、authChallengesfield を auth challenges が null でない場合はそれに設定し、そうでなければ省略する。
7.5.4.18. network.SetCookieHeader 型
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 を表す。
注: これは input の最短表現を decimal digits の string として生成する。
-
serialized を空文字列とする。
-
value を input とする。
-
value が 0 より大きい間:
-
x を value を 10 で割ったものとする。
-
most significant digits を x の integer part とする。
-
y を most significant digits に 10 を掛けたものとする。
-
least significant digit を value - y とする。
-
Assert: least significant digit は 0 から 9 までの範囲の integer (両端を含む)である。
-
codepoint を、value が U+0030 DIGIT ZERO の value + least significant digit である code point とする。
-
codepoint を serialized の先頭に付加する。
-
value を most significant digits に設定する。
-
-
serialized を返す。
-
name を、protocol cookie["
name"] で UTF-8 encode した結果とする。 -
value を、protocol cookie["
value"] で deserialize protocol bytes した結果とする。 -
header value を、name、 `
=`、および value を連結して形成される byte sequence とする。 -
protocol cookie が "
expiry" を含む場合:-
attribute を `
;Expires=` とする -
protocol cookie["
expiry"] で UTF-8 encode した結果を attribute に追加する。 -
attribute を header value に追加する。
-
-
protocol cookie が "
maxAge" を含む場合:-
attribute を `
;Max-Age=` とする -
max age string を、protocol cookie["
maxAge"] で serialize an integer した結果とする。 -
max age string で UTF-8 encode した結果を attribute に追加する。
-
attribute を header value に追加する。
-
-
protocol cookie が "
domain" を含む場合:-
attribute を `
;Domain=` とする -
protocol cookie["
domain"] で UTF-8 encode した結果を attribute に追加する。 -
attribute を header value に追加する。
-
-
protocol cookie が "
path" を含む場合:-
attribute を `
;Path=` とする -
protocol cookie["
path"] で UTF-8 encode した結果を attribute に追加する。 -
attribute を header value に追加する。
-
-
protocol cookie が "
secure" を含み、かつ protocol cookie["secure"] が true である場合:-
`
;Secure` を header value に追加する。
-
-
protocol cookie が "
httpOnly" を含み、かつ protocol cookie["httpOnly"] が true である場合:-
`
;HttpOnly` を header value に追加する。
-
-
protocol cookie が "
sameSite" を含む場合:-
attribute を `
;SameSite=` とする -
protocol cookie["
sameSite"] で UTF-8 encode した結果を attribute に追加する。 -
attribute を header value に追加する。
-
-
header value を返す。
7.5.4.19. network.UrlPattern 型
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 できる。
-
forbidden characters を、codepoints «U+0028 ((), U+0029 ()), U+002A (*), U+007B ({), U+007D (})» の set とする
-
result を空文字列とする。
-
is escaped character を false とする。
-
pattern 内の各 codepoint について:
-
is escaped character が false である場合:
-
forbidden characters が codepoint を含む場合、invalid argument の error code を持つ error を返す。
-
codepoint が U+005C (\) である場合:
-
is escaped character を true に設定する。
-
続行する。
-
-
-
codepoint を result に追加する。
-
is escaped character を false に設定する。
-
-
data result とともに success を返す。
-
has protocol を true とする。
-
has hostname を true とする。
-
has port を true とする。
-
has pathname を true とする。
-
has search を true とする。
-
pattern が
network.UrlPatternPatternproduction に一致する場合:-
pattern url を空文字列とする。
-
pattern が "
protocol" を含む場合:-
pattern["
protocol"] が空文字列である場合、invalid argument の error code を持つ error を返す。 -
protocol を、pattern["
protocol"] で unescape URL Pattern することを試みた結果とする。 -
protocol 内の各 codepoint について:
-
codepoint が ASCII alphanumeric でなく、かつ «U+002B (+), U+002D (-), U+002E (.)» が codepoint を含まない場合:
-
invalid argument の error code を持つ error を返す。
-
-
-
protocol を pattern url に追加する。
-
-
そうでなければ:
-
has protocol を false に設定する。
-
"
http" を pattern url に追加する。
-
-
scheme を、pattern url で ASCII lowercase した結果とする。
-
"
:" を pattern url に追加する。 -
scheme がspecial である場合、"
//" を pattern url に追加する。 -
pattern が "
hostname" を含む場合:-
pattern["
hostname"] が空文字列である場合、invalid argument の error code を持つ error を返す。 -
scheme が "
file" である場合、 invalid argument の error code を持つ error を返す。 -
hostname を、pattern["
hostname"] で unescape URL Pattern することを試みた結果とする。 -
inside brackets を false とする。
-
hostname 内の各 codepoint について:
-
«U+002F (/), U+003F (?), U+0023 (#)» が codepoint を含む場合:
-
invalid argument の error code を持つ error を返す。
-
-
inside brackets が false であり、かつ codepoint が U+003A (:) である場合:
-
invalid argument の error code を持つ error を返す。
-
-
codepoint が U+005B ([) である場合、inside brackets を true に設定する。
-
codepoint が U+005D (]) である場合、inside brackets を false に設定する。
-
-
hostname を pattern url に追加する。
-
-
そうでなければ:
-
scheme が "
file" でない場合、 "placeholder" を pattern url に追加する。 -
has hostname を false に設定する。
-
-
pattern が "
port" を含む場合:-
pattern["
port"] が空文字列である場合、invalid argument の error code を持つ error を返す。 -
port を、pattern["
port"] で unescape URL Pattern することを試みた結果とする。 -
"
:" を pattern url に追加する。 -
port 内の各 codepoint について:
-
codepoint が ASCII digit でない場合:
-
invalid argument の error code を持つ error を返す。
-
-
-
port を pattern url に追加する。
-
-
そうでなければ:
-
has port を false に設定する。
-
-
pattern が "
pathname" を含む場合:-
pathname を、 pattern["
pathname"] で unescape URL Pattern することを試みた結果とする。 -
pathname が U+002F (/) で始まらない場合、 "
/" を pattern url に追加する。 -
pathname 内の各 codepoint について:
-
«U+003F (?), U+0023 (#)» が codepoint を含む場合:
-
invalid argument の error code を持つ error を返す。
-
-
-
pathname を pattern url に追加する。
-
-
そうでなければ:
-
has pathname を false に設定する。
-
-
pattern が "
search" を含む場合:-
search を、 pattern["
search"] で unescape URL pattern することを試みた結果とする。 -
search が U+003F (?) で始まらない場合、 "
?" を pattern url に追加する。 -
search 内の各 codepoint について:
-
codepoint が U+0023 (#) である場合:
-
invalid argument の error code を持つ error を返す。
-
-
-
search を pattern url に追加する。
-
-
そうでなければ:
-
has search を false に設定する。
-
-
-
そうでなく、pattern が
network.UrlPatternStringproduction に一致する場合:-
pattern url を、 pattern["
pattern"] で unescape URL pattern することを試みた結果とする。
-
-
url を、pattern url をparseした結果とする。
-
url が failure である場合、invalid argument の error code を持つ error を返す。
-
parsed を、次の fields を持つ struct とする:
- protocol
- has protocol が true である場合は url の scheme、そうでなければ null。
- hostname
- has hostname が true である場合は url の host、そうでなければ null。
- port
-
-
has port が false である場合:
-
null。
-
-
そうでなければ:
-
url の scheme がspecial であり、かつ url の scheme の default port が null でなく、かつ url の port が null であるか、または scheme の default port と等しい場合:
-
空文字列。
-
-
そうでなく、url の port が null でない場合:
-
url の port で Serialize an integer する。
-
-
そうでなければ:
-
null。
-
-
-
- pathname
-
-
has pathname が false である場合:
-
null。
-
-
そうでなければ:
-
url の path が空文字列でなく、かつ 空でない場合は、 url で URL path serializer を実行した結果、 そうでなければ null。
-
-
- search
-
data parsed とともに success を返す。
-
url を、url string をparseした結果とする。
-
url pattern の protocol が null でなく、かつ url の scheme と等しくない場合、false を返す。
-
url pattern の hostname が null でなく、かつ url の host と等しくない場合、false を返す。
-
url pattern の port が null でない場合:
-
port を null とする。
-
url の scheme がspecial であり、かつ url の scheme の default port が null でなく、かつ url の port が null であるか、または scheme の default port と等しい場合:
-
port を空文字列に設定する。
-
-
そうでなく、url の port が null でない場合:
-
port を、url の port で serialize an integer した結果に設定する。
-
-
url pattern の port が port と等しくない場合、false を返す。
-
-
url pattern の pathname が null でなく、かつ url で URL path serializer を実行した結果と等しくない場合、false を返す。
-
url pattern の search が null でない場合:
-
url query を url の query とする。
-
url query が null である場合、url query を空文字列に設定する。
-
url pattern の search が url query と等しくない場合、false を返す。
-
-
true を返す。
7.5.5. コマンド
7.5.5.1. network.addDataCollector コマンド
network.addDataCollector は collector を追加する。
- コマンド型
-
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 }
-
collector id を UUID の文字列表現とする。
-
input context ids を空の set とする。
-
command parameters の
contextsfield が存在する場合、 input context ids を command parameters[contexts] で create a set したものに設定する。 -
data types を command parameters["
dataTypes"] で create a set したものとする。 -
max encoded item size を command parameters ["
maxEncodedDataSize"] とする。注:
maxEncodedDataSizeparameter は max encoded item size を表し、 指定された collector によって収集される各 request の size を制限するものであり、 collector 全体の collected size を制限するものではない。注: 実装ごとに異なる encodings を サポートする可能性があり、これは encoded size が browsers 間で異なり得ることを意味する。したがって、同じ data collector configuration であっても、一部の network data が max encoded item size に収まるのは、 一部の実装だけである場合がある。
-
collector type を command parameters ["
collectorType"] とする。 -
input user context ids を空の set とする。
-
command parameters の
userContextsfield が存在する場合、 input user context ids を command parameters[userContexts] で create a set したものに設定する。 -
input user context ids が空でなく、かつ input context ids が 空でない場合、invalid argument の error code を持つ error を返す。
-
max encoded item size が 0 であるか、または max encoded item size が max total collected size より大きい場合、 invalid argument の error code を持つ error を返す。
-
input context ids が empty でない場合:
-
navigables を、input context ids で get valid navigables by ids することを試みた結果とする。
-
navigables 内の各 navigable について:
-
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
-
-
そうでなく、input user context ids が empty でない場合:
-
input user context ids の各 user context id について:
-
user context を、user context id で get user context した結果とする。
-
user context が null である場合、no such user context の error code を持つ error を返す。
-
-
-
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 に設定される。
-
session の network collectors[collector id] を collector に設定する。
-
collectorfield が collector id に設定されたnetwork.AddDataCollectorResultproduction に一致する 新しい 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 }
-
intercept を UUID の文字列表現とする。
-
url patterns を、存在する場合は command parameters の
urlPatternsfield とし、そうでなければ空の list とする。 -
navigables を null とする。
-
command parameters の
contextsfield が存在する場合:-
navigables を空の set に設定する。
-
command parameters["
contexts"] の各 navigable id について-
navigable を、navigable id で get a navigable することを試みた結果とする。
-
navigable が top-level traversable でない場合、 invalid argument の error code を持つ error を返す。
-
navigable を navigables に追加する。
-
-
navigables が空の set である場合、 invalid argument の error code を持つ error を返す。
-
-
intercept map を session の intercept map とする。
-
parsed patterns を空の list とする。
-
url patterns 内の各 url pattern について:
-
parsed を、 url pattern で parse url pattern することを試みた結果とする。
-
Append parsed を parsed patterns に。
-
-
intercept map[intercept] を、
url patternsparsed patterns、phasescommand parameters["phases"]、およびbrowsingContextsnavigables を持つ struct に設定する。 -
interceptfield が intercept に設定されたnetwork.AddInterceptResultproduction に一致する 新しい 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
-
blocked requests を session の blocked request map とする。
-
request id を command parameters["
request"] とする。 -
blocked requests が request id をcontain しない場合、 no such request の error code を持つ error を返す。
-
(request, phase, response) を blocked requests[request id] とする。
-
phase が "
beforeRequestSent" でない場合、 invalid argument の error code を持つ error を返す。 -
command parameters が "
url" をcontains する場合:-
url record を、base URL null で、 command parameters["
url"] に URL parser を適用した結果とする。 -
url record が failure である場合、invalid argument の error code を持つ error を返す。
TODO: ここでも resume すべきか?
-
request の url を url record とする。
-
-
command parameters が "
method" をcontains する場合:-
method を command parameters["
method"] とする。 -
method が method token production に一致しない場合、 "
invalid argument" の error code を持つ error を返す。 -
request の method を method とする。
-
-
command parameters が "
headers" をcontains する場合:-
headers を空の header list とする。
-
command parameters["
headers"] 内の header について:-
deserialized header を header で deserialize header した結果とする。
-
deserialized header の name が field-name token production に一致しない場合、 "
invalid argument" の error code を持つ error を返す。 -
deserialized header の value が header value production に一致しない場合、 "
invalid argument" の error code を持つ error を返す。 -
deserialized header を headers に追加する。
-
-
request の headers list を headers に設定する。
-
-
command parameters が "
cookies" をcontains する場合:-
cookie header を空の byte sequence とする。
-
command parameters["
cookies"] 内の各 cookie について:-
cookie header が空でない場合、`
;` を cookie header に追加する。 -
cookie で serialize cookie header した結果を cookie header に追加する。
-
-
found cookie header を false とする。
-
request の headers list 内の各 header について:
-
name を header の name とする。
-
byte-lowercase name が `
cookie` である場合:-
header の value を cookie header に設定する。
-
found cookie header を true に設定する。
-
中断する。
-
-
-
found cookie header が false である場合:
-
header (`
Cookie`, cookie header) を request の headers list に追加する。
-
-
-
command parameters が "
body" をcontains する場合:-
body を command parameters["
body"] で deserialize protocol bytes した結果とする。 -
request の body を body に設定する。
-
-
"
continue request"、request id、および (null, "incomplete") で Resume する。 -
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
-
request id を command parameters["
request"] とする。 -
response を、 session、"
continueResponse"、および command parameters で update the response することを試みた結果とする。 -
"
continue request"、request id、および (response, "incomplete") で Resume する。 -
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
-
blocked requests を session の blocked request map とする。
-
request id を command parameters["
request"] とする。 -
blocked requests が request id をcontain しない場合、 no such request の error code を持つ error を返す。
-
(request, phase, response) を blocked requests[request id] とする。
-
phase が "
authRequired" でない場合、 invalid argument の error code を持つ error を返す。 -
command parameters "
action" が "cancel" である場合、 response の authentication credentials を "cancelled" に設定する。 -
command parameters "
action" が "provideCredentials" である場合:-
credentials を command parameters["
credentials"] とする。 -
Assert: credentials["
type"] は "password" である。 -
response の authentication credentials を (credentials["
username"], credentials["password"]) に設定する
-
-
"
continue request"、request id、および (response, "incomplete") で Resume する。 -
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
-
data type を command parameters 内の "
dataType" field の value とする。 -
collector id を command parameters 内の "
collector" field の value とする。 -
request id を command parameters 内の "
request" field の value とする。 -
collectors を session の network collectors とする。
-
collectors が collector id をcontain しない場合、 no such network collector の error code を持つ error を返す。
-
collected data を、request id および data type で get collected data した結果とする。
-
collected data が null である場合、 no such network data の error code を持つ error を返す。
-
collected data および collector id で Remove collector from data する。
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
-
blocked requests を session の blocked request map とする。
-
request id を command parameters["
request"] とする。 -
blocked requests が request id をcontain しない場合、 no such request の error code を持つ error を返す。
-
(request, phase, response) を blocked requests[request id] とする。
-
phase が "
authRequired" である場合、 invalid argument の error code を持つ error を返す。 -
response を新しい network error とする。
error の正確な種類を設定できるようにする [Issue #508]
-
"
continue request"、request id、および (response, "complete") で Resume する。 -
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, }
-
data type を command parameters["
dataType"] とする。 -
request id を command parameters["
request"] とする。 -
collector id を null とする。
-
command parameters が "
collector" を 含む 場合:-
collectors を session の network collectors とする。
-
collectors が collector id を 含まない 場合、 error を error code no such network collector 付きで返す。
-
collector id を command parameters["
collector"] に設定する。
-
-
disown を command parameters["
disown"] とする。 -
disown が true かつ collector id が null である場合、error を error code invalid argument 付きで返す。
-
collected data を、request id および data type が与えられた get collected data とする。
-
collected data が null である場合:
-
error を error code no such network data 付きで返す。
-
-
collected data の pending が true である場合:
-
"network data collected" および (request id, data type) で Await する。
-
-
collector id が null でなく、かつ collected data の collectors が collector id を 含まない 場合:
-
error を error code no such network data 付きで返す。
-
-
bytes を collected data の bytes とする。
-
bytes が null である場合、
-
error を error code unavailable network data 付きで返す。
-
-
body を、
network.GetDataResult生成規則に一致する map で、bytesフィールドを bytes に設定したものとする。 -
disown が true である場合、collected data および collector id で remove collector from data を実行する。
-
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
-
request id を command parameters["
request"] とする。 -
response を、 session, "
provideResponse", および command parameters で trying to update the response した結果とする。 -
command parameters が "
body" を 含む 場合:-
body を、 command parameters["
body"] で deserialize protocol bytes したものとする。
-
-
"
continue request", request id, および (response,"complete") で Resume する。 -
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
-
collector id を command parameters 内の "
collector" フィールドの値とする。 -
collectors を session の network collectors とする。
-
collectors が collector id を 含まない 場合、 error を error code no such network collector 付きで返す。
-
collector id を session の network collectors から Remove する。
-
collected network data 内の各 collected data について、collected data および collector id で remove collector from data を実行する。
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
-
intercept を command parameters 内の "
intercept" フィールドの値とする。 -
intercept map を session の intercept map とする。
-
intercept map が intercept を 含まない 場合、 error を error code no such intercept 付きで返す。
-
intercept を intercept map から Remove する。
注: intercept の削除は、この intercept によって すでにブロックされている request には影響しない。影響を受けるのは将来の request、 または既存 request の将来のフェーズのみである。
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
-
navigable を null とする。
-
request の client が environment settings object である場合:
-
environment settings を request の client とする。
-
environment settings の global object が active window である navigable が存在する場合、 navigable をその navigable の top-level traversable に設定する。
-
-
navigable が null でなく、かつ navigable cache behavior map が navigable を 含む 場合、navigable cache behavior map[navigable] を返す。
-
top-level navigable を navigable の top-level traversable とする。
-
navigable cache behavior map が top-level navigable を 含む 場合、 navigable cache behavior map[top-level navigable] を返す。
-
behavior を command parameters["
cacheBehavior"] とする。 -
command parameters が "
contexts" を 含まない 場合:-
default cache behavior を behavior に設定する。
-
behavior の値について分岐する:
- "
bypass" - 実装固有の resource cache を無効化する、実装定義の手順を実行する。
- "
default" - 現在の remote end 構成で通常有効になっている 実装固有の resource cache を有効化する、実装定義の手順を実行する。
- "
-
success をデータ null 付きで返す。
-
-
navigables を空の set とする。
-
command parameters["
contexts"] の各 navigable id について:-
context を、 navigable id で trying to get a navigable した結果とする。
-
context が top-level browsing context でない場合、 error を error code invalid argument 付きで返す。
-
context を navigables に Append する。
-
-
navigables 内の各 navigable について:
-
navigable cache behavior map が navigable を 含み、かつ navigable cache behavior map[navigable] が behavior と等しい場合、 continue する。
-
behavior の値について分岐する:
- "
bypass" - navigable が top-level browsing context である任意の browsing context から発生したネットワーク request について、実装固有の resource cache を無効化する実装定義の手順を実行する。
- "
default" - navigable が top-level browsing context である任意の browsing context から発生したネットワーク request について、現在の remote end 構成で通常有効になっている 実装固有の resource cache を有効化する、実装定義の手順を実行する。
- "
-
behavior が default cache behavior と等しい場合:
-
navigable cache behavior map が navigable を 含む 場合、 navigable cache behavior map[navigable] を remove する。
-
-
そうでなければ:
-
navigable cache behavior map[navigable] を behavior に設定する。
-
-
-
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 を request の header list とする。
-
headers 内の各 header について:
-
request headers 内で header を Set する。
注: これは、既存の値がある場合には常に それを上書きする。特に、既存の `Set-Cookie` header に cookie を追加しない。
-
-
Assert: related navigables の size は 0 または 1 である。
注: これは、複数の navigable に関連付けられた worker では機能しないことを意味する。その場合、どの順序で header を上書きするかが明確でない。
-
request および session の extra headers の default headers で Update headers する。
-
user context headers を session の extra headers の user context headers とする。
-
related navigables 内の navigable について:
-
user context を navigable の associated user context とする。
-
user context headers が user context を 含む 場合、 request および user context headers[user context] で update headers する。
-
-
navigable headers を session の extra headers の navigable headers とする。
-
related navigables 内の navigable について:
-
top-level traversable を navigable の top-level traversable とする。
-
navigable headers が top-level traversable を含む場合、 request および navigable headers[top-level traversable] で update headers する。
-
-
command parameters が "
userContexts" を 含み、 かつ command parameters が "contexts" を 含む 場合、 error を error code invalid argument 付きで返す。 -
headers を、 command parameters["
headers"] で trying to create a headers list した結果とする。 -
command parameters が "
userContexts" を 含む 場合:-
user contexts を空の list とする。
-
command parameters["
userContexts"] 内の user context id について:-
user context を user context id で get user context したものとする。
-
user context が null である場合、error を error code no such user context 付きで返す。
-
user context を user contexts に Append する。
-
-
target を session の extra headers の user context headers とする。
-
user contexts 内の user context について:
-
target[user context] を headers に設定する。
-
-
success をデータ null 付きで返す。
-
-
command parameters が "
contexts" を 含む 場合:-
navigables を、 command parameters["
contexts"] で trying to get valid top-level traversables by ids した結果とする。 -
target を session の extra headers の navigable headers とする。
-
navigables 内の navigable について:
-
target[navigable] を headers に設定する。
-
-
success をデータ null 付きで返す。
-
-
session の extra headers の default headers を headers に設定する。
-
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 }
このイベントは、ユーザーエージェントが認可資格情報の入力を求めようとしているときに 発火される。
-
redirect count を request の redirect count とする。
-
Assert: before request sent map[request] は redirect count と等しい。
注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。
-
request の client が null でない場合、related navigables を、request の client で get related navigables した結果とする。そうでなければ related navigables を空の set とする。
-
"
network.authRequired" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:-
params を、session、 "
network.authRequired"、および request で process a network event した結果とする。 -
response data を、response で get the response data した結果とする。
-
Assert: response data は "
authChallenge" を contains する。 -
params の
responseフィールドを response data に設定する。 -
Assert: params は
network.AuthRequiredParametersproduction に一致する。 -
body を、
paramsフィールドを params に設定した、network.AuthRequiredproduction に一致する map とする。 -
session および body で Emit an event する。
-
params["
isBlocked"] が true の場合:-
blocked requests を session の blocked request map とする。
-
request id を request の request id とする。
-
blocked requests[request id] を (request, "
authRequired", response) に設定する。 -
«"
continue request"» および request id で Await する。 -
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 やローカルキャッシュによって 処理される前に)送信される前に発火される。
-
settings を request の client とする。
-
related navigables を、settings で get related navigables したものとする。
-
related navigables 内の navigable について:
-
navigable の associated user context が user context である場合、true を返す。
-
-
false を返す。
-
related navigables の各 navigable について:
-
top-level traversable を navigable の top-level traversable とする。
-
user context を top-level traversable の associated user context とする。
-
active BiDi sessions 内の各 session について:
-
session の emulated network conditions の navigable network conditions が top-level traversable を contains する場合、 session の emulated network conditions の navigable network conditions[top-level traversable] を返す。
-
-
active BiDi sessions 内の各 session について:
-
session の emulated network conditions の user context network conditions が user context を contains する場合、 session の emulated network conditions の user context network conditions[user context] を返す。
-
-
active BiDi sessions 内の各 session について:
-
session の emulated network conditions の default network conditions が null でない場合、 session の emulated network conditions の default network conditions を返す。
-
-
-
null を返す。
-
navigable を、settings の relevant global object の associated
Documentの node navigable とする。 -
emulated network conditions を、 [navigable] で get emulated network conditions した結果とする。
-
emulated network conditions が null でなく、かつ emulated network conditions の offline が true の場合、true を返す。
-
false を返す。
-
set of user contexts 内の各 user context について:
-
request および user context での request originates in user context 手順が true を返す場合:
-
active BiDi sessions 内の各 session について:
注: user context は、複数の user context to accept insecure certificates override map に属することはできない。
-
session の user context to accept insecure certificates override map が user context を contains する場合:
-
accept insecure certificates を session の user context to accept insecure certificates override map[user context] とする。
-
accept insecure certificates が true の場合:
-
Assert endpoint node は、安全でない TLS 接続の受け入れをサポートする。
-
request について Basic Certificate Processing 手順を実行するとき、 ステップ a を、その他のあらゆる実装定義の証明書検証手順とともにスキップする。
-
-
そうでなければ、request について Basic Certificate Processing 手順を実行するとき、あらゆる実装定義の 証明書検証手順とともに、すべてのステップを実行する。
-
注: user context は、複数の user context to proxy configuration map に属することはできない。
-
session の user context to proxy configuration map が user context を contains する場合:
-
proxy configuration を session の user context to proxy configuration map[user context] とする。
-
request が proxy configuration により定義されるプロキシ設定を使用することを保証するために、 実装定義の手順を実行する。
注: 設定はユーザーコンテキストが作成されるときに検証されるため、 この段階では有効であると想定される。プロキシへのアクセス中に発生したエラーは、 リクエストの処理時にネットワークエラーとして報告される。
-
-
-
-
-
request で Maybe collect network request body する。
-
before request sent map が request を含まない場合、before request sent map[request] を 新しい set に設定する。
-
redirect count を request の redirect count とする。
-
before request sent map[request] に redirect count を追加する。
-
request の client が null でない場合、related navigables を、request の client で get related navigables した結果とする。そうでなければ related navigables を空の set とする。
-
response を null とする。
-
response status を "
incomplete" とする。 -
active BiDi sessions 内の各 session について:
-
session、request および related navigables で Update request headers する。
-
-
"
network.beforeRequestSent" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:-
params を、session、 "
network.beforeRequestSent"、および request で process a network event した結果とする。 -
initiator を、request で get the initiator した結果とする。
-
initiator が empty でない場合、params の
initiatorフィールド を initiator に設定する。 -
Assert: params は
network.BeforeRequestSentParametersproduction に一致する。 -
body を、
paramsフィールドを params に設定した、network.BeforeRequestSentproduction に一致する map とする。 -
session および body で Emit an event する。
-
params["
isBlocked"] が true の場合:-
blocked requests を session の blocked request map とする。
-
request id を request の request id とする。
-
blocked requests[request id] を (request, "
beforeRequestSent", null) に設定する。 -
(response, status) を、«"
continue request"» および request の request id で await したものとする。 -
status が "
complete" の場合、response status を status に設定する。 -
blocked requests[request id] を Remove する。
注: 待機中、リクエストのさらなる処理は行われない。
-
-
-
emulated network conditions を、 related navigables で get emulated network conditions した結果とする。
-
emulated network conditions が null でなく、かつ emulated network conditions の offline が true の場合、(network error, "
complete") を返す。 -
(response, response status) を返す。
7.5.6.3. network.fetchError イベント
- イベント型
-
network.FetchError= (method:"network.fetchError",params: network.FetchErrorParameters )network.FetchErrorParameters= { network.BaseParameters,errorText: text, }
このイベントは、ネットワークリクエストがエラーで終了したときに発火される。
-
before request sent map[request] が request の redirect count を含まない場合、request で WebDriver BiDi before request sent 手順を実行する。
注: これにより、呼び出し元がすべてのエラーパスで WebDriver BiDi before request sent 手順を明示的に呼び出す必要なく、
network.fetchErrorの前にnetwork.beforeRequestSentが常に発火され得ることが保証される。 -
request の client が null でない場合、related navigables を request の client で get related navigables した結果とする。そうでなければ related navigables を空の set とする。
-
request で Maybe abort network response body collection する。
-
"
network.fetchError" および related navigables が与えられたときの、 set of sessions for which an event is enabled 内の各 session について:-
params を、session、 "
network.fetchError"、および request で process a network event した結果とする。 -
params の
errorTextフィールドを、リクエストを中止させたエラーを説明する 実装定義の文字列に設定する。 -
Assert: params は
network.FetchErrorParametersproduction に一致する。 -
body を、
paramsフィールドを params に設定した、network.FetchErrorproduction に一致する map とする。 -
session および body で Emit an event する。
-
7.5.6.4. network.responseCompleted イベント
- イベント型
-
network.ResponseCompleted= (method:"network.responseCompleted",params: network.ResponseCompletedParameters )network.ResponseCompletedParameters= { network.BaseParameters,response: network.ResponseData, }
このイベントは、完全なレスポンスボディが受信された後に発火される。
-
redirect count を request の redirect count とする。
-
Assert: before request sent map[request] は redirect count を含む。
注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。
-
request の client が null でない場合、related navigables を request の client で get related navigables した結果とする。そうでなければ related navigables を空の set とする。
-
request および response で Maybe collect network response body する。
-
sessions を、"
network.responseCompleted" および related navigables が与えられたときの set of sessions for which an event is enabled とする。 -
sessions 内の各 session について:
-
params を、session、 "
network.responseCompleted"、および request で process a network event した結果とする。 -
Assert: params["
isBlocked"] は false である。 -
response data を、response で get the response data した結果とする。
-
params の
responseフィールドを response data に設定する。 -
Assert: params は
network.ResponseCompletedParametersproduction に一致する。 -
body を、
paramsフィールドを params に設定した、network.ResponseCompletedproduction に一致する map とする。 -
session および body で Emit an event する。
-
7.5.6.5. network.responseStarted イベント
- イベント型
-
network.ResponseStarted= (method:"network.responseStarted",params: network.ResponseStartedParameters )network.ResponseStartedParameters= { network.BaseParameters,response: network.ResponseData, }
このイベントは、レスポンスヘッダーが受信された後、ただし body が完了する前に発火される。
-
redirect count を request の redirect count とする。
-
Assert: before request sent map[request] は redirect count と等しい。
注: これは、すべての呼び出し元が、これらの手順の前に WebDriver BiDi before request sent 手順が request で呼び出されることを保証する必要があることを意味する。
-
request の client が null でない場合、related navigables を request の client で get related navigables した結果とする。そうでなければ related navigables を空の set とする。
-
response status を "
incomplete" とする。 -
sessions を、"
network.responseStarted" および related navigables が与えられたときの set of sessions for which an event is enabled とする。 -
sessions 内の各 session について:
-
params を、session、 "
network.responseStarted"、および request で process a network event した結果とする。 -
response data を、response で get the response data した結果とする。
-
params の
responseフィールドを response data に設定する。 -
Assert: params は
network.ResponseStartedParametersproduction に一致する。 -
body を、
paramsフィールドを params に設定した、network.ResponseStartedproduction に一致する map とする。 -
session および body で Emit an event する。
-
params["
isBlocked"] が true の場合:-
blocked requests を session の blocked request map とする。
-
request id を request の request id とする。
-
blocked requests[request id] を (request, "
beforeRequestSent", response) に設定する。 -
(response, status) を、 «"
continue request"» および request id で await したものとする。 -
status が "
complete" の場合、response status を status に設定する。 -
blocked requests[request id] を Remove する。
-
-
-
(response, response status) を返す。
7.6. script モジュール
script モジュールは、script レルムおよび実行に関連するコマンドとイベントを含む。
7.6.1. 定義
ScriptCommand = (
script.AddPreloadScript //
script.CallFunction //
script.Disown //
script.Evaluate //
script.GetRealms //
script.RemovePreloadScript
)
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 session は preload 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] 例外が報告され、他のプリロードスクリプトは通常どおり実行される。
-
document を environment settings の relevant global object の associated
Documentとする。 -
navigable を document の navigable とする。
-
user context を navigable の associated user context とする。
-
user context id を user context の user context id とする。
-
active BiDi sessions 内の各 session について:
-
session の preload script map の values 内の各 preload script について:
-
preload script の
user contextsの size が 0 でない場合: -
preload script の
contextsが null でない場合:-
navigable id を navigable の top-level traversable の id とする。
-
preload script の
contextsが navigable id を contain しない場合、 continue する。
-
-
preload script の
sandboxが null でない場合、 realm を preload script のsandboxおよび navigable で get or create a sandbox realm したものとする。そうでなければ realm を environment settings の realm execution context の Realm component とする。 -
exception reporting global を environment settings の realm execution context の Realm component の global object とする。
-
arguments を preload script の
argumentsとする。 -
deserialized arguments を空の list とする。
-
arguments 内の各 argument について:
-
channel を、session、realm および argument で create a channel したものとする。
-
channel を deserialized arguments に追加する。
-
-
base URL を environment settings の API base URL とする。
-
options を default script fetch options とする。
-
function declaration を preload script の
function declarationとする。 -
function body evaluation status を、 function declaration、 environment settings、base URL、および options で evaluate function body した結果とする。
-
function body evaluation status が abrupt completion の場合、 function body evaluation status.[[Value]] により与えられる例外を exception reporting global に対して report an exception する。
-
function object を function body evaluation status.[[Value]] とする。
-
IsCallable(function object) が
falseである場合:-
error を realm 内の新しい TypeError オブジェクトとする。
-
error を exception reporting global に対して Report an exception する。
-
-
environment settings で Prepare to run script する。
-
evaluation status を Call(function object, null, deserialized arguments) に設定する。
-
environment settings で Clean up after running script する。
-
evaluation status が abrupt 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 型
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 を表す。
session、realm および protocol value が与えられたときに create a channel するには:
-
channel properties を protocol value["
value"] とする。 -
steps を、引数 message が与えられたときの次の手順とする:
-
current realm を current Realm Record とする。
-
session、current realm、channel properties および message で Emit a script message する。
-
-
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.ExceptionDetailsrealm: 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 例外を表す。
realm、completion record record、ownership type および session が与えられたときに get exception details するには:
-
Assert: record.[[Type]] は
throwである。 -
text を、record により表されるエラーの実装定義のテキスト記述とする。
TODO: ここでの要件を厳密化する。おそらく人々は regex など同じくらい悪い手段で このデータを解析しようとする。
-
serialization options を、各フィールドを既定値に設定した
script.SerializationOptionsproduction に一致する map とする。 -
exception を、 record.[[Value]]、serialization options、ownership type、 serialization internal map としての新しい map、realm および session で serialize as a remote value した結果とする。
-
stack trace を、record が与えられたときの stack trace for an exception とする。
-
stack trace の size が 1 以上の場合、line number を stack trace[0] 内の
lineNumberフィールドの値とし、 column number を stack trace[0] 内のcolumnNumberフィールドの値とする。そうでなければ line number および column number を 0 とする。 -
exception details を、
textフィールドを text に、exceptionフィールドを exception に、lineNumberフィールドを line number に、columnNumberフィールドを column number に、stackTraceフィールドを stack trace に設定した、script.ExceptionDetailsproduction に一致する map とする。 -
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 型
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 list、realm および session が与えられたときに deserialize key-value list するには:
-
deserialized key-value list を新しい list とする。
-
serialized key-value list 内の各 serialized key-value について:
-
serialized key-value の size が 2 でない場合、 error を error code invalid argument で返す。
-
serialized key を serialized key-value[0] とする。
-
serialized key が
stringである場合、 deserialized key を serialized key とする。 -
そうでなければ deserialized key を、 serialized key、realm および session で deserialize local value することを trying した結果とする。
-
serialized value を serialized key-value[1] とする。
-
deserialized value を、serialized value、realm および session が与えられたときに deserialize local value することを trying した結果とする。
-
CreateArrayFromList(«deserialized key, deserialized value») を deserialized key-value list に追加する。
-
-
success をデータ deserialized key-value list で返す。
serialized value list、realm および session が与えられたときに deserialize value list するには:
-
deserialized values を新しい list とする。
-
serialized value list 内の各 serialized value について:
-
deserialized value を、serialized value、realm および session が与えられたときに deserialize local value することを trying した結果とする。
-
deserialized value を deserialized values に追加する;
-
-
success をデータ deserialized values で返す。
local protocol value、realm および session が与えられたときに deserialize local value するには:
-
local protocol value が script.RemoteReference production に一致する場合、 local protocol value、realm および session が与えられたときの deserialize remote reference を返す。
-
local protocol value が script.PrimitiveProtocolValue production に一致する場合、 local protocol value で deserialize primitive protocol value したものを返す。
-
local protocol value が
script.ChannelValueproduction に一致する場合、 session、realm および local protocol value で create a channel したものを返す。 -
type を local protocol value の
typeフィールドの値、または そのようなフィールドがない場合は undefined とする。 -
value を local protocol value の
valueフィールドの値、または そのようなフィールドがない場合は undefined とする。 -
以下の条件と関連する手順のリストにおいて、関連する条件が true となる最初の手順集合を実行する:
- type が文字列 "
array" である -
-
deserialized value list を、 value、realm および session が与えられたときに deserialize value list することを trying した結果とする。
-
success をデータ CreateArrayFromList(deserialized value list) で返す。
-
- type が文字列 "
date" である -
-
value が Date Time String Format に一致しない場合、 error を error code invalid argument で返す。
-
Assert: date result は abrupt completion ではない。
-
success をデータ date result で返す。
-
- type が文字列 "
map" である -
-
deserialized key-value list を、 value、realm および session で deserialize key-value list することを trying した結果とする。
-
iterable を CreateArrayFromList(deserialized key-value list) とする
-
- type が文字列 "
object" である -
-
deserialized key-value list を、 value、realm および session で deserialize key-value list することを trying した結果とする。
-
iterable を CreateArrayFromList(deserialized key-value list) とする
-
success をデータ Object.fromEntries(iterable) で返す。
-
- type が文字列 "
regexp" である -
-
pattern を local protocol value の
patternフィールドの値とする。 -
flags を local protocol value の
flagsフィールドの値、または そのようなフィールドがない場合は undefined とする。 -
regex_result を Regexp(pattern, flags) とする。これが例外を投げた場合、error を error code invalid argument で返す。
-
success をデータ regex_result で返す。
-
- type が文字列 "
set" である -
-
deserialized value list を、 value、realm および session が与えられたときに deserialize value list することを trying した結果とする。
-
iterable を CreateArrayFromList(deserialized key-value list) とする
-
success をデータ Set object(iterable) で返す。
-
- otherwise
- error を error code invalid argument で返す。
- type が文字列 "
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、または該当する場合には、任意の navigable の navigable id から導出できてはならない。
注: これは、ユーザーが異なる id 間の 実装固有の関係に依存しないようにするためである。
-
realm id が null である場合、success をデータ null で返す。
-
realm であって id が realm id であるものが存在しない場合、 error を error code no such frame で返す
-
success をデータ realm で返す
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 するには:
-
remote value を undefined とする。
-
以下の条件と関連する手順のリストにおいて、該当するものがある場合、 関連する条件が true となる最初の手順集合を実行する:
- Type(value) が undefined である
- remote value を、
local end 定義内のscript.UndefinedValueproduction に一致する map とする。 - Type(value) が Null である
- remote value を、
local end 定義内のscript.NullValueproduction に一致する map とする。 - Type(value) が String である
-
remote value を、
local end 定義内のscript.StringValueproduction に一致し、valueproperty が value に設定された map とする。 - Type(value) が Number である
-
-
value の値について switch する:
- NaN
- serialized を
"NaN"とする - -0
- serialized を
"-0"とする - Infinity
- serialized を
"Infinity"とする - -Infinity
- serialized を
"-Infinity"とする - Otherwise:
- serialized を value とする
-
remote value を、
local end 定義内のscript.NumberValueproduction に一致し、valueproperty が serialized に設定された map とする。
-
- Type(value) が Boolean である
- remote value を、
local end 定義内のscript.BooleanValueproduction に一致し、valueproperty が value に設定された map とする。 - Type(value) が BigInt である
- remote value を、
local end 定義内のscript.BigIntValueproduction に一致し、valueproperty が value に対して ToString operation を実行した結果に設定された map とする。
-
remote value を返す
primitive protocol value が与えられたときに deserialize primitive protocol value するには:
-
type を primitive protocol value の
typeフィールドの値とする。 -
value を undefined とする。
-
primitive protocol value がフィールド
valueを持つ場合:-
value を primitive protocol value の
valueフィールドの値とする。
-
-
以下の条件と関連する手順のリストにおいて、関連する条件が true となる最初の手順集合を実行する:
- type が文字列 "
undefined" である - success をデータ undefined で返す。
- type が文字列 "
null" である - success をデータ null で返す。
- type が文字列 "
string" である - success をデータ value で返す。
- type が文字列 "
number" である -
-
Assert: Type(value) は String である。
-
value が文字列 "
NaN" である場合、success を データ NaN で返す。 -
number_result を StringToNumber(value) とする。
-
number_result が NaN である場合、error を error code invalid argument で返す
-
success をデータ number_result で返す。
- type が文字列 "
boolean" である - success をデータ value で返す。
- type が文字列 "
bigint" である -
-
bigint_result を StringToBigInt(value) とする。
-
bigint_result が undefined である場合、error を error code invalid argument で返す
-
success をデータ bigint_result で返す。
-
- type が文字列 "
-
error を error code invalid argument で返す
7.6.3.11. script.RealmInfo 型
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 のプロパティを表す。
-
global object を realm の global object とする。
-
global object を unwrapped global object とする。
-
global object が
Windowobject でない場合、nullを返す。 -
document を global object の wrapped
Windowの associatedDocumentとする。 -
document の node navigable を返す。
-
Assert: global object は
WorkerGlobalScopeobject である。 -
owners を空の list とする。
-
global object の associated owner set 内の各 owner について:
-
owner environment settings を owner の relevant settings object とする。
-
owner realm info を、 owner environment settings が与えられたときに get the realm info した結果とする。
-
owner realm info が null である場合、continue する。
-
owner realm info["
id"] を owners に追加する。
-
-
owners を返す。
-
realm を environment settings の realm execution context の Realm component とする。
-
realm id を realm の realm id とする。
-
origin を、environment settings の origin が与えられたときの serialization of an origin とする。
-
global object を environment settings により指定される global object とする
-
最初に一致する条件の下の手順を実行する:
- global object が
Windowobject である -
-
document を environment settings の relevant global object の associated
Documentとする。 -
navigable を document の node navigable とする。
-
navigable が null である場合、null を返す。
-
navigable id を navigable の navigable id とする。
-
user context id を、 navigable の associated user context の user context id とする
-
realm info を、
realmフィールドを realm id に、originフィールドを origin に、contextフィールドを navigable id に、そしてuserContextフィールドを user context id に設定した、script.WindowRealmInfoproduction に一致する map とする。
-
- global object が
SandboxWindowProxyobject である -
TODO: sandboxes の処理について、これが正しい定式化かは不明である。
-
document を global object の wrapped
Windowの associatedDocumentとする。 -
navigable を document の node navigable とする。
-
navigable が null である場合、null を返す。
-
navigable id を navigable の navigable id とする。
-
user context id を、 navigable の associated user context の user context id とする
-
sandbox name を、 realm が与えられたときに get a sandbox name した結果とする。
-
Assert: sandbox name は null ではない。
-
realm info を、
realmフィールドを realm id に、originフィールドを origin に、contextフィールドを navigable id に、userContextフィールドを user context id に、そしてsandboxフィールドを sandbox name に設定した、script.WindowRealmInfoproduction に一致する map とする。
-
- global object が
DedicatedWorkerGlobalScopeobject である -
-
owners を、global object が与えられたときに get the worker’s owners した結果とする。
-
Assert: owners は正確に 1 個の item を持つ。
-
realm info を、
realmフィールドを realm id に、originフィールドを origin に、そしてownersフィールドを owners に設定した、script.DedicatedWorkerRealmInfoproduction に一致する map とする。
-
- global object が
SharedWorkerGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.SharedWorkerRealmInfoproduction に一致する map とする。
-
- global object が
ServiceWorkerGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.ServiceWorkerRealmInfoproduction に一致する map とする。
-
- global object が
WorkerGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.WorkerRealmInfoproduction に一致する map とする。
-
- global object が
PaintWorkletGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.PaintWorkletRealmInfoproduction に一致する map とする。
-
- global object が
AudioWorkletGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.AudioWorkletRealmInfoproduction に一致する map とする。
-
- global object が
WorkletGlobalScopeobject である -
-
realm info を、
realmフィールドを realm id に、そしてoriginフィールドを origin に設定した、script.WorkletRealmInfoproduction に一致する map とする。
-
- Otherwise:
-
-
realm info を null とする。
-
- global object が
-
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 型
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 が
handle と
sharedId の両方を持つ場合、このアルゴリズムは handle を無視し、
sharedId のみを尊重する。
-
Assert remote reference は
script.RemoteReferenceproduction に一致する。 -
remote reference が
script.SharedReferenceproduction に一致する場合、 remote reference, realm および session で deserialize shared reference した結果を返す。 -
remote reference および realm で deserialize remote object reference した結果を返す。
-
handle id を remote object reference の
handleフィールドの値とする。 -
handle map を realm の handle object map とする
-
handle map が handle id を含まない場合、error を error code no such handle で返す。
-
success をデータ handle map[handle id] で返す。
-
Assert shared reference は
script.SharedReferenceproduction に一致する。 -
navigable を、realm で get the navigable した結果とする。
-
navigable が
nullである場合、error を error code no such node で返す。注: これは、realm が Window global でない場合に発生する。
-
shared id を shared reference の
sharedIdフィールドの値とする。 -
node を、session, navigable および shared id で get a node することを trying した結果とする。
-
node が
nullである場合、error を error code no such node で返す。 -
environment settings を、その realm execution context の Realm component が realm である environment settings object とする。
-
node の node document の origin が、environment settings の origin と same origin domain でない場合、 error を error code no such node で返す。
注: これは、WebDriver-BiDi が、 そうでなければ script access を許可しない realms 間で objects を渡すために 使用できないことを保証する。
-
realm global object を realm の global object とする。
-
realm global object が
SandboxWindowProxyobject である場合、 node を、realm 内で node を wrapping するSandboxProxyに設定する。 -
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 }
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 に対して提供される。
Node
も script.RemoteValue
instance により表される。これらは value プロパティに node の部分的な serialization を持つ。
mirror objects の lifecycle を再検討する。
注: mirror object は runtime 内で元の object を 生存させ続けない。object が runtime 内で破棄された場合、その後に protocol を介してそれへアクセスしようとすると error になる。
-
ownership type が "
none" と等しい場合、nullを返す。 -
handle id を、object のための新しい一意な文字列 handle とする。
-
handle map を realm の handle object map とする
-
handle map[handle id] を object に設定する。
-
結果として handle id を返す。
-
node を unwrapped node とする。
-
node が
Nodeを実装しない場合、 null を返す。 -
navigable を node の node navigable とする。
-
navigable が null の場合、null を返す。
-
session, navigable および node で get or create a node reference した結果を返す。
-
serialization internal map が object を含まない場合、 serialization internal map[object] を remote value に設定する。
-
そうでなければ、次の手順を実行する:
-
previously serialized remote value を serialization internal map[object] とする。
-
previously serialized remote value が
internalIdフィールドを持たない場合、次の手順を実行する:-
internal id を、真にランダム、または疑似ランダムな数に基づく UUID の文字列表現とする。
-
previously serialized remote value の
internalIdフィールドを internal id に設定する。
-
-
remote value の
internalIdフィールドを、 previously serialized remote value 内のinternalIdフィールドに設定する。
-
value, serialization options, ownership type, serialization internal map, realm および session が与えられたときに remote value として serialize する には:
-
remote value を、value が与えられたものとして serialize primitive protocol value した結果とする。
-
remote value が undefined でない場合、remote value を返す。
-
handle id を、realm, ownership type および value で handle for an object した結果とする。
-
ownership type を "
none" に設定する。 -
known object を、value が serialization internal map にある場合は
true、そうでなければfalseとする。 -
次の条件と対応する手順の一覧において、関連する条件が真である最初の手順群を実行する:
- Type(value) is Symbol
- remote value を、
local end definition内のscript.SymbolRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - IsArray(value)
- remote value を、
session,
script.ArrayRemoteValue, handle id, known object, value, serialization options, ownership type, serialization internal map, realm, および session で serialize an Array-like した結果とする。 - IsRegExp(value)
-
-
serialized を、
local end definition内のscript.RegExpValueproduction に一致する map とし、patternproperty を pattern に、flagsproperty を flags に設定する。 -
remote value を、
local end definition内のscript.RegExpRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略し、valueproperty を serialized に設定する。
- value has a [[DateValue]] internal slot.
-
-
serialized を Call(Date.prototype.toISOString, value) に設定する。
-
Assert: serialized は throw completion でない。
-
remote value を、
local end definition内のscript.DateRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略し、 value を serialized に設定する。
-
- value has a [[MapData]] internal slot
-
-
remote value を、
local end definition内のscript.MapRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、 そうでなければ省略する。 -
serialization internal map, remote value および value で Set internal ids if needed する。
-
serialized を null とする。
-
known object が
falseで、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:-
serialized を、 CreateMapIterator(value, key+value), serialization options, ownership type, serialization internal map, realm, および session で serialize as a mapping した結果とする。
-
-
serialized が null でない場合、remote value の
valueフィールドを serialized に設定する。
-
- value has a [[SetData]] internal slot
-
-
remote value を、
local end definition内のscript.SetRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、 そうでなければ省略する。 -
serialization internal map, remote value および value で Set internal ids if needed する。
-
serialized を null とする。
-
known object が
falseで、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:-
serialized を、 CreateSetIterator(value, value), serialization options, ownership type, serialization internal map, realm, および session で serialize as a list した結果とする。
-
-
serialized が null でない場合、remote value の
valueフィールドを serialized に設定する。
-
- value has a [[WeakMapData]] internal slot
- remote value を、
local end definition内のscript.WeakMapRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has a [[WeakSetData]] internal slot
- remote value を、
local end definition内のscript.WeakSetRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has a [[GeneratorState]] internal slot or [[AsyncGeneratorState]] internal slot
- remote value を、
local end definition内のscript.GeneratorRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has an [[ErrorData]] internal slot
- remote value を、
local end definition内のscript.ErrorRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has a [[ProxyHandler]] internal slot and a [[ProxyTarget]] internal slot
- remote value を、
local end definition内のscript.ProxyRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - IsPromise(value)
- remote value を、
local end definition内のscript.PromiseRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has a [[TypedArrayName]] internal slot
- remote value を、
local end definition内のscript.TypedArrayRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - value has an [[ArrayBufferData]] internal slot
- remote value を、
local end definition内のscript.ArrayBufferRemoteValueproduction に一致する map とし、handleproperty は 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, および session で serialize 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, および session で serialize an Array-like した結果とする。 - value is a platform object that implements
Node -
-
shared id を、value および session で get shared id for a node した結果とする。
-
remote value を、
local end definition内のscript.NodeRemoteValueproduction に一致する map とし、sharedIdproperty は shared id が null でない場合はそれに設定し、そうでなければ省略し、handleproperty は handle id が null でない場合はそれに設定し、 そうでなければ省略する。 -
serialization internal map, remote value および value で Set internal ids if needed する。
-
serialized を null とする。
-
known object が
falseの場合、次の手順を実行する:-
serialized を map とする。
-
serialized["
nodeType"] を Get(value, "nodeType") に設定する。 -
node value を Get(value, "nodeValue") に設定する。
-
node value が null でない場合、 serialized["
nodeValue"] を node value に設定する。 -
serialized["
childNodeCount"] を child node count に設定する。 -
serialization options["
maxDomDepth"] が 0 と等しい場合、または value がShadowRootを実装し、 かつ serialization options["includeShadowTree"] が "none" である場合、または serialization options["includeShadowTree"] が "open" で、かつ value の mode が "closed" である場合、children を null とする。そうでなければ、children を空の list とし、 value の children 内の node child ごとに:
-
child serialization options を serialization options の clone とする。
-
child serialization options["
maxDomDepth"] が null でない場合、child serialization options["maxDomDepth"] を child serialization options["maxDomDepth"] - 1 に設定する。 -
serialized を、child, child serialization options, ownership type, serialization internal map, realm, および session で serialize as a remote value した結果とする。
-
serialized を children に append する。
-
-
children が null でない場合、 serialized["
children"] を children に設定する。 -
value が
Elementを実装する場合:-
attributes を新しい map とする。
-
value の attribute list 内の各 attribute について:
-
name を attribute の qualified name とする
-
value を attribute の value とする。
-
attributes[name] を value に設定する
-
-
serialized["
attributes"] を attributes に設定する。 -
shadow root を value の shadow root とする。
-
shadow root が null の場合、serialized shadow を null とする。 そうでなければ、次の下位手順を実行する:
-
serialized shadow を、 shadow root, serialization options, ownership type, serialization internal map, realm, および session で serialize as a remote value した結果とする。
-
-
serialized["
shadowRoot"] を serialized shadow に設定する。
-
-
value が
ShadowRootを実装する場合、 serialized["mode"] を value の mode に設定する。
-
-
serialized が null でない場合、remote value の
valueフィールドを serialized に設定する。
-
- value is a platform object that implements
WindowProxy -
-
window を value の [[WindowProxy]] internal slot の値とする。
-
navigable を window の navigable とする。
-
navigable id を navigable の navigable id とする。
-
serialized を、
local end definition内のscript.WindowProxyPropertiesproduction に一致する map とし、contextproperty を navigable id に設定する。 -
remote value を、
local end definition内のscript.WindowProxyRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略し、valueproperty を serialized に設定する。
-
- value is a platform object
- 1. remote value を、
local end definition内のscript.ObjectRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - IsCallable(value)
- remote value を、
local end definition内のscript.FunctionRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 - Otherwise:
-
-
remote value を、
local end definition内のscript.ObjectRemoteValueproduction に一致する map とし、handleproperty は handle id が null でない場合はそれに設定し、そうでなければ省略する。 -
serialization internal map, remote value および value で Set internal ids if needed する。
-
serialized を null とする。
-
known object が
falseで、かつ serialization options["maxObjectDepth"] が 0 でない場合、次の手順を実行する:-
serialized を、 EnumerableOwnPropertyNames(value, key+value), serialization options, ownership type, serialization internal map, realm, および session で serialize as a mapping した結果とする。
-
-
serialized が null でない場合、remote value の
valueフィールドを serialized に設定する。
-
remote value を返す
children
と child nodes は別物である。childNodeCount は
childNodes を参照するか、または childrenCount に名前を変更するべきである。
-
remote value を production に一致する map とし、
handleproperty は handle id が null でない場合はそれに設定し、そうでなければ 省略する。 -
serialization internal map, remote value および value で Set internal ids if needed する。
-
known object が
falseで、かつ serialization options["maxObjectDepth"] が 0 でない場合:-
serialized を、 CreateArrayIterator(value, value), serialization options, ownership type, serialization internal map, realm, および session で serialize as a list した結果とする。
-
serialized が null でない場合、remote value の
valueフィールドを serialized に設定する。
-
-
remote value を返す
-
serialization options["
maxObjectDepth"] が null でない場合、 assert: serialization options["maxObjectDepth"] は 0 より大きい。 -
serialized を新しい list とする。
-
IteratorToList(GetIterator(iterable, sync)) 内の各 child value について:
-
child serialization options を serialization options の clone とする。
-
child serialization options["
maxObjectDepth"] が null でない場合、child serialization options["maxObjectDepth"] を child serialization options["maxObjectDepth"] - 1 に設定する。 -
serialized child を、 child value, child serialization options, ownership type, serialization internal map, realm, および session で serialize as a remote value した結果とする。
-
serialized child を serialized に append する。
-
-
serialized を返す
iterable, serialization options, ownership type, serialization internal map, realm, および session が与えられたときに mapping として serialize する には:
-
serialization options["
maxObjectDepth"] が null でない場合、 assert: serialization options["maxObjectDepth"] は 0 より大きい。 -
serialized を新しい list とする。
-
IteratorToList(GetIterator(iterable, sync)) 内の item について:
-
Assert: IsArray(item)
-
property を CreateListFromArrayLike(item) とする
-
Assert: property は size 2 の list である
-
key を property[0] とし、value を property[1] とする
-
child serialization options を serialization options の clone とする。
-
child serialization options["
maxObjectDepth"] が null でない場合、child serialization options["maxObjectDepth"] を child serialization options["maxObjectDepth"] - 1 に設定する。 -
Type(key) が String である場合、serialized key を child key とし、 そうでなければ serialized key を、 child key, child serialization options, ownership type, serialization internal map, realm, および session で serialize as a remote value した結果とする。
-
serialized value を、 value, child serialization options, ownership type, serialization internal map, realm, および session で serialize as a remote value した結果とする。
-
serialized child を («serialized key, serialized value») とする。
-
serialized child を serialized に append する。
-
-
serialized を返す
7.6.3.15. script.ResultOwnership 型
script.ResultOwnership="root"/"none"
script.ResultOwnership は、serialized value
ownership がどのように扱われるかを指定する。
7.6.3.16. script.SerializationOptions 型
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 definition
と local end definition
script.SharedId = text;
script.SharedId 型は、任意の realm(Sandbox Realms を含む)で
使用可能な DOM Node
への参照を表す。
7.6.3.18. script.StackFrame 型
Remote end definition
と local 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、
および実行されたコードの行番号と列番号を表す
lineNumber と columnNumber properties を持つ。
7.6.3.19. script.StackTrace 型
Remote end definition
と local 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 を 構築する には:
-
call frames を新しい list とする。
-
stack 内の各 stack frame frame について、 最も最近実行された frame から開始して、次の手順を実行する:
-
url を、frame の script url の URL が与えられたものとして、 URL serializer を実行した結果とする。
-
frame info を、
script.StackFrameproduction に一致する新しい map とし、urlfield を url に、functionNamefield を frame の function に、lineNumberfield を frame の line number に、columnNumberfield を frame の column number に設定する。
-
-
frame info を call frames に append する。
-
stack trace を、
script.StackTraceproduction に一致する新しい map とし、callFramesproperty を call frames に設定する。 -
stack trace を返す。
current stack trace は、running execution context の callstack を表す stack frames の list が与えられたものとして construct a stack trace した結果である。
exception、または type throw の Completion Record である
exception を伴う exception の stack
trace は、次により与えられる:
-
exception が exception として throw された value である場合、record を exception を throw するために作成された Completion Record とする。 そうでなければ、record を exception とする。
-
stack を、record が作成された時点での実行に対応する stack frames の list とする。
-
stack が与えられたものとして construct a stack trace した結果を返す。
7.6.3.20. script.Source 型
script.Source= {realm: script.Realm, ?context: browsingContext.BrowsingContext, ?userContext: browser.UserContext }
script.Source 型は、script 関連の event が発生した
script.Realm と、省略可能な browsingContext.BrowsingContext および関連する
browser.UserContext を表す。
-
realm を、source realm の realm id とする。
-
environment settings を、 realm execution context の Realm component が source realm である environment settings object とする。
-
environment settings が associated
Documentを持つ場合:-
document を environment settings の associated
Documentとする。 -
navigable を document の node navigable とする。
-
navigable が null でない場合、navigable id を navigable の navigable id とする。
-
user context id を、 navigable の associated user context の user context id とする。
そうでなければ、navigable を null とする。
-
-
source を、
script.Sourceproduction に一致する map とし、realmfield を realm に、contextfield を navigable が null でない場合は navigable id に設定し、そうでなければ unset し、userContextfield を |navigable が null でない場合は user context id に設定し、そうでなければ unset する。 -
source を返す。
7.6.3.21. script.Target 型
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 を、navigable id で get a navigable することを trying した結果とする。
-
sandbox が null または空文字列の場合:
-
document を navigable の active document とする。
-
environment settings を、 relevant global object の associated
Documentが document である environment settings object とする。 -
realm を environment settings の realm execution context の Realm component とする。
-
-
そうでなければ: realm を、 sandbox および navigable が与えられたものとして get or create a sandbox realm することを trying した結果とする。
-
data realm とともに success を返す
-
target が
script.ContextTargetproduction に一致する場合:-
sandbox を null とする。
-
target が "
sandbox" を contains する場合、 sandbox を target["sandbox"] に設定する。 -
realm を、 target["
context"] および sandbox で get a realm from a navigable した結果とする。
-
-
そうでなければ:
-
Assert: target は
script.RealmTargetproduction に一致する。 -
realm id を、target の
realmfield の値とする。 -
realm を、realm id が与えられたものとして get a realm した結果とする。
-
-
data realm とともに success を返す
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 }
-
command parameters が "
userContexts" を contains し、 かつ command parameters が "contexts" を contains する場合、 invalid argument error code とともに error を返す。 -
function declaration を、command parameters の
functionDeclarationfield とする。 -
arguments を、存在する場合は command parameters の
argumentsfield、そうでなければ空の list とする。 -
user contexts を set とする。
-
navigables を null とする。
-
command parameters の
contextsfield が存在する場合:-
navigables を空の set に設定する。
-
command parameters["
contexts"] の各 navigable id について-
navigable を、navigable id で get a navigable することを trying した結果とする。
-
navigable が top-level traversable でない場合、 invalid argument error code とともに error を返す。
-
navigable を navigables に append する。
-
-
-
そうでなければ、command parameters が
userContextsを contains する場合:-
user contexts を、command parameters["
userContexts"] で create a set した結果に設定する。 -
user contexts の各 user context id について:
-
user context を、user context id で get user context した結果に設定する。
-
user context が null の場合、no such user context error code とともに error を返す。
-
-
-
sandbox を、存在する場合は command parameters 内の "
sandbox" field の値、そうでなければ null とする。 -
script を UUID の文字列表現とする。
-
preload script map を session の preload script map とする。
-
preload script map[script] を、
function declarationfunction declaration,argumentsarguments,contextsnavigables,sandboxsandbox, およびuser contextsuser contexts を持つ struct に設定する。 -
scriptfield が 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
-
realm を、command parameters の
targetfield の値が与えられたものとして get a realm from a target することを trying した結果とする。 -
handles を command parameters の
handlesfield の値とする。 -
handles の各 handle id について:
-
handle map を realm の handle object map とする
-
handle map が handle id を含む場合、 handle id を handle map から remove する。
-
-
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 および session で arguments を deserialize する には:
-
deserialized arguments list を空の list とする。
-
serialized arguments list の各 serialized argument について:
-
deserialized argument を、 serialized argument, realm および session が与えられたものとして deserialize local value することを trying した結果とする。
-
deserialized argument を deserialized arguments list に append する。
-
-
data deserialized arguments list とともに success を返す。
注: function declaration は parentheses で囲まれて evaluate される。
-
bypassDisabledScripting を true とする。
-
parenthesized function declaration を «"
(", function declaration, ")"» を concatenate した結果とする -
function script を、 parenthesized function declaration, environment settings, base URL, options および bypassDisabledScripting で create a classic script した結果とする。
-
environment settings で Prepare to run script する。
-
function body evaluation status を ScriptEvaluation(function script の record) とする。
-
environment settings で Clean up after running script する。
-
function body evaluation status を返す。
session および command parameters を伴う remote end steps は次のとおりである:
-
realm を、command parameters の
targetfield の値が与えられたものとして get a realm from a target することを trying した結果とする。 -
realm id を realm の realm id とする。
-
environment settings を、 realm execution context の Realm component が realm である environment settings object とする。
-
command arguments を、command parameters の
argumentsfield の値とする。 -
deserialized arguments を空の list とする。
-
command arguments が null でない場合、deserialized arguments を、 realm, command arguments および session が与えられたものとして deserialize arguments することを trying した結果に設定する。
-
this parameter を、command parameters の
thisfield の値とする。 -
this object を null とする。
-
this parameter が null でない場合、this object を、 this parameter, realm および session が与えられたものとして deserialize local value することを trying した結果に設定する。
-
function declaration を、 command parameters の
functionDeclarationfield の値とする。 -
await promise を、 command parameters の
awaitPromisefield の値とする。 -
serialization options を、存在する場合は command parameters の
serializationOptionsfield の値、 そうでなければ fields が default values に設定されたscript.SerializationOptionsproduction に一致する map とする。 -
result ownership を、存在する場合は command parameters の
resultOwnershipfield の値、そうでなければnoneとする。 -
base URL を environment settings の API base URL とする。
-
options を default script fetch options とする。
-
function body evaluation status を、 function declaration, environment settings, base URL, および options で evaluate function body した結果とする。
-
function body evaluation status.[[Type]] が
throwの場合:-
exception details を、 realm, function body evaluation status, result ownership および session が与えられたものとして get exception details した結果とする。
-
exceptionDetailsfield が exception details に設定されたscript.EvaluateResultExceptionproduction に一致する新しい map を返す。
-
-
function object を function body evaluation status.[[Value]] とする。
-
IsCallable(function object) が
falseの場合:-
invalid argument error code とともに error を返す
-
-
command parameters["
userActivation"] が true の場合、 activation notification steps を実行する。 -
environment settings で Prepare to run script する。
-
evaluation status を Call(function object, this object, deserialized arguments) に設定する。
-
evaluation status.[[Type]] が
normalであり、かつ await promise がtrueであり、かつ IsPromise(evaluation status.[[Value]]) である場合:-
evaluation status を Await(evaluation status.[[Value]]) に設定する。
-
-
environment settings で Clean up after running script する。
-
evaluation status.[[Type]] が
throwの場合:-
exception details を、 realm, evaluation status, result ownership および session が与えられたものとして get exception details した結果とする。
-
exceptionDetailsfield が exception details に設定されたscript.EvaluateResultExceptionproduction に一致する新しい map を返す。
-
-
Assert: evaluation status.[[Type]] は
normalである。 -
result を、 evaluation status.[[Value]], serialization options, result ownership, serialization internal map としての新しい map, realm および session で serialize as a remote value した結果とする。
-
realmfield が realm id に設定され、resultfield が result に設定された、script.EvaluateResultSuccessproduction に一致する新しい 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 は次のとおりである:
-
realm を、command parameters の
targetfield の値が与えられたものとして get a realm from a target することを trying した結果とする。 -
realm id を realm の realm id とする。
-
environment settings を、 realm execution context の Realm component が realm である environment settings object とする。
-
source を command parameters の
expressionfield の値とする。 -
await promise を command parameters の
awaitPromisefield の値とする。 -
serialization options を、存在する場合は command parameters の
serializationOptionsfield の値、 そうでなければ fields が default values に設定されたscript.SerializationOptionsproduction に一致する map とする。 -
result ownership を、存在する場合は command parameters の
resultOwnershipfield の値、そうでなければnoneとする。 -
options を default script fetch options とする。
-
base URL を environment settings の API base URL とする。
-
bypassDisabledScripting を true とする。
-
script を、source, environment settings, base URL, options および bypassDisabledScripting で create a classic script した結果とする。
-
command parameters["
userActivation"] が true の場合、 activation notification steps を実行する。 -
environment settings で Prepare to run script する。
-
evaluation status を ScriptEvaluation(script の record) に設定する。
-
evaluation status.[[Type]] が
normalであり、await promise が true であり、かつ IsPromise(evaluation status.[[Value]]) である場合:-
evaluation status を Await(evaluation status.[[Value]]) に設定する。
-
-
environment settings で Clean up after running script する。
-
evaluation status.[[Type]] が
throwの場合:-
exception details を、 realm, evaluation status, result ownership および session で get exception details した結果とする。
-
realmfield が realm id に設定され、exceptionDetailsfield が exception details に設定されたscript.EvaluateResultExceptionproduction に一致する新しい map を返す。
-
-
Assert: evaluation status.[[Type]] は
normalである。 -
result を、 evaluation status.[[Value]], serialization options, result ownership, serialization internal map としての新しい map, realm および session で serialize as a remote value した結果とする。
-
realmfield が realm id に設定され、resultfield が result に設定された、script.EvaluateResultSuccessproduction に一致する新しい map を返す。
7.6.4.5. script.getRealms コマンド
script.getRealms コマンドは、すべての realms の list を返す。 省略可能で、特定の型の realms、または navigable の active document に関連付けられた realm に絞り込むことができる。
- コマンド型
-
script.GetRealms= (method:"script.getRealms",params: script.GetRealmsParameters )script.GetRealmsParameters= { ?context: browsingContext.BrowsingContext, ?type: script.RealmType, } - 返却型
-
script.GetRealmsResult= {realms: [*script.RealmInfo] }
-
environment settings を、 execution ready flag が設定されている すべての environment settings objects の list とする。
-
command parameters が
contextを含む場合:-
navigable を、 command parameters["
context"] で get a navigable することを trying した結果とする。 -
document を navigable の active document とする。
-
navigable environment settings を list とする。
-
environment settings の各 settings について:
-
次の条件のいずれかが成り立つ場合:
-
settings の relevant global object の associated
Documentが document である -
settings により指定される global object が、 その owner set に document を持つ
WorkerGlobalScopeである
settings を navigable environment settings に append する。
-
-
-
environment settings を navigable environment settings に設定する。
-
-
realms を list とする。
-
environment settings の各 settings について:
-
realm info を、settings が与えられたものとして get the realm info した結果とする。
-
command parameters が
typeを含み、かつ realm info["type"] が command parameters["type"] と等しくない場合、continue する。 -
realm info が null でない場合、realm info を realms に append する。
-
-
body を、
realmsfield が realms に設定されたscript.GetRealmsResultproduction に一致する map とする。 -
data body とともに success を返す。
これを拡張して、 nested workers などの realm parents も許可するか? またはすべての ancestor workers を取得するか。
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
-
script を、command parameters 内の "
script" field の値とする。 -
preload script map を session の preload script map とする。
-
preload script map が script を contain しない場合、 no such script error code とともに error を返す。
-
script を preload script map から Remove する。
-
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, }
-
environment settings を、 realm execution context の Realm component が realm である environment settings object とする。
-
related navigables を、environment settings が与えられたものとして get related navigables した結果とする。
-
session, "
script.message" および related navigables が与えられたときに event is enabled である場合:-
channel properties が "
serializationOptions" を contains する場合、serialization options を channel properties のserializationOptionsfield の値とする。 そうでなければ、serialization options を fields が default values に設定されたscript.SerializationOptionsproduction に一致する map とする。 -
channel properties が "
ownership" を contains する場合、 ownership type を channel properties["ownership"] とする。 そうでなければ、 ownership type を "none" とする。 -
data を、message, serialization options, ownership type, serialization internal map としての新しい map および realm が与えられたものとして serialize as a remote value した結果とする。
-
source を、realm で get the source した結果とする。
-
params を、
script.MessageParametersproduction に一致する map とし、channelfield を channel properties["channel"] に、datafield を data に、sourcefield を source に設定する。 -
body を、
paramsfield が params に設定されたscript.Messageproduction に一致する map とする。 -
session および body で Emit an event する。
-
7.6.5.2. script.realmCreated イベント
- イベント型
-
script.RealmCreated= (method:"script.realmCreated",params: script.RealmInfo )
set up a window environment settings object, set up a worker environment settings object または set up a worklet environment settings object algorithms のいずれかが呼び出されたとき、settings object を返す直前に:
-
environment settings を、新しく作成された environment settings object とする。
-
realm info を、environment settings が与えられたものとして get the realm info した結果とする。
-
realm info が null の場合、戻る。
-
related navigables を、environment settings が与えられたものとして get related navigables した結果とする。
-
body を、
paramsfield が realm info に設定されたscript.RealmCreatedproduction に一致する map とする。 -
"
script.realmCreated" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
session, navigables および include global が与えられたときの、 subscribe priority 2 を伴う remote end subscribe steps は次のとおりである:
-
environment settings を、 execution ready flag が設定されている すべての environment settings objects の list とする。
-
environment settings の各 settings について:
-
related navigables を新しい set とする。
-
settings の relevant global object の associated
Documentが Document である場合:-
navigable を settings の relevant global object の associated
Documentの node navigable とする。 -
navigable が null の場合、continue する。
-
top-level traversible を navigable の top-level traversable とする。
-
top-level traversible が navigables 内にない場合、continue する。
-
top-level traversible を related navigables に append する。
そうでなければ、include global が false の場合、continue する。
-
-
realm info を、settings が与えられたものとして get the realm info した結果とする。
-
realm info が null の場合、continue する。
-
body を、
paramsfield が realm info に設定されたscript.RealmCreatedproduction に一致する map とする。 -
session, "
script.realmCreated" および related navigables が与えられたときに event is enabled である場合:-
session および body で Emit an event する。
-
-
7.6.5.3. script.realmDestroyed イベント
- イベント型
-
script.RealmDestroyed= (method:"script.realmDestroyed",params: script.RealmDestroyedParameters )script.RealmDestroyedParameters= {realm: script.Realm }
-
related navigables を空の set とする。
-
document の navigable を related navigables に append する。
-
document の worklet global scopes 内の各 worklet global scope について:
-
realm を worklet global scope の relevant Realm とする。
-
realm id を realm の realm id とする。
-
params を、
realmfield が realm id に設定されたscript.RealmDestroyedParametersproduction に一致する map とする。 -
body を、
paramsfield が params に設定されたscript.RealmDestroyedproduction に一致する map とする。 -
"
script.realmDestroyed" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
-
-
environment settings を、 relevant global object の associated
Documentが document である environment settings object とする。 -
realm を environment settings の realm execution context の Realm component とする。
-
realm id を realm の realm id とする。
-
params を、
realmfield が realm id に設定されたscript.RealmDestroyedParametersproduction に一致する map とする。 -
body を、
paramsfield が params に設定されたscript.RealmDestroyedproduction に一致する map とする。 -
"
script.realmDestroyed" および related navigables が与えられた set of sessions for which an event is enabled 内の各 session について:-
session および body で Emit an event する。
-
worker event loop event loop が、 worker がその lifecycle の終端に到達したため、または terminate a worker algorithm により早期に破棄されたために破棄されるたびに:
-
environment settings を、 event loop が responsible event loop である environment settings object とする。
-
related navigables を、environment settings が与えられたものとして get related navigables した結果とする。
-
realm を environment settings の environment settings object’s Realm とする。
-
realm id を realm の realm id とする。
-
params を、
realmfield が realm id に設定されたscript.RealmDestroyedParametersproduction に一致する map とする。 -
body を、
paramsfield が params に設定されたscript.RealmDestroyedproduction に一致する map とする。
7.7. storage モジュール
storage モジュールは、storage に関連する機能および events を含む。
storage partition は、user agent が cookies や local storage などの永続データを 整理できる namespace である。
storage partition key は、storage partition を一意に識別する map である。
7.7.1. 定義
StorageCommand = (
storage.DeleteCookies //
storage.GetCookies //
storage.SetCookie
)
StorageResult = (
storage.DeleteCookiesResult /
storage.GetCookiesResult /
storage.SetCookieResult
)
7.7.2. 型
7.7.2.1. storage.PartitionKey 型
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 values の map を持つ。 各 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 attributes の list を持つ。 各 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 を共有してはならない。
-
deserialized filter を空の map とする。
-
filter 内の各 name → value について:
-
deserialized name を、 table for cookie conversion 内の JSON key name に対応する field name とする。
-
name が "
value" の場合、deserialized value を value で deserialize protocol bytes した結果に設定し、 そうでなければ deserialized value を value とする。 -
deserialized filter[deserialized name] を deserialized value に Set する。
-
-
deserialized filter を返す。
-
partition spec が null の場合:
-
partition spec を空の map に設定する。
-
-
そうでなければ、partition spec["
type"] が "context" である場合:-
navigable を、partition spec["
context"] が与えられたものとして get a navigable することを trying した結果とする。 -
partition key を、navigable の associated storage partition の key とする。
-
data partition key とともに success を返す。
-
-
partition key を空の map とする。
-
default values for storage partition key attributes 内の各 name → default value について:
-
value を、存在する場合は partition spec[name]、 そうでなければ default value とする。
-
partition key[name] を value に Set する。
-
-
remote end の required partition key attributes 内の 各 name について:
-
partition spec[name] が exists する場合:
-
partition key][name] を partition spec[name] に Set する。
-
-
そうでなければ:
-
underspecified storage partition error code とともに error を返す。
-
-
-
data partition key とともに success を返す。
-
storage partition key が現存する storage partition を一意に識別する場合:
-
store を、その storage partition の cookie store とする。
-
data store とともに success を返す。
-
-
no such storage partition error code とともに error を返す。
-
filter 内の各 name → value について:
-
stored cookie[name] が value と等しくない場合:
-
false を返す。
-
-
-
true を返す。
-
cookies を新しい list とする。
-
deserialized filter を、filter で deserialize filter した結果に設定する。
-
cookie store 内の各 stored cookie について:
-
stored cookie および deserialized filter で match cookie した結果が true の場合:
-
stored cookie を cookies に append する。
-
-
-
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, }
-
filter を、存在する場合は command parameters の
filterfield の値、存在しない場合は空の map とする。 -
partition spec を、存在する場合は command parameters の
partitionfield の値、存在しない場合は null とする。 -
partition key を、partition spec で expand a storage partition spec することを trying した結果とする。
-
store を、 partition key で get the cookie store することを trying した結果とする。
-
cookies を、store および filter で get matching cookies した結果とする。
-
serialized cookies を新しい list とする。
-
cookies 内の各 cookie について:
-
serialized cookie を、cookie が与えられたものとして serialize cookie した結果とする。
-
serialized cookie を serialized cookies に append する。
-
-
body を、
cookiesfield が serialized cookies に、partitionKeyfield が partition key に設定されたstorage.GetCookiesResultproduction に一致する map とする。 -
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 }
-
cookie spec を command parameters の
cookiefield の値とする。 -
partition spec を、存在する場合は command parameters の
partitionfield の値、存在しない場合は null とする。 -
partition key を、partition spec で expand a storage partition spec することを trying した結果とする。
-
store を、partition key で get the cookie store することを trying した結果とする。
-
deserialized value を、 cookie spec["
value"] で deserialize protocol bytes した結果とする。 -
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 を返す。
-
body を、
partitionKeyfield が partition key に設定されたstorage.SetCookieResultproduction に一致する map とする。 -
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 }
-
filter を、存在する場合は command parameters の
filterfield の値、存在しない場合は空の map とする。 -
partition spec を、存在する場合は command parameters の
partitionfield の値、存在しない場合は null とする。 -
partition key を、partition spec で expand a storage partition spec することを trying した結果とする。
-
store を、partition key で get the cookie store することを trying した結果とする。
-
cookies を、store および filter で get matching cookies した結果とする。
-
cookies 内の各 cookie について:
-
cookie を store から削除する。
-
-
body を、
partitionKeyfield が partition key に設定されたstorage.DeleteCookiesResultproduction に一致する map とする。 -
data body とともに success を返す。
7.8. log モジュール
log モジュールは、logging に関連する機能および events を含む。
BiDi Session は log 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 する には:
-
buffer を session の log event buffer とする。
-
navigable ids を新しい list とする。
-
navigables の各 navigable について:
-
navigable の navigable id を navigable ids に append する。
-
-
navigable ids 内の各 navigable id について:
-
other navigables を空の list とする。
-
navigable ids 内の各 other id について:
-
other id が navigable id と等しくない場合、other id を other navigables に append する。
-
buffer が navigable id を含まない場合、 buffer[navigable id] を新しい list とする。
-
(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. 定義
LogEvent = (
log.EntryAdded
)
7.8.2. 型
7.8.2.1. log.LogEntry
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 を定義する:
-
active BiDi sessions 内の各 session について:
-
method が "
error" または "assert" である場合、 level を "error" とする。method が "debug" または "trace" である場合、 level を "debug" とする。method が "warn" である場合、 level を "warn" とする。そうでなければ level を "info" とする。 -
timestamp を、UTC における現在の日付と時刻を表す time value とする。
-
text を空文字列とする。
-
Type(args[0]) が String であり、かつ args[0] が formatting specifier を含む場合、formatted args を Formatter(args) とする。そうでなければ formatted args を args とする。
注: formatter operation は console specification で十分に定義されておらず、 formatting は実装間で一貫しない場合がある。
-
formatted args 内の各 arg について:
-
arg が args 内の first entry でない場合、 U+0020 SPACE を text に append する。
-
arg が primitive ECMAScript value である場合、 ToString(arg) を text に append する。そうでなければ implementation-defined string を text に append する。
-
-
realm を current Realm Record の realm id とする。
-
serialized args を新しい list とする。
-
serialization options を、fields が default values に設定された
script.SerializationOptionsproduction に一致する map とする。 -
args の各 arg について:
-
serialized arg を、 value としての arg、serialization options, ownership type としての
none、serialization internal map としての新しい map, realm および session で serialize as a remote value した結果とする。 -
serialized arg を serialized args に追加する。
-
-
source を、current Realm Record が与えられたものとして get the source した結果とする。
-
stack を current stack trace とする。
-
entry を
log.ConsoleLogEntryproduction に一致する map とし、levelfield を level に、textfield を text に、timestampfield を timestamp に、stackTracefield を stack に、method field を method に、sourcefield を source に、 そしてargsfield を serialized args に設定する。 -
body を、
paramsfield が entry に設定されたlog.EntryAddedproduction に一致する map とする。 -
settings を current settings object とする。
-
related navigables を、settings が与えられたものとして get related navigables した結果とする。
-
session, "
log.entryAdded" および related navigables を伴って event is enabled である場合、session および body で emit an event する。そうでなければ、session, related browsing contexts, および body で buffer a log event する。
-
script, line number, column number, message および handled を arguments とする、次の error reporting steps を定義する:
-
handled が true である場合、戻る。
-
settings を script の settings object とする。
-
timestamp を、UTC における現在の日付と時刻を表す time value とする。
-
stack を、報告されている error に対応する exception を伴う stack trace for an exception とする。
-
source を、current Realm Record が与えられたものとして get the source した結果とする。
-
entry を、
levelが "error" に、textが message に、sourceが source に、timestampが timestamp に、そしてstackTracefield が stack に設定されたlog.JavascriptLogEntryproduction に一致する map とする。 -
body を、
paramsfield が entry に設定されたlog.EntryAddedproduction に一致する map とする。 -
related navigables を、settings が与えられたものとして get related navigables した結果とする。
-
active BiDi sessions 内の各 session について:
-
session, "
log.entryAdded" および related navigables を伴って event is enabled である場合、session および body で emit an event する。そうでなければ、session, related browsing contexts, および body で buffer 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 に加えて存在する。
session, navigables および include global が与えられたときの、 subscribe priority 10 を伴う remote end subscribe steps は次のとおりである:
-
session の log event buffer 内の各 navigable id → events について:
-
maybe context を、navigable id が与えられたものとして getting a navigable した結果とする。
-
maybe context が error である場合、 navigable id を log event buffer から削除して continue する。
-
navigable を maybe context の data とする。
-
top level navigable を navigable の top-level traversable とする。
-
include global が true であり、かつ top level navigable が navigables 内にない場合、 または include global が false であり、かつ top level navigable が navigables 内にある場合:
-
events 内の各 (event, other navigables) について:
-
session および event で Emit an event する。
-
other navigables 内の各 other context id について:
-
log event buffer が other context id を含む場合、event を log event buffer[other context id] から削除する。
-
-
-
-
7.9. input モジュール
input モジュールは、シミュレートされたユーザー入力のための機能を含む。
7.9.1. 定義
InputCommand = (
input.PerformActions //
input.ReleaseActions //
input.SetFiles
)
InputResult = (
input.PerformActionsResult /
input.ReleaseActionsResult /
input.SetFilesResult
)
InputEvent = (
input.FileDialogOpened
)
7.9.2. 型
7.9.2.1. input.ElementOrigin
input.ElementOrigin 型は、座標 origin として使用される Element
を表す。
input.ElementOrigin= {type:"element",element: script.SharedReference }
input.ElementOrigin steps は次のとおりである:
-
object が
input.ElementOriginproduction に一致する map である場合、true を返す。 -
false を返す。
input.ElementOrigin から
Element を取得する
steps は:
-
origin および navigable が与えられたものとして、次の steps を返す:
-
Assert: origin は
input.ElementOriginに一致する。 -
document を navigable の active document とする。
-
reference を origin["
element"] とする。 -
environment settings を、 relevant global object の associated
Documentが document である environment settings object とする。 -
realm を environment settings の realm execution context の Realm component とする。
-
element を、reference, realm, および session で deserialize remote reference することを trying した結果とする。
-
element が
Elementを実装していない場合、no such element error code とともに error を返す。 -
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.PauseActioninput.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 は次のとおりである:
-
navigable id を command parameters の
contextfield の値とする。 -
navigable を、navigable id で get a navigable することを trying した結果とする。
-
input state を、session および navigable の top-level traversable で get the input state した結果とする。
-
actions options を、is element origin steps が is input.ElementOrigin に設定され、かつ get element origin steps が session が与えられたものとして get Element from input.ElementOrigin steps した結果に設定された、新しい actions options とする。
-
actions by tick を、input state, command parameters, および actions options で extract an action sequence することを trying した結果とする。
-
input state, actions by tick, navigable, および actions options で Try to dispatch actions する。
-
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 は次のとおりである:
-
navigable id を command parameters の
contextfield の値とする。 -
navigable を、navigable id で get a navigable することを trying した結果とする。
-
top-level traversable を navigable の top-level traversable とする。
-
input state を、session および top-level traversable で get the input state した結果とする。
-
actions options を、is element origin steps が is input.ElementOrigin に設定され、かつ get element origin steps が session が与えられたものとして get Element from input.ElementOrigin steps した結果に設定された、新しい actions options とする。
-
undo actions を、逆順の input state の input cancel list とする。
-
undo actions, 0, navigable, および actions options で Try to dispatch tick actions する。
-
session および top-level traversable で Reset the input state する。
-
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 は次のとおりである:
-
navigable id を command parameters["
context"] field の値とする。 -
navigable を、 navigable id で get a navigable することを trying した結果とする。
-
document を navigable の active document とする。
-
environment settings を、 relevant global object の associated
Documentが document である environment settings object とする。 -
realm を environment settings の realm execution context の Realm component とする。
-
element を、 command parameters["
element"], realm, および session で deserialize remote reference することを trying した結果とする。 -
element が
Elementを実装していない場合、 no such element error code とともに error を返す。 -
element が
HTMLInputElementを実装していない、 element のtypeが File Upload state にない、または element が disabled である場合、 unable to set file input error code とともに error を返す。 -
files の size が 1 より大きく、かつ element の
multipleattribute が設定されていない場合、unable to set file input error code とともに error を返す。 -
files を command parameters["
files"] field の値とする。 -
selected files を element の selected files とする。
-
files と selected files の intersection の size が selected files の size と等しく、かつ files の size と等しい場合、element が与えられたものとして user interaction task source 上で queue an element task し、
bubblesattribute が true に初期化された、element に対するcancelという名前の event を fire する。注: ブラウザーにおける cancellation は通常、 file selection の変更により決定される。言い換えれば、変更がない場合、"cancel" event が送信される。
-
そうでなければ、files を user の selection として element に対して update the file selection する。
-
何らかの理由により、remote end が element の selected files を files で与えられた paths を持つ files に設定できない場合、 unsupported operation error code とともに error を返す。
注: 例えば remote ends は、 filesystem 上に現在存在しない files に selected files を設定できない場合がある。
-
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 である。
注: 他の user prompt handlers とは異なり、既定の behavior は file dialog が opened されることを許可することである。
-
navigable を、element の node document の navigable とする。
-
navigable id を navigable の navigable id とする。
-
user context id を、navigable の associated user context の user context id とする。
-
multiple を
falseとする。 -
element が null でなく、かつ element の
multipleattribute が設定されている場合、 multiple をtrueに設定する。 -
file picker options が null でなく、かつ file picker options の multiple が true である場合、 multiple を
trueに設定する。 -
related navigables を、navigable を含む set とする。
-
"
input.fileDialogOpened" および related navigables が与えられたときの set of sessions for which an event is enabled 内の各 session について:-
params を、
contextfield が navigable id に、userContextfield が user context id に、かつmultiplefield が multiple に設定されたinput.FileDialogInfoproduction に一致する map とする。 -
element が null でない場合:
-
shared id を、element および session で get shared id for a node した結果とする。
-
params["
element"] を shared id に設定する。
-
-
body を、
paramsfield が params に設定されたinput.fileDialogOpenedproduction に一致する map とする。 -
session および body で Emit an event する。
-
-
dismissed を false とする。
-
active BiDi sessions 内の各 session について:
-
user prompt handler を session の user prompt handler とする。
-
user prompt handler が null でない場合:
-
Assert user prompt handler は map である。
-
user prompt handler が "
file" を contains する場合:-
user prompt handler["
file"] が "ignore" と等しくない場合、dismissed を true に設定する。
-
-
そうでなく、user prompt handler が "
default" を contains し、かつ user prompt handler["default"] が "ignore" と等しくない場合、dismissed を true に設定する。
-
-
dismissed を返す。
7.10. webExtension モジュール
webExtension モジュールは、web extensions の管理およびそれらとの interaction のための機能を含む。
7.10.1. 定義
WebExtensionCommand = (
webExtension.Install //
webExtension.Uninstall
)
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 }
-
zip compression algorithm を使用して bytes を decode する implementation-defined steps を実行する。 TODO: zip decoding のより良い reference を見つける。
-
直前の step が失敗した場合(例えば bytes が有効な zip-compressed data を表していなかったため)、error code invalid web extension とともに error を返す。そうでなければ entry を、展開された filesystem entries を含む directory entry とする。
-
entry を返す。
-
type を extension data spec["
type"] とする。 -
type を使用した web extension の install がサポートされていない場合、 unsupported operation error code とともに error を返す。
-
次の conditions と関連 steps の list において、関連する condition が true である最初の steps の set を実行する:
- type が文字列 "
path" である -
-
path を extension data spec["
path"] とする。 -
locator を、file system の root に対応する root と、path である path を持つ directory locator とする。
-
entry を、locator が与えられたものとして locate an entry した結果とする。
-
- type が文字列 "
archivePath" である -
-
archive path を extension data spec["
path"] とする。 -
locator を、file system の root に対応する root と、archive path である path を持つ file locator とする。
-
archive entry を、locator が与えられたものとして locate an entry した結果とする。
-
archive entry が null である場合、null を返す。
-
bytes を archive entry の binary data とする。
-
entry を、bytes が与えられたものとして extract a zip archive することを trying した結果とする。
-
- type が文字列 "
base64" である -
-
bytes を extension data spec["
value"] を forgiving-base64 decode した結果とする。 -
bytes が failure である場合、null を返す。
-
entry を、bytes が与えられたものとして extract a zip archive することを trying した結果とする。
-
- type が文字列 "
-
entry を返す。
-
web extensions の install がサポートされていない場合、error code unsupported operation とともに error を返す。
-
extension data spec を command parameters["
extensionData"] とする。 -
extension directory entry を、extension data spec で expand a web extension data spec することを trying した結果とする。
-
extension directory entry が null である場合、invalid web extension error code とともに error を返す。
-
extension directory entry から web extension を install する implementation-defined steps を実行する。 これが失敗した場合、invalid web extension error code とともに error を返す。 そうでなければ extension id を、新たに install された web extension の unique identifier とする。
-
result を、
extensionfield が extension id に設定されたwebExtension.InstallResultproduction に一致する map とする。 -
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
-
extension を command parameters["
extension"] とする。 -
remote end が extension と等しい id を持つ web extension を持たない場合、no such web extension error code とともに error を返す。
-
remote end から web extension を削除する implementation-defined steps を実行する。これが失敗した場合、unknown error error code とともに error を返す。
-
data null とともに success を返す。
8. 他の仕様へのパッチ
この仕様は、必要な integration points を提供するため、外部仕様へのいくつかの変更を必要とする。 これらの patches は standards process の一部として他の仕様へ commit されるものと想定される。
8.1. HTML
report an error algorithm は、末尾に追加の step を加えて変更される:
-
外部仕様で定義された任意の error reporting steps を、script, line, col, message, および error が handled であれば true、そうでなければ false とともに呼び出す。
8.2. Console
他の仕様は console steps を定義できる。
-
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 を挿入する:
-
device pixel ratio overrides が window の navigable を contains する場合、device pixel ratio overrides[window の navigable] を返す。
9. 付録
この節は非規範的である。
9.1. 外部仕様
注: この list は網羅的ではなく、最新でない可能性がある。
次の外部仕様は、追加の WebDriver BiDi modules を定義する: