Skip to content

Commit 0e1e99a

Browse files
committed
Fix returning null from commands
We want returning null to map onto an empty result. We could do this explicitly per command, but it's less verbose to just allow null at the top level.
1 parent fa58031 commit 0e1e99a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

index.bs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,11 @@ Each [=command=] is defined by:
394394
- A <dfn export for=command>result type</dfn>, which is defined by a [=local
395395
end definition=] fragment.
396396
- A set of [=remote end steps=] which define the actions to take for a command
397-
given a [=BiDi session=] and [=command parameters=] and return an
398-
instance of the command [=result type=].
397+
given a [=BiDi session=] and [=command parameters=]. If the command runs to
398+
completion these steps return [=success=] with either a [=map=] matching the
399+
command [=result type=] production or with null to indicate an
400+
`EmptyResult`. If the command does not run to completion these steps return
401+
[=error=] with the [=error code=] that will be reported to the user.
399402

400403
A command that can run without an active session is a <dfn>static
401404
command</dfn>. Commands are not static commands unless stated in their
@@ -797,6 +800,8 @@ To <dfn>handle an incoming message</dfn> given a [=WebSocket connection=]
797800

798801
1. Let |value| be |result|'s data.
799802

803+
1. If |value| is null, set |value| to an empty map.
804+
800805
1. Assert: |value| matches the definition for the [=result type=]
801806
corresponding to the command with [=command name=] |method|.
802807

@@ -4917,7 +4922,7 @@ The [=remote end steps=] given |session| and |command parameters| are:
49174922

49184923
1. <a for=set>Remove</a> |script| from |preload script map|.
49194924

4920-
1. Return null
4925+
1. Return [=success=] with data null
49214926

49224927
</div>
49234928

0 commit comments

Comments
 (0)