Skip to content

Commit 9e144c9

Browse files
committed
Introduce the concept of an associated session
An intermediary node needs to route commands to an upstream node rather than acting upon them directly. A later PR will include the mechanism for doing this, but for now track the session that's been opened upstream and ensure that it will be closed properly at the end of the session.
1 parent 9f04177 commit 9e144c9

File tree

1 file changed

+48
-12
lines changed

1 file changed

+48
-12
lines changed

webdriver-spec.html

+48-12
Original file line numberDiff line numberDiff line change
@@ -2423,6 +2423,14 @@ <h2>Sessions</h2>
24232423
or implicitly when <a>Close Window</a> is called
24242424
at the last remaining <a>top-level browsing context</a>.
24252425

2426+
<p>An <a>intermediary node</a> will maintain an <dfn>associated
2427+
session</dfn> for each active <a>session</a>. This is
2428+
the <a>session</a> on the <a>upstream</a> neighbor that is created
2429+
when the <a>intermediary node</a> executes the <a>New
2430+
Session</a> <a>command</a>. Closing a <a>session</a> on
2431+
an <a>intermediary node</a> will also <a>close the session</a> of
2432+
the <a>associated session</a>.
2433+
24262434
<p>All <a>commands</a>, except <a>New Session</a> and <a>Status</a>,
24272435
have an associated <dfn>current session</dfn>,
24282436
which is the <a>session</a> in which that <a>command</a> will run.
@@ -2496,15 +2504,34 @@ <h2>Sessions</h2>
24962504
a <a>remote end</a> must take the following steps:
24972505

24982506
<ol>
2499-
<li><p>Set the <a>webdriver-active flag</a> to false.
2507+
<li><p>Perform the folowing substeps based on the <a>remote end</a>'s
2508+
type:
2509+
<dl class=switch>
2510+
<dt><a>Remote end</a> is an <a>endpoint node</a>
2511+
<dd>
2512+
<ol>
2513+
<li><p>Set the <a>webdriver-active flag</a> to false.
25002514

2501-
<li><p><a>Close</a> any <a>top-level browsing contexts</a>
2502-
associated with the <a>session</a>,
2503-
without <a>prompting to unload</a>.
2515+
<li><p>An <a>endpoint node</a> must <a>close</a> any <a>top-level
2516+
browsing contexts</a> associated with the <a>session</a>,
2517+
without <a>prompting to unload</a>.
2518+
</ol>
2519+
<dt><a>Remote end</a> is an <a>intermediary node</a>
2520+
<dd>
2521+
<ol>
2522+
<li><p><a>Close</a> the <a>associated session</a>. If this causes
2523+
an <a>error</a> to occur, complete the remainder of this
2524+
algorithm before returning the <a>error</a>.
2525+
</ol>
2526+
</dl>
25042527

25052528
<li><p>Remove the <a>current session</a> from <a>active sessions</a>.
25062529

25072530
<li><p>Perform any implementation-specific cleanup steps.
2531+
2532+
<li><p>If an <a>error</a> has occurred in any of the steps above,
2533+
return the <a>error</a>, otherwise return <a>success</a> with
2534+
data <a><code>null</code></a>.
25082535
</ol>
25092536

25102537
<p>Closing a <a>session</a> might cause the associated browser process to be killed.
@@ -2565,12 +2592,21 @@ <h3>New Session</h3>
25652592
<p>The <a>remote end steps</a> are:
25662593

25672594
<ol>
2568-
<li><p>If the <a>remote end</a> is an <a>intermediary node</a>,
2569-
take implementation-defined steps that either result in
2570-
returning an <a>error</a> with <a>error code</a> <a>session not created</a>,
2571-
or in returning a <a>success</a> with data
2572-
that is isomorphic to that returned by <a>remote ends</a>
2573-
according to the rest of this algorithm.
2595+
<li><p>If the <a>remote end</a> is an <a>intermediary node</a>, take
2596+
implementation-defined steps that either result in returning
2597+
an <a>error</a> with <a>error code</a> <a>session not created</a>,
2598+
or in returning a <a>success</a> with data that is isomorphic to
2599+
that returned by <a>remote ends</a> according to the rest of this
2600+
algorithm. If an <a>error</a> is not returned, the <a>intermediary
2601+
node</a> must retain a reference to the <a>session</a> created on
2602+
the <a>upstream</a> node as the <a>associated session</a> such that
2603+
commands may be forwarded to this <a>associated session</a> on
2604+
subsequent commands.
2605+
2606+
<p class=note>How this is done is entirely up to the implementation,
2607+
but typically the <code>sessionId</code>, and <a>URL</a> and
2608+
<a>URL prefix</a> of the <a>upstream</a> <a>remote end</a> will need
2609+
to be tracked.
25742610

25752611
<li><p>If the <a>maximum active sessions</a> is equal to
25762612
the length of the list of <a>active sessions</a>,
@@ -2685,7 +2721,7 @@ <h3>Delete Session</h3>
26852721
<p>The <a>remote end steps</a> are:
26862722

26872723
<ol>
2688-
<li><p><a>Close the session</a>.
2724+
<li><p><a>Try</a> to <a>close the session</a>.
26892725

26902726
<li><p>Return <a>success</a> with data <a><code>null</code></a>.
26912727
</ol>
@@ -3439,7 +3475,7 @@ <h3>Close Window</h3>
34393475
<li><p><a>Close</a> the <a>current top-level browsing context</a>.
34403476

34413477
<li><p>If there are no more open <a>top-level browsing contexts</a>,
3442-
then <a>close the session</a>.
3478+
then <a>try</a> to <a>close the session</a>.
34433479

34443480
<li>Return the result of running the <a>remote end steps</a>
34453481
for the <a>Get Window Handles</a> <a>command</a>.

0 commit comments

Comments
 (0)