[EME] Bug 25506 - Convert IDL for MediaKeys.
authorDavid Dorwin <ddorwin@google.com>
Fri, 10 Oct 2014 14:43:23 -0700
changeset 453 ca4a8e0cde5d
parent 452 b452f399da9d
child 454 51e766999bd6
[EME] Bug 25506 - Convert IDL for MediaKeys.
encrypted-media/encrypted-media-respec.html
encrypted-media/encrypted-media.js
--- a/encrypted-media/encrypted-media-respec.html	Fri Oct 10 14:42:59 2014 -0700
+++ b/encrypted-media/encrypted-media-respec.html	Fri Oct 10 14:43:23 2014 -0700
@@ -160,8 +160,8 @@
     Sessions are embodied as <coderef>MediaKeySession</coderef> objects.
     Each Key session is associated with a single instance of <a href="#initialization-data">Initialization Data</a> provided in the <methodref>generateRequest</methodref> call.
     </p>
-    <p>Each Key Session is associated with a single <coderef>MediaKeys</coderef> object, and only <a href="#htmlmediaelement-extensions">media element(s)</a> associated with that object may access key(s) associated with the session.
-    Other <coderef>MediaKeys</coderef> objects, <a href="#cdm">CDM</a> instances, and media elements may <em>not</em> access the key session or use its key(s).
+    <p>Each Key Session is associated with a single <a def-id="mediakeys"></a> object, and only <a href="#htmlmediaelement-extensions">media element(s)</a> associated with that object may access key(s) associated with the session.
+    Other <a def-id="mediakeys"></a> objects, <a href="#cdm">CDM</a> instances, and media elements may <em>not</em> access the key session or use its key(s).
     Key sessions and the keys they contain are no longer usable by the CDM for decryption when the <a href="#algorithms-session-close">session is closed</a>, including when the <coderef>MediaKeySession</coderef> object is destroyed.
     </p>
     </section>
@@ -173,7 +173,7 @@
     <p>A new Session ID is generated each time the user agent and CDM successfully create a new session.</p>
 
     <p>Each Session ID shall be unique within the browsing context in which it was created.
-      Session IDs for "<coderef prefix="sessiontype">persistent</coderef>" sessions must be unique within the <a def-id="origin"></a> over time, including across browsing sessions.
+      Session IDs for <a def-id="persistent-session"></a> sessions must be unique within the <a def-id="origin"></a> over time, including across browsing sessions.
     </p>
 
     <p class="note">The underlying content protection protocol does not necessarily need to support Session IDs.</p>
@@ -256,36 +256,53 @@
     <p>The MediaKeys object represents a set of keys that an associated HTMLMediaElement can use for decryption of <a def-id="media-data"></a> during playback.
       It also represents a CDM instance.
     </p>
-    <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=25923">Bug 25923</a> - Feature detection, including isTypeSupported(), and MediaKeys creation may change significantly.</p>
-    <pre class="was-idl">
-enum <precodedfn>IsTypeSupportedResult</precodedfn> { "<precodedfn prefix="istypesupportedresultempty"></precodedfn>" /* empty string */, "<precodedfn prefix="istypesupportedresult">maybe</precodedfn>", "<precodedfn prefix="istypesupportedresult">probably</precodedfn>" };
-enum <precodedfn>SessionType</precodedfn> { "<precodedfn prefix="sessiontype">temporary</precodedfn>", "<precodedfn prefix="sessiontype">persistent</precodedfn>" };
-interface <precodedfn>MediaKeys</precodedfn> {
-  readonly attribute DOMString <precoderef>keySystem</precoderef>;
-
-  <precoderef>MediaKeySession</precoderef> <premethodref>createSession</premethodref>(optional <precoderef>SessionType</precoderef> sessionType = "<precoderef prefix="sessiontype">temporary</precoderef>");
-  Promise&lt;void&gt; <premethodref>setServerCertificate</premethodref>((ArrayBuffer or ArrayBufferView) serverCertificate);
-
-  static Promise&lt;<precoderef>MediaKeys</precoderef>&gt; <premethodref>create</premethodref>(DOMString <a href="#key-system">keySystem</a>);
-  static <precoderef>IsTypeSupportedResult</precoderef> <premethodref>isTypeSupported</premethodref>(DOMstring <a href="#key-system">keySystem</a>, optional DOMString <a href="#initialization-data-type">initDataType</a>, optional DOMString contentType, optional DOMString capability);
-};
-</pre>
-
-    <section id="mediakeys-attributes">
-    <h3>Attributes</h3>
-
-    <p>The <codedfn>keySystem</codedfn> attribute identifies the <a href="#key-system">Key System</a> being used.</p>
-    </section>
-
-    <section id="mediakeys-methods">
-    <h3>Methods</h3>
     <p>For methods that return a promise, all errors are reported asynchronously by rejecting the returned Promise. This includes WebIDL type mapping errors.</p>
     <p>The steps of an algorithm are always aborted when resolving or rejecting a promise.</p>
+    
+    <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=25923">Bug 25923</a> - Feature detection, including isTypeSupported(), and MediaKeys creation may change significantly.</p>
+    <dl title="enum IsTypeSupportedResult" class="idl">
+      <dt>/* empty string */</dt><!-- TODO: Fix. -->
+      <dd>
+        The combination is not supported.
+      </dd>
+      <dt>maybe</dt>
+      <dd>
+        The combination may be supported.
+      </dd>
+      <dt>probably</dt>
+      <dd>
+        The combination is likely supported.
+      </dd>
+    </dl>
 
-    <p>The <methoddfn name="createSession">createSession(<var title="true">sessionType</var>)</methoddfn> method returns a new <coderef>MediaKeySession</coderef> object. It must run the following steps:</p>
+    <dl title="enum SessionType" class="idl">
+      <dt>temporary</dt>
+      <dd>
+         A session for which a record of or data related to the session MUST NOT be persisted.
+         The application need not worry about managing such storage.
+      </dd>
+      <dt>persistent</dt>
+      <dd>
+        A session for which a record of or data related to the session MAY be persisted.
+        The application is responsible for managing any such storage that may be generated by the CDM.
+        See <a href="#session-storage">Session Storage and Persistence</a>.
+      </dd>
+    </dl>
 
