Skip to content

Commit a1240f9

Browse files
committed
draft create user context
1 parent 9eb17f0 commit a1240f9

File tree

1 file changed

+40
-14
lines changed

1 file changed

+40
-14
lines changed

index.bs

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,8 +1222,14 @@ Issue: Define how this works.
12221222
# User Contexts # {#user-contexts}
12231223

12241224
A <dfn>user context</dfn> represents a collection of top-level navigables within a remote
1225-
end. Each top-level navigable belongs to exactly one user contexts, and child
1226-
navigables belong to the same user context as their parent.
1225+
end. Each top-level navigable belongs to exactly one user context, and child
1226+
navigables belong to the same user context as their parent. A [=user context=] without
1227+
navigables belonging to it is an <dfn>empty user context</dfn>.
1228+
1229+
The remote end always contains one [=user context=] referred as the <dfn>default user
1230+
context</dfn>.
1231+
1232+
Issue: Should we have a default user context?
12271233

12281234
Each user context represents an additional [=storage key=], so that no storage
12291235
state is shared between different user contexts.
@@ -1856,6 +1862,16 @@ The <dfn export for=commands>browser.createUserContext</dfn> command creates a [
18561862

18571863
<div algorithm="remote end steps for browser.createUserContext">
18581864

1865+
The [=remote end steps=] are:
1866+
1867+
1. Let |user context| be the result of performing implementation defined steps to create an [=empty user context=].
1868+
1869+
1. Let |result| be a [=/map=] matching the
1870+
<code>browser.createUserContextResult</code> production with the <code>userContext</code>
1871+
field set to |user context|'s [=user context id=].
1872+
1873+
1. Return [=success=] with data |result|.
1874+
18591875
</div>
18601876

18611877
#### The browser.closeUserContext Command #### {#command-browser-closeUserContext}
@@ -1876,11 +1892,9 @@ The <dfn export for=commands>browser.closeUserContext</dfn> command closes a use
18761892
</dd>
18771893
<dt>Return Type</dt>
18781894
<dd>
1879-
<pre class="cddl local-cddl">
1880-
browser.closeUserContextResult = {
1881-
userContext: browser.UserContext
1882-
}
1883-
</pre>
1895+
<pre class="cddl">
1896+
EmptyResult
1897+
</pre>
18841898
</dd>
18851899
</dl>
18861900

@@ -1894,7 +1908,7 @@ The [=remote end steps=] with |command parameters| are:
18941908

18951909
Issue: Do we need to define "find" to be able to combine it with [=trying=]?
18961910

1897-
Issue: Should we allow closing the default context?
1911+
Issue: Should we allow closing the default context? Probably not.
18981912

18991913
1. [=Close=] any [=top-level browsing contexts=] contained that belong to the
19001914
|user context| without [=prompting to unload=].
@@ -1938,7 +1952,8 @@ The <dfn export for=commands>browser.getUserContexts</dfn> command returns a lis
19381952

19391953
The [=remote end steps=] are:
19401954

1941-
1. Let |user contexts| be the result of implementation-specific steps to get [=user contexts=] from the user agent.
1955+
1. Let |user contexts| be the result of performing implementation defined steps
1956+
to get [=user contexts=] from the user agent.
19421957

19431958
1. Let |user context info list| be an empty [=/list=].
19441959

@@ -2132,6 +2147,10 @@ To <dfn>get the browsing context info</dfn> given |context|,
21322147

21332148
Note: This includes the fragment component of the URL.
21342149

2150+
1. Let |user context| be null if |context| belongs to the [=default user
2151+
context=] or the [=user context id=] if the [=user context=] the |context|
2152+
belongs to otherwise.
2153+
21352154
1. Let |child infos| be null.
21362155

21372156
1. If |max depth| is null, or |max depth| is greater than 0:
@@ -2153,7 +2172,7 @@ To <dfn>get the browsing context info</dfn> given |context|,
21532172
<code>browsingContext.Info</code> production with the <code>context</code>
21542173
field set to |context id|, the <code>parent</code> field set to |parent id|
21552174
if |is root| is <code>true</code>, or unset otherwise, the <code>url</code>
2156-
field set to |url|, and the <code>children</code> field set to |child infos|.
2175+
field set to |url|, the <code>userContext</code> field set to |user context| and the <code>children</code> field set to |child infos|.
21572176

21582177
1. Return |context info|.
21592178

@@ -2755,13 +2774,20 @@ The [=remote end steps=] with |command parameters| are:
27552774
1. If the implementation is unable to create a new browsing context for any
27562775
reason then return [=error=] with [=error code=] [=unsupported operation=].
27572776

2777+
1. Let |user context| be the [=default user context=].
2778+
2779+
1. If |command parameters|[<code>userContext</code>] is present and is not null:
2780+
2781+
1. Let |user context| be the result of [=trying=] to find a [=user context=] whose [=user context id=] equals |command parameters|[<code>userContext</code>].
2782+
27582783
<!-- This is based on step 5 of https://w3c.github.io/webdriver/#new-window,
27592784
but without using the "current browsing context" concept. -->
27602785
1. Create a new [=top-level browsing context=] by running the [=window open
2761-
steps=] with <var ignore>url</var> set to "<code>about:blank</code>",
2762-
<var ignore>target</var> set to the empty string, and
2763-
<var ignore>features</var> set to "<code>noopener</code>". Which OS window the new [=/browsing context=]
2764-
is created in depends on |type| and |reference context|:
2786+
steps=] in the |user context| with <var ignore>url</var> set to
2787+
"<code>about:blank</code>", <var ignore>target</var> set to the empty
2788+
string, and <var ignore>features</var> set to "<code>noopener</code>".
2789+
Which OS window the new [=/browsing context=] is created in depends on
2790+
|type| and |reference context|:
27652791

27662792
* If |type| is "<code>tab</code>" and the implementation supports
27672793
multiple browsing contexts in the same OS window:

0 commit comments

Comments
 (0)