Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support user contexts #570

Merged
merged 44 commits into from
Jan 22, 2024
Merged
Changes from 3 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5259fa5
WIP partitions
OrKoN Oct 10, 2023
8cee793
Update index.bs
OrKoN Oct 10, 2023
84db4ee
Rename to UserContext; add a note about User Agents
OrKoN Oct 30, 2023
d8ffee7
define getUserContexts
OrKoN Oct 30, 2023
44341cf
Add jgraham's suggestions
OrKoN Oct 30, 2023
8ab3f0b
draft browser.closeUserContext
OrKoN Oct 30, 2023
4a4a0ca
draft create user context
OrKoN Oct 30, 2023
59e608e
add types and commands
OrKoN Nov 8, 2023
5f98005
trying to improve the definitions
OrKoN Nov 8, 2023
f7c612d
fix the outline
OrKoN Nov 8, 2023
a7a71a2
Update index.bs
OrKoN Nov 9, 2023
1a0c963
update steps
OrKoN Nov 9, 2023
aa2c0ec
Update index.bs
OrKoN Nov 27, 2023
59d2c51
Update index.bs
OrKoN Nov 27, 2023
32b8efd
Update index.bs
OrKoN Nov 27, 2023
4733bd5
clarify how default contexts work
OrKoN Nov 27, 2023
ff8b3f1
fix types
OrKoN Nov 27, 2023
45aa6db
remove null from userContext
OrKoN Dec 8, 2023
fc94b9f
update undefined to null
OrKoN Dec 8, 2023
3e7a0ec
update undefined to null
OrKoN Dec 8, 2023
5816e9e
Update index.bs
jrandolf-2 Dec 18, 2023
bc19673
Use `removeUserContext`
jrandolf-2 Dec 18, 2023
4a4aaa6
Address comments
jrandolf-2 Dec 18, 2023
ded90b6
Update index.bs
jrandolf-2 Dec 18, 2023
2c0c421
Update wording.
jrandolf-2 Dec 18, 2023
a30c574
review comments
OrKoN Jan 4, 2024
9342771
replace user agent with remote end
OrKoN Jan 4, 2024
d4976cf
fix cddl
OrKoN Jan 4, 2024
4f93268
fix phrasing
OrKoN Jan 4, 2024
492089e
Remove GetUserContexts
OrKoN Jan 5, 2024
4e1af81
no such context error
OrKoN Jan 12, 2024
49f7ba2
Use reference context's user context
OrKoN Jan 12, 2024
7f221d1
Prevent removal of the default context
OrKoN Jan 15, 2024
e384195
no such context error
OrKoN Jan 12, 2024
af0d0c2
remove duplicate error
OrKoN Jan 18, 2024
8a2bb4b
fix formatting
OrKoN Jan 18, 2024
2d1a835
Update the definition of user contexts
jgraham Jan 17, 2024
93acadb
Add a browser.getUserContext command
jgraham Jan 17, 2024
88196bd
Fix UserContextInfo
OrKoN Jan 18, 2024
3542e7d
Apply suggestions to browsingContext creation
OrKoN Jan 18, 2024
1fcda96
Reuse UserContextInfo
OrKoN Jan 19, 2024
0db4d0d
Extract the get user context algorithm
OrKoN Jan 19, 2024
0336819
Fix userContextId
OrKoN Jan 19, 2024
253d3eb
Add missing +BrowserResult
OrKoN Jan 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 22 additions & 26 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -577,9 +577,6 @@ WebDriver BiDi extends the set of [=error codes=] from [[WEBDRIVER|WebDriver]]
with the following additional codes:

<dl>
<dt><dfn>invalid user context id</dfn>
<dd>Tried to use a [=user context=] that contradicts the provided reference context.

<dt><dfn>no such handle</dfn>
<dd>Tried to deserialize an unknown <code>RemoteObjectReference</code>.

Expand Down Expand Up @@ -620,7 +617,6 @@ with the following additional codes:
<pre class="cddl local-cddl">
ErrorCode = "invalid argument" /
"invalid session id" /
"invalid user context id" /
"move target out of bounds" /
"no such alert" /
"no such element" /
Expand Down Expand Up @@ -1958,9 +1954,9 @@ The <code>browser.UserContext</code> unique identifies a [=user context=].
#### The browser.UserContextInfo Type #### {#type-browser-UserContextInfo}