-    <ol>
-      <li><p>If <var title="true">sessionType</var> is not supported by the <a href="#cdm">content decryption module</a> corresponding to the <coderef>keySystem</coderef>, throw <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
+    <dl title="interface MediaKeys" class='idl'>
+      <dt>readonly attribute DOMString keySystem</dt>
+      <dd>
+        Identifies the <a href="#key-system">Key System</a> being used.
+      </dd>
+
+      <dt>MediaKeySession createSession(optional SessionType sessionType = "temporary")</dt>
+      <dd>
+    <!-- TODO: Fix indentation here and for all other methods. -->
+    <p>Returns a new <coderef>MediaKeySession</coderef> object.</p>
+
+    <ol class="method-algorithm">
+      <!-- TODO: Reference the CDM loaded during initialization instead of "<a href="#cdm">content decryption module</a> corresponding to the <a def-id="keySystem-attribute"></a> attribute". Here and elsewhere. -->
+      <li><p>If <var title="true">sessionType</var> is not supported by the <a href="#cdm">content decryption module</a> corresponding to the <a def-id="keySystem-attribute"></a> attribute, throw <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
       <li><p>Let <var title="true">session</var> be a new <coderef>MediaKeySession</coderef> object, and initialize it as follows:</p>
         <ol>
           <li><p>Let the <coderef>sessionId</coderef> attribute be the empty string.</p></li>
@@ -298,19 +315,22 @@
       </li>
       <li><p>Return <var title="true">session</var>.</p></li>
     </ol>
+      </dd>
 
-    <p id="server-certificate">The <methoddfn name="setServerCertificate">setServerCertificate(<var title="true">serverCertificate</var>)</methoddfn> method provides a server certificate to be used to encrypt messages to the license server. It must run the following steps:</p>
+      <dt>Promise&lt;void&gt; setServerCertificate((ArrayBuffer or ArrayBufferView) serverCertificate)</dt>
+      <dd>
+    <p id="server-certificate">Provides a server certificate to be used to encrypt messages to the license server.</p>
     <p class="note">The contents of <var title="true">serverCertificate</var> are <a href="#key-system">Key System</a>-specific.</p>
     <p class="note">Key systems that use such certificates should also support requesting the certificate from the server via an  additional round trip. This simplifies interoperability for applications that are not designed to provide certificates to specific key systems.</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If <var title="true">serverCertificate</var> is an empty array, return a promise rejected with a new <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
-      <li><p>If the <coderef>keySystem</coderef> does not support server certificates, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
+      <li><p>If the <a href="#cdm">content decryption module</a> corresponding to the <a def-id="keySystem-attribute"></a> attribute does not support server certificates, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
       <li><p>Let <var>certificate</var> be a copy of the contents of the <var title="true">serverCertificate</var> parameter.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
-          <li><p>Let <var title="true">cdm</var> be the <var title="true">cdm</var> during the <a href="#dom-create">initialization</a> of this object.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the <var title="true">cdm</var> during the <a def-id="mediakeys-initialization">initialization</a> of this object.</p></li>
           <li><p>Use the <var title="true">cdm</var> to process <var>certificate</var>.</p></li>
           <li><p>If any of the preceding steps failed, reject <var>promise</var> with <a def-id="new-domexception-named"></a> the appropriate <a href="#error-names">error name</a>.</p></li>
           <li><p>Resolve <var>promise</var>.</p></li>
@@ -318,10 +338,13 @@
       </li>
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
+      </dd>
 
-    <p>The <methoddfn name="create">create(<var title="true">keySystem</var>)</methoddfn> method creates a new <coderef>MediaKeys</coderef> object for <var title="true">keySystem</var>. It must run the following steps:</p>
+      <dt>static Promise&lt;MediaKeys&gt; create(DOMString keySystem)</dt>
+      <dd>
+    <p>Creates a new <a def-id="mediakeys"></a> object for <var title="true">keySystem</var>.</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If <var title="true">keySystem</var> is an empty string, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
       <li><p>If <var title="true">keySystem</var> is not one of the <a href="#key-system">Key Systems</a> supported by the user agent, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>. String comparison is case-sensitive.</p></li>
       <li><p>If <var title="true">keySystem</var> is not supported or not allowed in the <a def-id="origin"></a> of the calling context's <a def-id="document-concept"></a>, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
@@ -333,9 +356,9 @@
           <li><p>If <var title="true">cdm</var> fails to load or initialize, reject <var>promise</var> with <a def-id="new-domexception-named"></a> the appropriate <a href="#error-names">error name</a>.</p></li>
 
           <li>
-            <p>Let <var title="true">media keys</var> be a new <coderef>MediaKeys</coderef> object, and initialize it as follows:</p>
+            <p>Let <var title="true">media keys</var> be a new <a def-id="mediakeys"></a> object, and initialize it as follows:</p>
             <ol>
-              <li><p>Set the <coderef>keySystem</coderef> attribute to <var title="true">keySystem</var>.</p></li>
+              <li><p>Set the <a def-id="keySystem-attribute"></a> attribute to <var title="true">keySystem</var>.</p></li>
             </ol>
           </li>
           <li><p>Resolve <var>promise</var> with <var title="true">media keys</var>.</p></li>
@@ -343,8 +366,11 @@
       </li>
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
+      </dd>
 
-    <p>The <methoddfn name="isTypeSupported">isTypeSupported(<var title="true">keySystem</var>, <var title="true">initDataType</var>, <var title="true">contentType</var>, <var title="true">capability</var>)</methoddfn> method returns whether <var title="true">keySystem</var> is supported with the <var title="true"><a href="#initialization-data-type">initDataType</a></var>, container and codec(s) specified by <var title="true">contentType</var>, and <var title="true">capability</var>.</p>
+      <dt>static IsTypeSupportedResult isTypeSupported(DOMstring keySystem, optional DOMString initDataType, optional DOMString contentType, optional DOMString capability)</dt>
+      <dd>
+    <p>Returns whether <var title="true">keySystem</var> is supported with the <var title="true"><a href="#initialization-data-type">initDataType</a></var>, container and codec(s) specified by <var title="true">contentType</var>, and <var title="true">capability</var>.</p>
     <div class="example">
       <p>The following list shows some examples.</p>
       <dl>
@@ -359,17 +385,15 @@
       </dl>
     </div>
 
-    <p>It must run the following steps:</p>
-    
-    <ol>
-      <li><p>If <var title="true">keySystem</var> is an empty string or contains an unrecognized or unsupported <a href="#key-system">Key System</a>, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps. String comparison is case-sensitive.</p></li>
-      <li><p>If the <var title="true">keySystem</var> implementation is not available and usable, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>
+    <ol class="method-algorithm">
+      <li><p>If <var title="true">keySystem</var> is an empty string or contains an unrecognized or unsupported <a href="#key-system">Key System</a>, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps. String comparison is case-sensitive.</p></li>
+      <li><p>If the <var title="true">keySystem</var> implementation is not available and usable, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
       <li><p>Follow the steps for the first matching condition from the following list:</p>
         <dl class="switch">
-          <dt>If <var title="true">keySystem</var> is a value that may be successfully passed to <methodref>create</methodref></dt>
-          <dd>Let <var title="true">probably result</var> be "<coderef prefix="istypesupportedresult">probably</coderef>".</dd>
+          <dt>If <var title="true">keySystem</var> is a value that may be successfully passed to <a def-id="mediakeys-create"></a></dt>
+          <dd>Let <var title="true">probably result</var> be <a def-id="IsTypeSupportedResult-probably"></a>.</dd>
           <dt>Otherwise</dt>
