Skip to content

Commit

Permalink
clarify session.subscribe and session.unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightning00Blade committed Dec 19, 2023
1 parent bb3f568 commit 2f5ba1a
Showing 1 changed file with 32 additions and 20 deletions.
52 changes: 32 additions & 20 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1506,8 +1506,8 @@ session.SystemProxyConfiguration = (

<pre class="cddl remote-cddl">
session.SubscriptionRequest = {
events: [*text],
? contexts: [*browsingContext.BrowsingContext],
events: [+text],
? contexts: [+browsingContext.BrowsingContext],
}
</pre>

Expand Down Expand Up @@ -1695,8 +1695,8 @@ Issue: This needs to be generalized to work with realms too
<dd>
<pre class="cddl remote-cddl">
session.Subscribe = (
method: "session.subscribe",
params: session.SubscriptionRequest
method: "session.subscribe",
params: session.SubscriptionRequest
)
</pre>
</dd>
Expand All @@ -1711,14 +1711,20 @@ Issue: This needs to be generalized to work with realms too
<div algorithm="remote end steps for session.subscribe">
The [=remote end steps=] with |session| and |command parameters| are:

1. Let the |list of event names| be the value of the <code>events</code> field of
|command parameters|
1. Let the |set of event names| be empty [=set=].

1. Let the |list of contexts| be the value of the <code>contexts</code>
field of |command parameters| if it is present or null if it isn't.
1. For each |event| of <code>command parameters</code>["events"], append |event| to |set of event names|.

1. Let |set of contexts| be null.

1. If the value of the <code>contexts</code> field of |command parameters| is not null.

1. Set |set of contexts| to empty [=set=].

1. For each |event| of <code>command parameters</code>["contexts"], append |event| to |set of contexts|.

1. Let |enabled events| be the result of [=trying=] to [=update the event map=]
with |session|, |list of event names| , |list of contexts| and
with |session|, |set of event names| , |set of contexts| and
enabled true.

1. Let |subscribe step events| be a new [=/map=].
Expand Down Expand Up @@ -1761,12 +1767,12 @@ Issue: This needs to be generalised to work with realms too
<dl>
<dt>Command Type</dt>
<dd>
<pre class="cddl remote-cddl">
session.Unsubscribe = (
method: "session.unsubscribe",
params: session.SubscriptionRequest
)
</pre>
<pre class="cddl remote-cddl">
session.Unsubscribe = (
method: "session.unsubscribe",
params: session.SubscriptionRequest
)
</pre>
</dd>
<dt>Result Type</dt>
<dd>
Expand All @@ -1779,14 +1785,20 @@ Issue: This needs to be generalised to work with realms too
<div algorithm="remote end steps for session.unsubscribe">
The [=remote end steps=] with |session| and |command parameters| are:

1. Let the |list of event names| be the value of the <code>events</code> field of
|command parameters|.
1. Let the |set of event names| be empty [=set=].

1. For each |event| of <code>command parameters</code>["events"], append |event| to |set of event names|.

1. Let |set of contexts| be null.

1. If the value of the <code>contexts</code> field of |command parameters| is not null.

1. Set |set of contexts| to empty [=set=].

1. Let the |list of contexts| be the value of the <code>contexts</code>
field of |command parameters| if it is present or null if it isn't.
1. For each |event| of <code>command parameters</code>["contexts"], append |event| to |set of contexts|.

1. [=Try=] to [=update the event map=] with |session|,
|list of event names|, |list of contexts| and enabled false.
|set of event names|, |list of contexts| and enabled false.

1. Return [=success=] with data null.

Expand Down

0 comments on commit 2f5ba1a

Please sign in to comment.