Skip to content

Commit 898e0c1

Browse files
authored
Restrict handle getter visibility to dedicated worker (#317)
Removes the MediaSource handle attribute visibility from the main Window context, leaving it visible only in dedicated worker contexts. Also removes the conditional throwing of NotSupportedError exceptions on getting this attribute's value if the implementation doesn't support that. Overall, this change is to undo the backwards incompatibility issue found when older versions of MSE web app libraries enumerated main thread MediaSource attribute values, hitting exception in the Chromium feature implementation through milestone 107. This change replaces that with simpler and safer visibility restriction of this getter to just the context where it must be supported if the implementation supports MSE-in-Workers. Note, this change replaces the alternative fix discussed in w3c/media-source PR #316. Reference feature tracking spec issue for MSE-in-Workers w3c/media-source issue #175.
1 parent 099830e commit 898e0c1

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

media-source-respec.html

+15-12
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ <h2><dfn>MediaSource</dfn> Object</h2>
322322
<pre class="idl">[Exposed=(Window,DedicatedWorker)]
323323
interface MediaSource : EventTarget {
324324
constructor();
325-
[SameObject] readonly attribute MediaSourceHandle handle;
325+
326+
[ SameObject, Exposed=DedicatedWorker ]
327+
readonly attribute MediaSourceHandle handle;
328+
326329
readonly attribute SourceBufferList sourceBuffers;
327330
readonly attribute SourceBufferList activeSourceBuffers;
328331
readonly attribute ReadyState readyState;
@@ -344,22 +347,22 @@ <h3>Attributes</h3>
344347

345348
<dt><dfn><code>handle</code></dfn> of type <span class="idlAttrType"><a>MediaSourceHandle</a></span>, [SameObject] readonly</dt><dd>
346349

347-
<p>Contains a handle useful for attachment to an {{HTMLMediaElement}} via {{HTMLMediaElement/srcObject}}.
348-
The handle remains the same object for this {{MediaSource}} object across accesses of this attribute, but it
349-
is distinct for each {{MediaSource}} object.</p>
350+
<p>Contains a handle useful for attachment of a dedicated worker {{MediaSource}} object to an
351+
{{HTMLMediaElement}} via {{HTMLMediaElement/srcObject}}. The handle remains the same object for this
352+
{{MediaSource}} object across accesses of this attribute, but it is distinct for each {{MediaSource}}
353+
object.</p>
354+
355+
<p class="note">This specification may eventually enable visibility of this attribute on {{MediaSource}}
356+
objects on the main Window context. If so, specification care will be necessary to prevent potential backwards
357+
incompatible changes, such as could happen if exceptions were thrown on accesses to this attribute.</p>
358+
350359
<p>On getting, run the following steps:</p>
351360
<ol>
352-
<li>If the implementation does not support creating a handle for this {{MediaSource}}, then throw a
353-
{{NotSupportedError}} exception and abort these steps.
354-
<p class="note">Implementations MAY choose to only allow handle creation for {{MediaSource}} objects in a
355-
{{DedicatedWorkerGlobalScope}}, as a minimum requirement for enabling attachment of such a {{MediaSource}}
356-
object to an {{HTMLMediaElement}}.</p>
357361
</li>
358362
<li>If the handle for this {{MediaSource}} object has not yet been created, then run the following steps:
359363
<ol>
360-
<li>Let |created handle:MediaSourceHandle| be the result of creating a new
361-
{{MediaSourceHandle}} object and associated resources, linked internally to this
362-
{{MediaSource}}.</li>
364+
<li>Let |created handle:MediaSourceHandle| be the result of creating a new {{MediaSourceHandle}} object
365+
and associated resources, linked internally to this {{MediaSource}}.</li>
363366
<li>Update the attribute to be |created handle|.</li>
364367
</ol>
365368
<li>Return the {{MediaSourceHandle}} object that is this attribute's value.</li>

0 commit comments

Comments
 (0)