-          <dd>Let <var title="true">probably result</var> be "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Let <var title="true">probably result</var> be <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <p class="note">This may, for example, be the case for strings that are only used for discovery.</p>
         </dl>
       </li>
@@ -377,59 +401,61 @@
       <li><p>If <var title="true">initDataType</var> was not provided, follow the steps for the first matching condition from the following list and abort these steps:</p>
         <dl class="switch">
           <dt>If the user agent is <em>not</em> confident that the <var title="true">keySystem</var> implementation is available and usable</dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>Otherwise</dt>
           <dd>Return <var title="true">probably result</var>.</dd>
         </dl>
       </li>
 
-      <li><p>If <var title="true">initDataType</var> is an empty string or contains an unrecognized or unsupported <a href="#initialization-data-type">initialization data type</a>, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps. String comparison is case-sensitive.</p></li>
-      <li><p>If <var title="true">initDataType</var> is not an <a href="#initialization-data-type">initialization data type</a> supported by the <var title="true">keySystem</var> implementation, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>      
-      <li><p>If the <var title="true">keySystem</var> implementation supporting <var title="true">initDataType</var> is not available and usable, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>
+      <li><p>If <var title="true">initDataType</var> is an empty string or contains an unrecognized or unsupported <a href="#initialization-data-type">initialization data type</a>, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps. String comparison is case-sensitive.</p></li>
+      <li><p>If <var title="true">initDataType</var> is not an <a href="#initialization-data-type">initialization data type</a> supported by the <var title="true">keySystem</var> implementation, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
+      <li><p>If the <var title="true">keySystem</var> implementation supporting <var title="true">initDataType</var> is not available and usable, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
       <li><p>If <var title="true">contentType</var> was not provided, follow the steps for the first matching condition from the following list and abort these steps:</p>
         <dl class="switch">
           <dt>If the user agent is <em>not</em> confident that the <var title="true">keySystem</var> implementation supporting <var title="true">initDataType</var> is available and usable</dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>Otherwise</dt>
           <dd>Return <var title="true">probably result</var>.</dd>
         </dl>
       </li>
 
-      <li><p>If <var title="true">contentType</var> is an empty string or contains an invalid or unrecognized MIME type, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>
+      <li><p>If <var title="true">contentType</var> is an empty string or contains an invalid or unrecognized MIME type, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
       <li><p>Let <var title="true">container</var> be the container type specified by <var title="true">contentType</var>.</p></li>
       <li><p>Let <var title="true">parameters</var> be the <a href="http://tools.ietf.org/html/rfc6381">RFC 6381</a> parameters, if any, specified by <var title="true">contentType</var>.</p></li>
       <li><p>Let <var title="true">media types</var> be the set of media types specified by <var title="true">parameters</var>. It may be empty. The case-sensitivity of string comparisons is determined by the appropriate RFC or other specification.</p>
         <p class="note">For example, all of the codecs. Case-sensitive string comparison is recommended because <a href="http://tools.ietf.org/html/rfc6381#section-3.3">RFC 6381</a> says, "Values are case sensitive" for some formats.</p>
       </li>
-      <li><p>If the user agent does not support <var title="true">container</var>, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps. The case-sensitivity of string comparisons is determined by the appropriate RFC.</p>
+      <li><p>If the user agent does not support <var title="true">container</var>, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps. The case-sensitivity of string comparisons is determined by the appropriate RFC.</p>
         <p class="note">Per <a href="http://tools.ietf.org/html/rfc6838#section-4.2">RFC 6838</a>, "Both top-level type and subtype names are case-insensitive.")</p>
       </li>
-      <li><p>If the user agent and <var title="true">keySystem</var> implementation do not support playback of encrypted <a def-id="media-data"></a> for all <var title="true">media types</var>, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>
+      <li><p>If the user agent and <var title="true">keySystem</var> implementation do not support playback of encrypted <a def-id="media-data"></a> for all <var title="true">media types</var>, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
       <li><p>If <var title="true">capability</var> was not provided, follow the steps for the first matching condition from the following list and abort these steps:</p>
         <dl class="switch">
           <dt>If the user agent is <em>not</em> confident that the <var title="true">keySystem</var> implementation supporting <var title="true">initDataType</var> is available and usable to decrypt and enable playback of support playback of encrypted <a def-id="media-data"></a> for all <var title="true">media types</var></dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>If the user agent did <em>not</em> recognize one or more <var title="true">parameters</var></dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>Otherwise</dt>
           <dd>Return <var title="true">probably result</var>.</dd>
         </dl>
       </li>
       
-      <li><p>If <var title="true">capability</var> is an empty string, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps.</p></li>
-      <li><p>If the <var title="true">keySystem</var> implementation does not support <var title="true">capability</var>, return the <a href="#dom-istypesupportedresultempty">empty string</a> and abort these steps. String comparison is case-sensitive.</p></li>
+      <li><p>If <var title="true">capability</var> is an empty string, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps.</p></li>
+      <li><p>If the <var title="true">keySystem</var> implementation does not support <var title="true">capability</var>, return <a def-id="IsTypeSupportedResult-empty"></a> and abort these steps. String comparison is case-sensitive.</p></li>
       <li><p>Follow the steps for the first matching condition from the following list:</p>
         <dl class="switch">
           <dt>If the user agent is <em>not</em> confident that the <var title="true">keySystem</var> implementation supporting <var title="true">initDataType</var> is available and usable to decrypt and enable playback of support playback of encrypted <a def-id="media-data"></a> for all <var title="true">media types</var> as specified by <var title="true">capability</var></dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>If the user agent did <em>not</em> recognize one or more <var title="true">parameters</var></dt>
-          <dd>Return "<coderef prefix="istypesupportedresult">maybe</coderef>".</dd>
+          <dd>Return <a def-id="IsTypeSupportedResult-maybe"></a>.</dd>
           <dt>Otherwise</dt>
           <dd>Return <var title="true">probably result</var>.</dd>
         </dl>
       </li>
     </ol>
-    </section>
+      </dd>
+    </dl>
+
     </section>
 
 
@@ -473,18 +499,18 @@
     <p>For methods that return a promise, all errors are reported asynchronously by rejecting the returned Promise. This includes WebIDL type mapping errors.</p>
     <p>The steps of an algorithm are always aborted when resolving or rejecting a promise.</p>
 