<pre class="cddl remote-cddl local-cddl">
browser.UserContextInfo = (
browser.UserContextInfo = {
userContext: browser.UserContext
)
}
</pre>

The <code>browser.UserContextInfo</code> type represents properties of a [=user
Expand Down Expand Up @@ -2056,9 +2052,7 @@ The <dfn export for=commands>browser.createUserContext</dfn> command creates a
<dt>Return Type</dt>
<dd>
<pre class="cddl local-cddl">
browser.createUserContextResult = {
userContext: browser.UserContext
}
browser.CreateUserContextResult = browser.UserContextInfo
</pre>
</dd>
</dl>
Expand All @@ -2071,11 +2065,11 @@ The [=remote end steps=] are:

1. [=set/Append=] |user context| to the [=set of user contexts=].

1. Let |result| be a [=/map=] matching the
<code>browser.createUserContextResult</code> production with the
<code>userContext</code> field set to |user context|'s [=user context id=].
1. Let |user context info| be a [=/map=] matching the
<code>browser.UserContextInfo</code> production with the
<code>userContext</code> field set to |user context|'s [=user context id=].

1. Return [=success=] with data |result|.
1. Return [=success=] with data |user context info|.

</div>

Expand All @@ -2098,7 +2092,7 @@ list of [=user context=]s.
<dt>Return Type</dt>
<dd>
<pre class="cddl local-cddl">
browser.getUserContextsResult = {
browser.GetUserContextsResult = {
userContexts: [ + browser.UserContextInfo]
}
</pre>
Expand All @@ -2120,7 +2114,7 @@ The [=remote end steps=] are:
1. [=list/Append=] |user context info| to |user contexts|.

1. Let |result| be a [=/map=] matching the
<code>browser.getUserContextsResult</code> production with the
<code>browser.GetUserContextsResult</code> production with the
<code>userContexts</code> field set to |user contexts|.

1. Return [=success=] with data |result|.
Expand Down Expand Up @@ -3038,29 +3032,31 @@ The [=remote end steps=] with |command parameters| are:
1. If the implementation is unable to create a new browsing context for any
reason then return [=error=] with [=error code=] [=unsupported operation=].

1. Let |user context| be the [=default user context=] if |reference context| is null, and |reference context|' [=user context=] otherwise.
1. Let |user context| be the [=default user context=] if |reference context|
is null, and |reference context|' [=associated user context=] otherwise.

1. If |command parameters|[<code>userContext</code>] is present and is not null:

1. Let |user context id| be |command parameters|[<code>userContext</code>].

1. If the [=user context=] with the [=user context id=] equal to |user context id| does
1. If the [=user context=] with the [=user context id=] |user context id| does
not exist in the [=remote end=], return [=error=] with [=error code=] [=no such user context=].

1. Set |user context| to the [=user context=] with the [=user context id=] equal
to |user context id|.
1. Set |user context| to the [=user context=] with the [=user context id=] |user context id|.
OrKoN marked this conversation as resolved.
Show resolved Hide resolved

1. If |reference context| is not null and |reference context|'s [=user context=] is not |user context|,
return [=error=] with [=error code=] [=invalid user context id=].
1. If the implementation is unable to create a new [=/top-level traversable=]
with [=associated user context=] |user context| for any reason, return
[=error=] with [=error code=] [=unsupported operation=].

<!-- This is based on step 5 of https://w3c.github.io/webdriver/#new-window,
but without using the "current browsing context" concept. -->
1. Create a new [=top-level browsing context=] by running the [=window open
steps=] in the |user context| with <var ignore>url</var> set to
"<code>about:blank</code>", <var ignore>target</var> set to the empty
string, and <var ignore>features</var> set to "<code>noopener</code>".
Which OS window the new [=/browsing context=] is created in depends on
|type| and |reference context|:
steps=] with <var ignore>url</var> set to "<code>about:blank</code>", <var
ignore>target</var> set to the empty string, and <var ignore>features</var>
set to "<code>noopener</code>", and setting the [=associated user context=]
for the newly created [=/top-level traversable=] to |user context|. Which OS
window the new [=/browsing context=] is created in depends on |type| and
|reference context|:

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