@@ -7524,8 +7524,9 @@ TODO: Extend this to scripts in other kinds of realms.
75247524A [=BiDi session=] has a <dfn>preload script map</dfn> which is a [=/map=] in
75257525which the keys are [[!RFC9562|UUID]] s, and the values are [=structs=] with an <a
75267526for=struct> item</a> named <code> function declaration</code> , which is a string,
7527- <code> arguments</code> , <code> contexts</code> , which is a list or null, and an item named <code> sandbox</code> which is a string
7528- or null.
7527+ <code> arguments</code> , <code> contexts</code> , which is a list or null,
7528+ an item named <code> sandbox</code> , which is a string or null,
7529+ and an item named <code> applyToOpeningContexts</code> , which is a boolean.
75297530
75307531Note: If executing a [=preload script=] fails, either due to a syntax error, or
75317532a runtime exception, an [[ECMAScript]] exception is reported in the realm in
@@ -7546,9 +7547,19 @@ To <dfn export>run WebDriver BiDi preload scripts</dfn> given |environment setti
75467547
75477548 1. If |preload script|'s <code> contexts</code> is not null:
75487549
7549- 1. Let |navigable id| be |navigable|’s [=navigable/top-level traversable=] 's id .
7550+ 1. Let |is script run allowed| be false .
75507551
7551- 1. If |preload script|'s <code> contexts</code> does not [=list/contains|contain=] |navigable id|, continue.
7552+ 1. While |navigable| is not null:
7553+
7554+ 1. Let |navigable id| be |navigable|’s [=navigable/top-level traversable=] 's id.
7555+
7556+ 1. If |preload script|'s <code> contexts</code> [=list/contains=] |navigable id|,
7557+ set |is script run allowed| to true and break.
7558+
7559+ 1. If |preload script|'s <code> applyToOpeningContexts</code> is true,
7560+ set |navigable| to |navigable|'s [=original opener=] . Otherwise, break.
7561+
7562+ 1. If |is script run allowed| is false, continue;
75527563
75537564 1. If |preload script|'s <code> sandbox</code> is not null, let |realm| be [=get
75547565 or create a sandbox realm=] with |preload script|'s <code> sandbox</code> and
@@ -9479,6 +9490,7 @@ script=].
94799490 functionDeclaration: text,
94809491 ? arguments: [*script.ChannelValue] ,
94819492 ? contexts: [+browsingContext.BrowsingContext] ,
9493+ ? applyToOpeningContexts: bool .default false,
94829494 ? sandbox: text
94839495 }
94849496 </pre>
@@ -9519,14 +9531,18 @@ The [=remote end steps=] given |session| and |command parameters| are:
951995311. Let |sandbox| be the value of the "<code> sandbox</code> " field in |command
95209532 parameters|, if present, or null otherwise.
95219533
9534+ 1. Let |applyToOpeningContexts| be true if |command parameters|["<code>applyToOpeningContexts</code>"]
9535+ is true, and false otherwise.
9536+
952295371. Let |script| be the string representation of a [[!RFC9562|UUID]] .
95239538
952495391. Let |preload script map| be |session|'s [=preload script map=] .
95259540
952695411. Set |preload script map|[|script|] to a struct with <code> function
95279542 declaration</code> |function declaration|, <code> arguments</code>
95289543 |arguments|, <code> contexts</code>
9529- |navigables|, and <code> sandbox</code> |sandbox|.
9544+ |navigables|, <code> sandbox</code> |sandbox|, and
9545+ <code> applyToOpeningContexts</code> |applyToOpeningContexts|.
95309546
953195471. Return a new [=/map=] matching the <code> script.AddPreloadScriptResult</code> with the
95329548 <code> script</code> field set to |script|.
0 commit comments