-    <p>The <methoddfn name="generateRequest">generateRequest(<var title="true">initDataType</var>, <var title="true">initData</var>)</methoddfn> method generates a request based on the <var title="true">initData</var>. It must run the following steps:</p>
+    <p>The <methoddfn name="generateRequest">generateRequest(<var title="true">initDataType</var>, <var title="true">initData</var>)</methoddfn> method generates a request based on the <var title="true">initData</var>.</p>
     <p><var title="true">initData</var> is <a href="#initialization-data">Initialization Data</a>, and
     <var title="true">initDataType</var> is an <a href="#initialization-data-type">initialization data type</a> that indicates how to interpret <var title="true">initData</var>.
     </p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">uninitialized</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>Let this object's <var title="true">uninitialized</var> be false.</p></li><!-- For simplicity and consistency, this object cannot be reused after any failure. -->
       <li><p>If <var title="true">initDataType</var> is an empty string, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
       <li><p>If <var title="true">initData</var> is an empty array, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
-      <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object that created this object.</p></li>
-      <li><p>If the <a href="#cdm">content decryption module</a> corresponding to <var title="true">media keys</var>'s <coderef>keySystem</coderef> attribute does not support <var title="true">initDataType</var> as an <a href="#initialization-data-type">initialization data type</a>, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>. String comparison is case-sensitive.</p></li>
+      <li><p>Let <var title="true">media keys</var> be the <a def-id="mediakeys"></a> object that created this object.</p></li>
+      <li><p>If the <a href="#cdm">content decryption module</a> corresponding to <var title="true">media keys</var>'s <a def-id="keySystem-attribute"></a> attribute does not support <var title="true">initDataType</var> as an <a href="#initialization-data-type">initialization data type</a>, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>. String comparison is case-sensitive.</p></li>
       <li><p>Let <var>init data</var> be a copy of the contents of the <var title="true">initData</var> parameter.</p></li>
       <li><p>Let <var title="true">session type</var> be this object's <var title="true">session type</var>.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
@@ -502,17 +528,17 @@
           <li><p>If the previous step failed, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
           <li><p>Let <var title="true">session id</var> be the empty string.</p></li>
           <li><p>Let <var title="true">message</var> be null.</p></li>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of <var title="true">media keys</var>.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of <var title="true">media keys</var>.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li><p>If the <var>init data</var> is not supported by the <var title="true">cdm</var>, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
               <li><p>Follow the steps for the first matching condition from the following list:</p>
                 <dl class="switch">
-                  <dt>If <var title="true">session type</var> is "<coderef prefix="sessiontype">temporary</coderef>"</dt>
+                  <dt>If <var title="true">session type</var> is <a def-id="temporary-session"></a></dt>
                   <dd>Let <var title="true">requested session type</var> be a temporary non-persisted session.</p>
                     <p class="note">The returned license must not be persistable.</p>
                   </dd>
-                  <dt>If <var title="true">session type</var> is "<coderef prefix="sessiontype">persistent</coderef>"</dt>
+                  <dt>If <var title="true">session type</var> is <a def-id="persistent-session"></a></dt>
                   <dd>Let <var title="true">requested session type</var> be a persistable session.<p>
                     <p class="note">The returned license may be persistable.)</p>
                   </dd>
@@ -521,7 +547,7 @@
               </li>
 
               <li><p>Let <var title="true">session id</var> be a unique <a href="#session-id">Session ID</a> string.</p>
-                <p>If <var title="true">session type</var> is "<coderef prefix="sessiontype">persistent</coderef>", the ID must be unique within the the <a def-id="origin"></a> of this object's <a def-id="document-concept"></a> over time, including across Documents and browsing sessions.</p>
+                <p>If <var title="true">session type</var> is <a def-id="persistent-session"></a>, the ID must be unique within the the <a def-id="origin"></a> of this object's <a def-id="document-concept"></a> over time, including across Documents and browsing sessions.</p>
               </li>
               <li><p>Let <var title="true">message</var> be a request for the <var title="true">requested session type</var> generated based on the <var>init data</var>, which is interpreted per <var title="true">initDataType</var>.</p>
                 <p class="note">For example, a license request.</p>
@@ -540,15 +566,15 @@
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
 
-    <p>The <methoddfn name="load">load(<var title="true">sessionId</var>)</methoddfn> method loads the data stored for the <var title="true">sessionId</var> into the session represented by the object. It must run the following steps:</p>
+    <p>The <methoddfn name="load">load(<var title="true">sessionId</var>)</methoddfn> method loads the data stored for the <var title="true">sessionId</var> into the session represented by the object.</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">uninitialized</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>Let this object's <var title="true">uninitialized</var> be false.</p></li><!-- For simplicity and consistency, this object cannot be reused after any failure. -->
       <li><p>If <var title="true">sessionId</var> is an empty string, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
-      <li><p>If this object's <var title="true">session type</var> is not "<coderef prefix="sessiontype">persistent</coderef>", return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
-      <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object that created this object.</p></li>
-      <li><p>If the <a href="#cdm">content decryption module</a> corresponding to <var title="true">media keys</var>'s <coderef>keySystem</coderef> attribute does not support loading previous sessions, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
+      <li><p>If this object's <var title="true">session type</var> is not <a def-id="persistent-session"></a>, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
+      <li><p>Let <var title="true">media keys</var> be the <a def-id="mediakeys"></a> object that created this object.</p></li>
+      <li><p>If the <a href="#cdm">content decryption module</a> corresponding to <var title="true">media keys</var>'s <a def-id="keySystem-attribute"></a> attribute does not support loading previous sessions, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code>.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
@@ -562,13 +588,13 @@
           <li><p>Let <var title="true">message</var> be null.</p></li>
           <li><p>Let <var title="true">message type</var> be null.</p></li>
           <li><p>Let <var title="true">origin</var> be the <a def-id="origin"></a> of this object's <a def-id="document-concept"></a>.</p></li>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of <var title="true">media keys</var>.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of <var title="true">media keys</var>.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li><p>If there is no data stored for the <var>sanitized session ID</var> in the <var title="true">origin</var>, resolve <var>promise</var> with <code>false</code>.</p></li><!-- Per https://github.com/w3ctag/promises-guide#rejections-should-be-used-for-exceptional-situations. -->
               <li><p>Let <var title="true">session data</var> be the data stored for the <var>sanitized session ID</var> in the <var title="true">origin</var>.
               This must not include data from other origin(s) or that is not associated with an origin.</p></li>
-              <li><p>If there is an unclosed "<coderef prefix="sessiontype">persistent</coderef>" session in any <a def-id="document-concept"></a> representing the <var title="true">session data</var>, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-QuotaExceededError">"QuotaExceededError"</a></code>.</p>
+              <li><p>If there is an unclosed <a def-id="persistent-session"></a> session in any <a def-id="document-concept"></a> representing the <var title="true">session data</var>, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-QuotaExceededError">"QuotaExceededError"</a></code>.</p>
                 <p class="note">In other words, do not create a session if a non-closed persistent session already exists for this <var>sanitized session ID</var> in any browsing context.</p>
               </li>
               <li><p>Load the <var title="true">session data</var>.</p></li>
