Skip to content

Commit ec7726b

Browse files
Michael Wilsonhoch
authored andcommitted
Throw onerror instead of exception for AudioContext constructor sinkid problems
1 parent 0be282c commit ec7726b

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

index.bs

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,13 +1591,6 @@ Constructors</h4>
15911591
{{AudioSinkOptions/type}} in |sinkId| and {{AudioSinkInfo/type}}
15921592
in {{AudioContext/[[sink ID]]}} are equal, abort these substeps.
15931593

1594-
1. Let |validationResult| be the return value of
1595-
<a href="#validating-sink-identifier">sink identifier validation
1596-
</a> of |sinkId|.
1597-
1598-
1. If |validationResult| is a type of {{DOMException}}, throw an
1599-
exception with |validationResult| and abort these substeps.
1600-
16011594
1. If |sinkId| is a type of {{DOMString}}, set
16021595
{{AudioContext/[[sink ID]]}} to |sinkId| and abort these
16031596
substeps.
@@ -1643,14 +1636,22 @@ Constructors</h4>
16431636
1. Let |document| be the [=current settings object=]'s [=relevant global object=]'s
16441637
[=associated Document=].
16451638

1639+
1. Let |validationResult| be the return value of
1640+
<a href="#validating-sink-identifier">sink identifier validation
1641+
</a> of {{AudioContext/[[sink ID]]}}.
1642+
1643+
1. If |validationResult| is not <code>true</code>, [=Queue a
1644+
media element task=] to [=fire an event=] named {{AudioContext/error}}
1645+
at the {{AudioContext}}, and abort the following steps.
1646+
16461647
1. Attempt to [=acquire system resources=] to use a following audio output device
16471648
based on {{AudioContext/[[sink ID]]}} for rendering:
16481649

16491650
* The default audio output device for the empty string.
1650-
* A audio output device identified by {{AudioContext/[[sink ID]]}}.
1651-
1651+
* An audio output device identified by {{AudioContext/[[sink ID]]}}.
1652+
16521653
1. If resource acquisition fails, execute the following steps:
1653-
1654+
16541655
1. If |document| is not allowed to use the feature identified by
16551656
<code>"speaker-selection"</code>, abort these substeps.
16561657

@@ -2171,9 +2172,10 @@ Methods</h4>
21712172
1. Let |validationResult| be the return value of
21722173
<a href="#validating-sink-identifier">sink identifier validation</a>
21732174
of |sinkId|.
2174-
2175-
1. If |validationResult| is not <code>null</code>, return a promise
2176-
rejected with |validationResult|. Abort these steps.
2175+
2176+
1. If |validationResult| is not <code>true</code>, return a promise
2177+
rejected with a new {{DOMException}} whose name is
2178+
"{{NotAllowedError}}". Abort these steps.
21772179

21782180
1. Let |p| be a new promise.
21792181

@@ -2292,15 +2294,14 @@ This algorithm is used to validate the information provided to modify
22922294
1. Let |sinkIdArg| be the value passed in to this algorithm.
22932295

22942296
1. If |document| is not allowed to use the feature identified by
2295-
<code>"speaker-selection"</code>, return a new {{DOMException}} whose name
2296-
is "{{NotAllowedError}}".
2297+
<code>"speaker-selection"</code>, return <code>false</code>.
22972298

22982299
1. If |sinkIdArg| is a type of {{DOMString}} but it is not equal to the empty
22992300
string or it does not match any audio output device identified by the
23002301
result that would be provided by {{MediaDevices/enumerateDevices()}},
2301-
return a new {{DOMException}} whose name is "{{NotFoundError}}".
2302+
return <code>false</code>.
23022303

2303-
1. Return <code>null</code>.
2304+
1. Return <code>true</code>.
23042305
</div>
23052306

23062307
<h4 dictionary id="AudioContextOptions">

0 commit comments

Comments
 (0)