@@ -595,10 +621,10 @@
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
 
-    <p>The <methoddfn name="update">update(<var title="true">response</var>)</methoddfn> method provides messages, including licenses, to the CDM. It must run the following steps:</p>
+    <p>The <methoddfn name="update">update(<var title="true">response</var>)</methoddfn> method provides messages, including licenses, to the CDM.</p>
     <p class="note">The contents of <var title="true">response</var> are <var title="true"><a href="#key-system">keySystem</a></var>-specific.</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">callable</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>If <var title="true">response</var> is an empty array, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
       <li><p>Let <var>response copy</var> be a copy of the contents of the <var title="true">response</var> parameter.</p></li>
@@ -613,7 +639,7 @@
             </p>
           </li>
           <li><p>If the previous step failed, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of the <a def-id="mediakeys"></a> object that created this object.</p></li>
           <li><p>Let <var title="true">message</var> be null.</p></li>
           <li><p>Let <var title="true">message type</var> be null.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
@@ -621,9 +647,9 @@
               <li><p>If the format of <var>sanitized response</var> is invalid in any way, reject <var>promise</var> with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
               <li><p>Process <var>sanitized response</var>, following the stipulation for the first matching condition from the following list:</p>
                 <dl class="switch">
-                  <dt>If <var title="true">sessionType</var> is "<coderef prefix="sessiontype">temporary</coderef>" and <var>sanitized response</var> does not specify that session data, including any license, key(s), or similar session data it contains, should be stored</dt>
+                  <dt>If <var title="true">sessionType</var> is <a def-id="temporary-session"></a> and <var>sanitized response</var> does not specify that session data, including any license, key(s), or similar session data it contains, should be stored</dt>
                   <dd>Continue processing <var>sanitized response</var>, not storing any session data.</dd>
-                  <dt>If <var title="true">sessionType</var> is "<coderef prefix="sessiontype">persistent</coderef>"</dt>
+                  <dt>If <var title="true">sessionType</var> is <a def-id="persistent-session"></a></dt>
                   <dd>Continue processing <var>sanitized response</var>, storing the license, key(s), or similar session data contained in <var>sanitized response</var> as permitted or instructed by the license.
                     Such data must be stored such that only the <a def-id="origin"></a> of this object's <a def-id="document-concept"></a> can access it.
                   </dd>
@@ -662,13 +688,13 @@
     <p class="note">The returned promise is resolved when the request has been processed, and the <coderef>closed</coderef> attribute promise is resolved when the session is closed.</p>
     <p>It must run the following steps:</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">callable</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>If the <a href="#algorithms-session-close">Session Close</a> algorithm has been run on this object, return a resolved promise.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of the <a def-id="mediakeys"></a> object that created this object.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li>
@@ -684,17 +710,16 @@
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
 
-    <p>The <methoddfn name="remove">remove()</methoddfn> method allows an application to remove stored session data associated with this object.
-    It must run the following steps:</p>
+    <p>The <methoddfn name="remove">remove()</methoddfn> method allows an application to remove stored session data associated with this object.</p>
 
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">callable</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
-      <li><p>If this object's <var title="true">session type</var> is not "<coderef prefix="sessiontype">persistent</coderef>", return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
+      <li><p>If this object's <var title="true">session type</var> is not <a def-id="persistent-session"></a>, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code>.</p></li>
       <li><p>If the <a href="#algorithms-session-close">Session Close</a> algorithm has been run on this object, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of the <a def-id="mediakeys"></a> object that created this object.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li>
@@ -718,14 +743,14 @@
     </ol>
 
     <p class="issue"><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26372">Bug 26372</a> - getUsableKeyIds() may be replaced.</p>
-    <p>The <methoddfn name="getUsableKeyIds">getUsableKeyIds()</methoddfn> method allows an application to get the key IDs for keys in the session that the CDM <em>knows</em> are currently usable to decrypt <a def-id="media-data"></a>. It must run the following steps:</p>
+    <p>The <methoddfn name="getUsableKeyIds">getUsableKeyIds()</methoddfn> method allows an application to get the key IDs for keys in the session that the CDM <em>knows</em> are currently usable to decrypt <a def-id="media-data"></a>.</p>
     
-    <ol>
+    <ol class="method-algorithm">
       <li><p>If this object's <var title="true">callable</var> value is false, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of the <a def-id="mediakeys"></a> object that created this object.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li><p>Let <var title="true">usable key ids</var> be a list of the key IDs for keys in the session that the CDM <em>knows</em> are currently usable to decrypt <a def-id="media-data"></a>. <var title="true">usable key ids</var> must not contain IDs for keys that <em>may not</em> currently be usable. Each element must be unique.</p></li>
@@ -791,7 +816,7 @@
     <section id="mediakeysession-events" class="informative">
     <h3>Event Summary</h3>
 
-    <p class="note">In some implementations, <coderef>MediaKeySession</coderef> objects may not fire any events until the <coderef>MediaKeys</coderef> object is associated with a media element using <methodref>setMediaKeys</methodref>.</p>
+    <p class="note">In some implementations, <coderef>MediaKeySession</coderef> objects may not fire any events until the <a def-id="mediakeys"></a> object is associated with a media element using <methodref>setMediaKeys</methodref>.</p>
 
     <table class="old-table">
       <thead>
@@ -879,7 +904,7 @@
     <p>The following steps are run:</p>
     <ol>
       <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
-      <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+      <li><p>Let <var title="true">media keys</var> be the <a def-id="mediakeys"></a> object that created this object.</p></li>
       <li><p>Let <var>promise</var> be the <coderef>closed</coderef> attribute of the <var title="true">session</var>.</p></li>
       <li><p>Resolve <var>promise</var>.</p></li>
     </ol>
@@ -942,10 +967,10 @@
     <section id="session-storage">
     <h3>Session Storage and Persistence</h3>
     <p>This section provides an overview of session stroage and persistence that complements the algorithms.</p>
-    <p>If this object's <var title="true">session type</var> is not "<coderef prefix="sessiontype">persistent</coderef>", the user agent and CDM must <em>not</em> persist a record of or data related to the session at any point.
+    <p>If this object's <var title="true">session type</var> is not <a def-id="persistent-session"></a>, the user agent and CDM must <em>not</em> persist a record of or data related to the session at any point.
       This includes license(s), key(s), and the <a href="#session-id">Session ID</a>.
     </p>
-    <p>The remainder of this section applies to "<coderef prefix="sessiontype">persistent</coderef>" sessions, which implementatations may optionally support.</p>
+    <p>The remainder of this section applies to <a def-id="persistent-session"></a> sessions, which implementatations may optionally support.</p>
     <p>Persisted data must always be stored such that only the <a def-id="origin"></a> of this object's <a def-id="document-concept"></a> can access it.
       In addition, the data must only be accessible by the current profile of this user agent - other user agent profiles, user agents, and applications must not be able to access the stored data.
     </p>
@@ -957,7 +982,7 @@
       In other words, <methodref>load</methodref> must fail when there is already a <coderef>MediaKeySession</coderef> representing the session specified by the <var title="true">sessionId</var> parameter, either because the object that created it via <methodref>generateRequest</methodref> is still active or it has been loaded into another object via <methodref>load</methodref>.
       A session may only be loaded again after the <a href="#algorithms-session-close">Session Close</a> algorithm has not been run on the object representing it.
     </p>
-    <p>An application that creates a "<coderef prefix="sessiontype">persistent</coderef>" session should later remove the stored data using <methodref>remove</methodref>.
+    <p>An application that creates a <a def-id="persistent-session"></a> session should later remove the stored data using <methodref>remove</methodref>.
       The CDM may also remove sessions as appropriate, but applications should not rely on this.
     </p>
     <p class="note">See the <a href="#security">Security Considerations</a> and <a href="#privacy">Privacy Considerations</a> sections for additional considerations when supporting persistent storage.</p>
@@ -973,18 +998,18 @@
 partial interface <precodedfn>HTMLMediaElement</precodedfn> {
   // Encrypted Media
   
-  readonly attribute <precoderef>MediaKeys</precoderef>? <precoderef prefix="attr">mediaKeys</precoderef>;
+  readonly attribute <a def-id="mediakeys"></a>? <precoderef prefix="attr">mediaKeys</precoderef>;
   readonly attribute <precoderef>MediaWaitingFor</precoderef> <precoderef>waitingFor</precoderef>;
   attribute <EventHandler/> <precoderef>onencrypted</precoderef>;
 
-  Promise&lt;void&gt; <premethodref>setMediaKeys</premethodref>(<precoderef>MediaKeys</precoderef>? mediaKeys);
+  Promise&lt;void&gt; <premethodref>setMediaKeys</premethodref>(<a def-id="mediakeys"></a>? mediaKeys);
 };
 </pre>
 
     <section id="htmlmediaelement-attributes">
     <h3>Attributes</h3>
 
-    <p>The <codedfn prefix="attr">mediaKeys</codedfn> attribute is the <coderef>MediaKeys</coderef> being used when decrypting encrypted <a def-id="media-data"></a> for this <a href="#htmlmediaelement-extensions">media element</a>.</p>
+    <p>The <codedfn prefix="attr">mediaKeys</codedfn> attribute is the <a def-id="mediakeys"></a> being used when decrypting encrypted <a def-id="media-data"></a> for this <a href="#htmlmediaelement-extensions">media element</a>.</p>
 
     <p>The <codedfn>waitingFor</codedfn> attribute indicates what the media element is waiting for, if anything (indicated by the <a def-id="waiting"></a> and <a def-id="canplay"></a> events). This is described in the <a href="#algorithms-encrypted-block">Encrypted Block Encountered</a> algorithm.</p>
 
@@ -996,9 +1021,9 @@
     <p>For methods that return a promise, all errors are reported asynchronously by rejecting the returned Promise. This includes WebIDL type mapping errors.</p>
     <p>The steps of an algorithm are always aborted when resolving or rejecting a promise.</p>
 
-    <p>The <methoddfn name="setMediaKeys">setMediaKeys(<var title="true">mediaKeys</var></methoddfn>) method provides the <coderef>MediaKeys</coderef> to use when decrypting media data during playback. It must run the following steps:</p>
+    <p>The <methoddfn name="setMediaKeys">setMediaKeys(<var title="true">mediaKeys</var></methoddfn>) method provides the <a def-id="mediakeys"></a> to use when decrypting media data during playback.</p>
     
-    <ol>
+    <ol class="method-algorithm">
       <!-- For simplicity and consistency, do not allow multiple pending calls. -->
       <li><p>If <var>mediaKeys</var> and the <coderef prefix="attr">mediaKeys</coderef> attribute are the same object, return a resolved promise.</p></li>
       <li><p>If this object's <var title="true">attaching media keys</var> value is true, return a promise rejected with <a def-id="new-domexception-named"></a> <code><a href="#dfn-InvalidStateError">"InvalidStateError"</a></code>.</p></li>
@@ -1041,7 +1066,7 @@
       <li><p>Return <var>promise</var>.</p></li>
     </ol>
     
-    <p class="note">Support for clearing or replacing the associated <coderef>MediaKeys</coderef> object during playback is a quality of implementation issue. In many cases it will result in a bad user experience or rejected promise.</p>
+    <p class="note">Support for clearing or replacing the associated <a def-id="mediakeys"></a> object during playback is a quality of implementation issue. In many cases it will result in a bad user experience or rejected promise.</p>
     <p class="note">As a best practice, applications should create a MediaKeys object and call <methodref>setMediaKeys</methodref> before providing <a def-id="media-data"></a> (for example, setting the <a def-id="media-src"></a> attribute). This avoids potential delays in some implementations.</p>
     </section>
 
@@ -1149,8 +1174,8 @@
     <ol>
       <li><p>If the media element's <coderef prefix="attr">mediaKeys</coderef> attribute is not null, run the following steps:</p>
         <ol>
-          <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object referenced by that atribute.</p></li>
-          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a href="#dom-create">initialization</a> of the <var title="true">media keys</var>.</p></li>
+          <li><p>Let <var title="true">media keys</var> be the <a def-id="mediakeys"></a> object referenced by that atribute.</p></li>
+          <li><p>Let <var title="true">cdm</var> be the CDM loaded during the <a def-id="mediakeys-initialization">initialization</a> of the <var title="true">media keys</var>.</p></li>
           <li><p>If there is at least one <coderef>MediaKeySession</coderef> created by the <var title="true">media keys</var> on which the <a href="#algorithms-session-close">Session Close</a> algorithm has not been run, run the following steps:</p>
             <p class="note">This check ensures the <var title="true">cdm</var> has finished loading and is a prequisite for a matching key being available.</p>
             <ol>
@@ -1307,10 +1332,10 @@
     <h4>Capabilities</h4>
     <p>The following describe how Clear Key supports key system-specific capabilities:</p>
     <ul>
-      <li><p>The <methodref>setMediaKeys</methodref> method: Implementations may support associating the <coderef>MediaKeys</coderef> object with more than one <coderef>HTMLMediaElement</coderef>.</p></li>
-      <li><p>The <methodref>setServerCertificate</methodref> method: Not supported.</p></li>
-      <li><p>The <methodref>isTypeSupported</methodref> method: There are no supported <var title="true">capability</var> values.</p></li>
-      <li><p>The "<coderef prefix="sessiontype">persistent</coderef>" <coderef>SessionType</coderef>: Implementations may support this type.</p></li>
+      <li><p>The <methodref>setMediaKeys</methodref> method: Implementations may support associating the <a def-id="mediakeys"></a> object with more than one <coderef>HTMLMediaElement</coderef>.</p></li>
+      <li><p>The <a def-id="setServerCertificate"></a> method: Not supported.</p></li>
+      <li><p>The <a def-id="isTypeSupported"></a> method: There are no supported <var title="true">capability</var> values.</p></li>
+      <li><p>The <a def-id="persistent-session"></a> <a def-id="sessiontype"></a>: Implementations may support this type.</p></li>
     </ul>
     </section>
 
@@ -1349,7 +1374,7 @@
       <dt>"kids"</dt>
       <dd>An array of <a href="#decryption-key-id">key IDs</a>. Each element of the array is the base64url encoding of the octet sequence containing the key ID value.</dd>
       <dt>"type"</dt>
-      <dd>The requested <coderef>SessionType</coderef></dd>
+      <dd>The requested <a def-id="sessiontype"></a></dd>
     </dl>
 
     <p>When contained in the ArrayBuffer <a def-id="message-event-message-attribute"></a> attribute of a <a def-id="MediaKeyMessageEvent"></a> object, the JSON string is encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
@@ -1366,7 +1391,7 @@
      "67ef0gd8pvfd0",
      "77ef0gd8pvfd0"
     ],
-  "type":"<precoderef prefix="sessiontype">temporary</precoderef>"
+  "type":<a def-id="temporary-session"></a>
 }
 </pre>
     </section>
@@ -1390,8 +1415,8 @@
       <dd>The base64url encoding of the octet sequence containing the <a href="#decryption-key-id">key ID</a> value</dd>
     </dl>
 
-    <p>The JSON object may have an optional "type" member value, which may be any of the <coderef>SessionType</coderef> values.
-      If not specified, the default value of "<coderef prefix="sessiontype">temporary</coderef>" is used.
+    <p>The JSON object may have an optional "type" member value, which may be any of the <a def-id="sessiontype"></a> values.
+      If not specified, the default value of <a def-id="temporary-session"></a> is used.
       The <methodref>update</methodref> algorithm compares this value to the <var title="true">sessionType</var>.
     </p>
 
@@ -1411,7 +1436,7 @@
       "k":"GawgguFyGrWKav7AX4VKUg"
       "kid":"67ef0gd8pvfd0",
     }],
-  "type":"<precoderef prefix="sessiontype">temporary</precoderef>"
+  "type":<a def-id="temporary-session"></a>
 }</pre>
     </section>
     </section>
@@ -1602,7 +1627,7 @@
     var video = document.getElementById("video");
 
     if (!video.<precoderef prefix="attr">mediaKeys</precoderef>) {
-      var promise = <precoderef>MediaKeys</precoderef>.<premethodref>create</premethodref>("org.w3.clearkey");
+      var promise = <a def-id="mediakeys"></a>.<a def-id="mediakeys-create-call"></a>("org.w3.clearkey");
       promise.catch(
         console.error.bind(console, "Unable to create MediaKeys")
       );
@@ -1616,7 +1641,7 @@
       promise.then(
         function(createdMediaKeys) {
           var initData = new Uint8Array([ ... ]);
-          var keySession = createdMediaKeys.<premethodref>createSession</premethodref>();
+          var keySession = createdMediaKeys.<a def-id="createSession-call"></a>();
           keySession.addEventListener("<a def-id="message"></a>", handleMessage, false);
           return keySession.<premethodref>generateRequest</premethodref>("webm", initData);
         }
@@ -1644,7 +1669,7 @@
 
     <section id="example-selecting-key-system">
     <h3>Selecting a Supported Key System and Using Initialization Data from the <a def-id="encrypted"></a> Event</h3>
-    <p class="exampledescription">This example selects a supported <a href="#key-system">Key System</a> using the <methodref>isTypeSupported</methodref> method then uses
+    <p class="exampledescription">This example selects a supported <a href="#key-system">Key System</a> using the <a def-id="isTypeSupported"></a> method then uses
     the <a href="#initialization-data">Initialization Data</a> from the <a def-id="media-data"></a> to generate the license request and send it to the appropriate license server.
     One of the supported key systems uses a serverCertificate, which is provided proactively.
     </p>
@@ -1656,11 +1681,11 @@
   var serverCertificate;
 
   function selectKeySystem() {
-    if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.example.somesystem", "webm", "video/webm; codecs='vp8, vorbis'")) {
+    if (<a def-id="mediakeys"></a>.<a def-id="isTypeSupported-call"></a>("com.example.somesystem", "webm", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.example.com/getkey"; // OR "https://example.&lt;My Video Site domain&gt;"
       keySystem = "com.example.somesystem";
       serverCertificate = new Uint8Array([ ... ]);
-    } else if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.foobar", "webm", "video/webm; codecs='vp8, vorbis'")) {
+    } else if (<a def-id="mediakeys"></a>.<a def-id="isTypeSupported-call"></a>("com.foobar", "webm", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.foobar.com/request";
       keySystem = "com.foobar";
     } else {
@@ -1674,12 +1699,12 @@
       selectKeySystem();
       video.mediaKeysObject = null; // Prevent entering this path again.
       video.pendingSessionData = []; // Will store all initData until the MediaKeys is ready.
-      <precoderef>MediaKeys</precoderef>.<premethodref>create</premethodref>(keySystem).then(
+      <a def-id="mediakeys"></a>.<a def-id="mediakeys-create-call"></a>(keySystem).then(
         function(createdMediaKeys) {
           video.mediaKeysObject = createdMediaKeys;
 
           if (serverCertificate)
-            createdMediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
+            createdMediaKeys.<a def-id="setServerCertificate-call"></a>(serverCertificate);
 
           for (var i = 0; i &lt; video.pendingSessionData.length; i++) {
             var data = video.pendingSessionData[i];
@@ -1705,7 +1730,7 @@
   }
 
   function makeNewRequest(mediaKeys, initDataType, initData) {
-    var keySession = mediaKeys.<premethodref>createSession</premethodref>();
+    var keySession = mediaKeys.<a def-id="createSession-call"></a>();
     keySession.addEventListener("<a def-id="message"></a>", licenseRequestReady, false);
     keySession.<premethodref>generateRequest</premethodref>(initDataType, initData).catch(
       console.error.bind(console, "Unable to create or initialize key session")
@@ -1758,13 +1783,13 @@
   }
 
   selectKeySystem();
-  <precoderef>MediaKeys</precoderef>.<premethodref>create</premethodref>(keySystem).then(
+  <a def-id="mediakeys"></a>.<a def-id="mediakeys-create-call"></a>(keySystem).then(
     function(createdMediaKeys) {
       mediaKeys = createdMediaKeys;
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
+        mediaKeys.<a def-id="setServerCertificate-call"></a>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(
@@ -1795,7 +1820,7 @@
 
   // This replaces the implementation in the previous example.
   function makeNewRequest(mediaKeys, initDataType, initData) {
-    var keySession = mediaKeys.<premethodref>createSession</premethodref>();
+    var keySession = mediaKeys.<a def-id="createSession-call"></a>();
     keySession.addEventListener("<a def-id="message"></a>", handleMessage, false);
     keySession.addEventListener("<a def-id="keyschange"></a>", handleKeysChange, false);
     keySession.<precoderef>closed</precoderef>.then(
@@ -1850,13 +1875,13 @@
   }
 
   selectKeySystem();
-  <precoderef>MediaKeys</precoderef>.<premethodref>create</premethodref>(keySystem).then(
+  <a def-id="mediakeys"></a>.<a def-id="mediakeys-create-call"></a>(keySystem).then(
     function(createdMediaKeys) {
       mediaKeys = createdMediaKeys;
       var video = document.getElementById("v");
       video.src = "foo.webm";
       if (serverCertificate)
-        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
+        mediaKeys.<a def-id="setServerCertificate-call"></a>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(
@@ -1887,7 +1912,7 @@
 
   // Called if the application does not have a stored sessionId for the media resource.
   function makeNewRequest(mediaKeys, initDataType, initData) {
-    var keySession = mediaKeys.<premethodref>createSession</premethodref>("persistent");
+    var keySession = mediaKeys.<a def-id="createSession-call"></a>("persistent");
     keySession.addEventListener("<a def-id="message"></a>", handleMessage, false);
     keySession.<precoderef>closed</precoderef>.then(
       function() {
@@ -1905,7 +1930,7 @@
 
   // Called if the application has a stored sessionId for the media resource.
   function loadStoredSession(mediaKeys, sessionId) {
-    var keySession = mediaKeys.<premethodref>createSession</premethodref>("persistent");
+    var keySession = mediaKeys.<a def-id="createSession-call"></a>("persistent");
     keySession.addEventListener("<a def-id="message"></a>", handleMessage, false);
     keySession.<precoderef>closed</precoderef>.then(
       console.log.bind(console, "Session closed")
@@ -1956,12 +1981,12 @@
   }
 
   selectKeySystem();
-  <precoderef>MediaKeys</precoderef>.<premethodref>create</premethodref>(keySystem).then(
+  <a def-id="mediakeys"></a>.<a def-id="mediakeys-create-call"></a>(keySystem).then(
     function(createdMediaKeys) {
       mediaKeys = createdMediaKeys;
       var video = document.getElementById("v");
       if (serverCertificate)
-        mediaKeys.<premethodref>setServerCertificate</premethodref>(serverCertificate);
+        mediaKeys.<a def-id="setServerCertificate-call"></a>(serverCertificate);
       return video.<premethodref>setMediaKeys</premethodref>(mediaKeys);
     }
   ).catch(
--- a/encrypted-media/encrypted-media.js	Fri Oct 10 14:42:59 2014 -0700
+++ b/encrypted-media/encrypted-media.js	Fri Oct 10 14:43:23 2014 -0700
@@ -141,6 +141,26 @@
   var emeDefinitions = {
     'eme-spec': { func: link_helper, fragment: '#', link_text: 'Encrypted Media Extensions', },
 
+    'sessiontype': { func: idlref_helper, fragment: 'idl-def-SessionType', link_text: 'SessionType',  },
+    'persistent-session': { func: idlref_helper, fragment: 'idl-def-SessionType.persistent', link_text: '"persistent"',  },
+    'temporary-session': { func: idlref_helper, fragment: 'idl-def-SessionType.temporary', link_text: '"temporary"',  },
+
+    'IsTypeSupportedResult-empty': { func: idlref_helper, fragment: 'idl-def-IsTypeSupportedResult.empty-string', link_text: '""',  },
+    'IsTypeSupportedResult-maybe': { func: idlref_helper, fragment: 'idl-def-IsTypeSupportedResult.maybe', link_text: '"maybe"',  },
+    'IsTypeSupportedResult-probably': { func: idlref_helper, fragment: 'idl-def-IsTypeSupportedResult.probably', link_text: '"probably"',  },
+
+    'mediakeys': { func: idlref_helper, fragment: 'idl-def-MediaKeys', link_text: 'MediaKeys',  },
+    'keySystem-attribute': { func: idlref_helper, fragment: 'widl-MediaKeys-keySystem', link_text: 'keySystem',  },
+    'mediakeys-create': { func: idlref_helper, fragment: 'widl-MediaKeys-create-Promise-MediaKeys--DOMString-keySystem', link_text: 'create()',  },
+    'mediakeys-create-call': { func: idlref_helper, fragment: 'widl-MediaKeys-create-Promise-MediaKeys--DOMString-keySystem', link_text: 'create',  },
+    'createSession': { func: idlref_helper, fragment: 'widl-MediaKeys-createSession-MediaKeySession-SessionType-sessionType', link_text: 'createSession()',  },
+    'createSession-call': { func: idlref_helper, fragment: 'widl-MediaKeys-createSession-MediaKeySession-SessionType-sessionType', link_text: 'createSession',  },
+    'setServerCertificate': { func: idlref_helper, fragment: 'widl-MediaKeys-setServerCertificate-Promise-void--ArrayBuffer-ArrayBufferView-serverCertificate', link_text: 'setServerCertificate()',  },
+    'setServerCertificate-call': { func: idlref_helper, fragment: 'widl-MediaKeys-setServerCertificate-Promise-void--ArrayBuffer-ArrayBufferView-serverCertificate', link_text: 'setServerCertificate',  },
+    'isTypeSupported': { func: idlref_helper, fragment: 'widl-MediaKeys-isTypeSupported-IsTypeSupportedResult-DOMstring-keySystem-DOMString-initDataType-DOMString-contentType-DOMString-capability', link_text: 'isTypeSupported()',  },
+    'isTypeSupported-call': { func: idlref_helper, fragment: 'widl-MediaKeys-isTypeSupported-IsTypeSupportedResult-DOMstring-keySystem-DOMString-initDataType-DOMString-contentType-DOMString-capability', link_text: 'isTypeSupported',  },
+    'mediakeys-initialization': { func: term_helper, fragment: 'widl-MediaKeys-create-Promise-MediaKeys--DOMString-keySystem', link_text: ''  },
+
     'keyschange': { func: eventref_helper, fragment: 'keyschange', link_text: 'keyschange',  },
     'message': { func: eventref_helper, fragment: 'message', link_text: 'message',  },
     'encrypted': { func: eventref_helper, fragment: 'encrypted', link_text: 'encrypted',  },