[EME] Bug 24904 - Uint8Array parameters should not be modifiable after method calls return
authorDavid Dorwin <ddorwin@google.com>
Fri, 02 May 2014 13:04:22 -0700
changeset 299 af33cfce6d49
parent 298 29f17705b5c2
child 300 d862295726f3
[EME] Bug 24904 - Uint8Array parameters should not be modifiable after method calls return
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Tue Apr 29 14:12:11 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Fri May 02 13:04:22 2014 -0700
@@ -98,7 +98,7 @@
     <div class="head">
       <p><a href="http://www.w3.org/"><img src="https://www.w3.org/Icons/w3c_home" alt="W3C" width="72" height="48"></a></p>
       <h1>Encrypted Media Extensions</h1>
-      <h2 id="draft-date">W3C Editor's Draft 29 April 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 2 May 2014</h2>
       <dl>
         <dt>This Version:</dt>
         <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html">http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html</a></dd>
@@ -466,13 +466,14 @@
       <li><p>If <var title="true">initData</var> is an empty array, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is<code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The initData parameter is empty."</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 <a href="#cdm">content decryption module</a> corresponding to the <code><a href="#dom-keysystem">keySystem</a></code>, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "The initialization data type <var title="true">initDataType</var> is not supported by the key system." String comparison is case-sensitive.</p></li>
       <li><p>If <var title="true">sessionType</var> is not supported by the <a href="#cdm">content decryption module</a> corresponding to the <code><a href="#dom-keysystem">keySystem</a></code>, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "<var title="true">sessionType</var> sessions are not supported by the key system."</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>promise</var> be a new promise.</p></li>
       <li>
 <p>Run the following steps asynchronously:</p>
         <ol>
           <li>
-<p>If the <var title="true">list of active session Initialization Data</var> for this object includes an entry for the <var title="true">initDataType</var>-<var title="true">initData</var> pair, resolve <var>promise</var> with <code>null</code>.</p>
-            <p class="non-normative">In other words, do not create a session if a non-closed session already exists for this <var title="true">initData</var>.</p>
+<p>If the <var title="true">list of active session Initialization Data</var> for this object includes an entry for the <var title="true">initDataType</var>-<var>init data</var> pair, resolve <var>promise</var> with <code>null</code>.</p>
+            <p class="non-normative">In other words, do not create a session if a non-closed session already exists for this <var>init data</var>.</p>
           </li>
           <li><p>Let <var title="true">request</var> be null.</p></li>
           <li><p>Let <var title="true">default URL</var> be null.</p></li>
@@ -480,15 +481,15 @@
           <li>
 <p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
-              <li><p>Process the <var title="true">initData</var>, interpreting it per <var title="true">initDataType</var>.</p></li>
+              <li><p>Process the <var>init data</var>, interpreting it per <var title="true">initDataType</var>.</p></li>
               <li>
-<p>Let <var title="true">request</var> be a request <span class="non-normative">(e.g. a license request)</span> generated by the <a href="#cdm">CDM</a> using the <var title="true">initData</var> and <var title="true">sessionType</var>.</p>
+<p>Let <var title="true">request</var> be a request <span class="non-normative">(e.g. a license request)</span> generated by the <a href="#cdm">CDM</a> using the <var>init data</var> and <var title="true">sessionType</var>.</p>
                 <p>If <var title="true">sessionType</var> is "<code><a href="#dom-sessiontypetemporary">temporary</a></code>", the request is for a temporary non-persisted license.
                 If <var title="true">sessionType</var> is "<code><a href="#dom-sessiontypepersistent">persistent</a></code>", the request is for a persistable license.</p>
                 <p class="non-normative">Note: The license server may reject the requested type. It should not issue a different type.</p>
-                <p><var title="true">cdm</var> must not use any stream-specific data, including <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-data">media data</a>, not provided via the <var title="true">initData</var>.</p>
+                <p><var title="true">cdm</var> must not use any stream-specific data, including <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-data">media data</a>, not provided via the <var>init data</var>.</p>
               </li>
-              <li><p>If the <var title="true">initData</var> indicates a default URL relevant to <var title="true">keySystem</var>, let <var title="true">default URL</var> be that URL.</p></li>
+              <li><p>If the <var>init data</var> indicates a default URL relevant to <var title="true">keySystem</var>, let <var title="true">default URL</var> be that URL.</p></li>
             </ol>
           </li>
           <li><p>Let the <var title="true">session ID</var> be a unique <a href="#session-id">Session ID</a> string. <span class="non-normative">It may be obtained from <var title="true">cdm</var>.</span></p></li>
@@ -499,12 +500,12 @@
               <li><p>Set the <code><a href="#dom-sessionkeysystem">keySystem</a></code> attribute to the value of the <code><a href="#dom-mediakeys">MediaKeys</a></code> object's <code><a href="#dom-keysystem">keySystem</a></code> attribute.</p></li>
               <li><p>Set the <code><a href="#dom-sessionid">sessionId</a></code> attribute to <var title="true">session ID</var>.</p></li>
               <li><p>Let the session type be <var title="true">sessionType</var>.</p></li>
-              <li><p>Let the session initData be the <var title="true">initDataType</var>-<var title="true">initData</var> pair.</p></li>
+              <li><p>Let the session initData be the <var title="true">initDataType</var>-<var>init data</var> pair.</p></li>
             </ol>
           </li>
           <li><p>If any of the preceding steps failed, reject <var>promise</var> with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is the appropriate <a href="#mediakeyerror-names">error name</a> and that has an appropriate message.</p></li>
           <li><p>Run the <a href="#algorithms-queue-message">Queue a "message" Event</a> algorithm on the <var title="true">session</var>, providing <var title="true">request</var> and <var title="true">default URL</var>.</p></li>
-          <li><p>Add an entry for the <var title="true">initDataType</var>-<var title="true">initData</var> pair to the <var title="true">list of active session Initialization Data</var> for this object.</p></li>
+          <li><p>Add an entry for the <var title="true">initDataType</var>-<var>init data</var> pair to the <var title="true">list of active session Initialization Data</var> for this object.</p></li>
           <li><p>Resolve <var>promise</var> with <var title="true">session</var>.</p></li>
         </ol>
       </li>
@@ -568,12 +569,13 @@
     <ol>
       <li><p>If <var title="true">serverCertificate</var> is an empty array, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The serverCertificate parameter is empty."</p></li>
       <li><p>If the <code><a href="#dom-keysystem">keySystem</a></code> does not support server certificates, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "The operation is not supported by the key system."</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> loaded in <code><a href="#dom-create">create()</a></code>.</p></li>
-          <li><p>Use the <var title="true">cdm</var> to process <var title="true">serverCertificate</var>.</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 new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is the appropriate <a href="#mediakeyerror-names">error name</a> and that has an appropriate message.</p></li>
           <li><p>Resolve <var>promise</var> with <code>undefined</code>.</p></li>
         </ol>
@@ -694,6 +696,7 @@
 
     <ol>
       <li><p>If <var title="true">response</var> is an empty array, return a promise rejected with a new <code><a href="http://www.w3.org/TR/dom/#exception-domexception">DOMException</a></code> whose name is <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The response parameter is empty."</p></li>
+      <li><p>Let <var>message</var> be a copy of the contents of the <var title="true">response</var> parameter.</p></li>
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li>
 <p>Run the following steps asynchronously:</p>
@@ -705,17 +708,17 @@
 <p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
               <li>
-<p>Process <var title="true">response</var></p>
-                <p>If <var title="true">response</var> contains keys, a license, or similar data, follow the stipulation for the first matching condition from the following list:</p>
+<p>Process <var>message</var></p>
+                <p>If <var>message</var> contains keys, a license, or similar data, follow the stipulation for the first matching condition from the following list:</p>
                 <dl class="switch">
                   <dt>If <var title="true">sessionType</var> is "<code><a href="#dom-sessiontypetemporary">temporary</a></code>" and the license does not specify it should be stored</dt>
-                  <dd>Do not store the license or other data contained in <var title="true">response</var>.</dd>
+                  <dd>Do not store the license or other data contained in <var>message</var>.</dd>
                   <dt>If <var title="true">sessionType</var> is "<code><a href="#dom-sessiontypepersistent">persistent</a></code>" and the license permits storage</dt>
-                  <dd>Store the license or other data contained in <var title="true">response</var>.</dd>
+                  <dd>Store the license or other data contained in <var>message</var>.</dd>
                   <dt>Otherwise</dt>
                   <dd>Fail with an appropriate <a href="#mediakeyerror-names">error name</a> and message.</dd>
                 </dl>
-                <p class="non-normative">Note: When <var title="true">response</var> contains key(s) and/or related data, <var title="true">cdm</var> will likely cache the key and related data indexed by key ID.</p>
+                <p class="non-normative">Note: When <var>message</var> contains key(s) and/or related data, <var title="true">cdm</var> will likely cache the key and related data indexed by key ID.</p>
                 <p class="non-normative">Note: The replacement algorithm within a session is <a href="#key-system">Key System</a>-dependent.</p>
                 <p class="non-normative">Note: Keys from different sessions should be cached independently such that closing one session does not affect keys in other sessions, even if they have overlapping key IDs.</p>
                 <p class="non-normative">Note: It is recommended that CDMs support a standard and reasonably high minimum number of keys per <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object, including a standard replacement algorithm, and a standard and reasonably high minimum number of <code><a href="#dom-mediakeysession">MediaKeySession</a></code> objects.
--- a/encrypted-media/encrypted-media.xml	Tue Apr 29 14:12:11 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Fri May 02 13:04:22 2014 -0700
@@ -97,7 +97,7 @@
     <div class="head">
       <p><a href="http://www.w3.org/"><img src="https://www.w3.org/Icons/w3c_home" alt="W3C" width="72" height="48" /></a></p>
       <h1>Encrypted Media Extensions</h1>
-      <h2 id="draft-date">W3C Editor's Draft 29 April 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 2 May 2014</h2>
       <dl>
         <dt>This Version:</dt>
         <dd><a href="http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html">http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html</a></dd>
@@ -453,25 +453,26 @@
       <li><p>If <var title="true">initData</var> is an empty array, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is<code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The initData parameter is empty."</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 <a href="#cdm">content decryption module</a> corresponding to the <coderef>keySystem</coderef>, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "The initialization data type <var title="true">initDataType</var> is not supported by the key system." String comparison is case-sensitive.</p></li>
       <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>, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "<var title="true">sessionType</var> sessions are not supported by the key system."</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>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
-          <li><p>If the <var title="true">list of active session Initialization Data</var> for this object includes an entry for the <var title="true">initDataType</var>-<var title="true">initData</var> pair, resolve <var>promise</var> with <code>null</code>.</p>
-            <p class="non-normative">In other words, do not create a session if a non-closed session already exists for this <var title="true">initData</var>.</p>
+          <li><p>If the <var title="true">list of active session Initialization Data</var> for this object includes an entry for the <var title="true">initDataType</var>-<var>init data</var> pair, resolve <var>promise</var> with <code>null</code>.</p>
+            <p class="non-normative">In other words, do not create a session if a non-closed session already exists for this <var>init data</var>.</p>
           </li>
           <li><p>Let <var title="true">request</var> be null.</p></li>
           <li><p>Let <var title="true">default URL</var> be null.</p></li>
           <li><p>Let <var title="true">cdm</var> be the <var title="true">cdm</var> loaded in <methodref>create</methodref>.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
-              <li><p>Process the <var title="true">initData</var>, interpreting it per <var title="true">initDataType</var>.</p></li>
-              <li><p>Let <var title="true">request</var> be a request <span class="non-normative">(e.g. a license request)</span> generated by the <a href="#cdm">CDM</a> using the <var title="true">initData</var> and <var title="true">sessionType</var>.</p>
+              <li><p>Process the <var>init data</var>, interpreting it per <var title="true">initDataType</var>.</p></li>
+              <li><p>Let <var title="true">request</var> be a request <span class="non-normative">(e.g. a license request)</span> generated by the <a href="#cdm">CDM</a> using the <var>init data</var> and <var title="true">sessionType</var>.</p>
                 <p>If <var title="true">sessionType</var> is "<coderef prefix="sessiontype">temporary</coderef>", the request is for a temporary non-persisted license.
                 If <var title="true">sessionType</var> is "<coderef prefix="sessiontype">persistent</coderef>", the request is for a persistable license.</p>
                 <p class="non-normative">Note: The license server may reject the requested type. It should not issue a different type.</p>
-                <p><var title="true">cdm</var> must not use any stream-specific data, including <videoanchor name="media-data">media data</videoanchor>, not provided via the <var title="true">initData</var>.</p>
+                <p><var title="true">cdm</var> must not use any stream-specific data, including <videoanchor name="media-data">media data</videoanchor>, not provided via the <var>init data</var>.</p>
               </li>
-              <li><p>If the <var title="true">initData</var> indicates a default URL relevant to <var title="true">keySystem</var>, let <var title="true">default URL</var> be that URL.</p></li>
+              <li><p>If the <var>init data</var> indicates a default URL relevant to <var title="true">keySystem</var>, let <var title="true">default URL</var> be that URL.</p></li>
             </ol>
           </li>
           <li><p>Let the <var title="true">session ID</var> be a unique <a href="#session-id">Session ID</a> string. <span class="non-normative">It may be obtained from <var title="true">cdm</var>.</span></p></li>
@@ -481,12 +482,12 @@
               <li><p>Set the <coderef prefix="session">keySystem</coderef> attribute to the value of the <coderef>MediaKeys</coderef> object's <coderef>keySystem</coderef> attribute.</p></li>
               <li><p>Set the <coderef>sessionId</coderef> attribute to <var title="true">session ID</var>.</p></li>
               <li><p>Let the session type be <var title="true">sessionType</var>.</p></li>
-              <li><p>Let the session initData be the <var title="true">initDataType</var>-<var title="true">initData</var> pair.</p></li>
+              <li><p>Let the session initData be the <var title="true">initDataType</var>-<var>init data</var> pair.</p></li>
             </ol>
           </li>
           <li><p>If any of the preceding steps failed, reject <var>promise</var> with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is the appropriate <a href="#mediakeyerror-names">error name</a> and that has an appropriate message.</p></li>
           <li><p>Run the <a href="#algorithms-queue-message">Queue a "message" Event</a> algorithm on the <var title="true">session</var>, providing <var title="true">request</var> and <var title="true">default URL</var>.</p></li>
-          <li><p>Add an entry for the <var title="true">initDataType</var>-<var title="true">initData</var> pair to the <var title="true">list of active session Initialization Data</var> for this object.</p></li>
+          <li><p>Add an entry for the <var title="true">initDataType</var>-<var>init data</var> pair to the <var title="true">list of active session Initialization Data</var> for this object.</p></li>
           <li><p>Resolve <var>promise</var> with <var title="true">session</var>.</p></li>
         </ol>
       </li>
@@ -546,11 +547,12 @@
     <ol>
       <li><p>If <var title="true">serverCertificate</var> is an empty array, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The serverCertificate parameter is empty."</p></li>
       <li><p>If the <coderef>keySystem</coderef> does not support server certificates, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is <code><a href="#dfn-NotSupportedError">"NotSupportedError"</a></code> and that has the message "The operation is not supported by the key system."</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> loaded in <methodref>create</methodref>.</p></li>
-          <li><p>Use the <var title="true">cdm</var> to process <var title="true">serverCertificate</var>.</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 new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is the appropriate <a href="#mediakeyerror-names">error name</a> and that has an appropriate message.</p></li>
           <li><p>Resolve <var>promise</var> with <code>undefined</code>.</p></li>
         </ol>
@@ -657,6 +659,7 @@
 
     <ol>
       <li><p>If <var title="true">response</var> is an empty array, return a promise rejected with a new <code><dom4ref name="exception-domexception">DOMException</dom4ref></code> whose name is <code><a href="#dfn-InvalidAccessError">"InvalidAccessError"</a></code> and that has the message "The response parameter is empty."</p></li>
+      <li><p>Let <var>message</var> be a copy of the contents of the <var title="true">response</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>
@@ -665,17 +668,17 @@
           <li><p>Let <var title="true">destination URL</var> be null.</p></li>
           <li><p>Use the <var title="true">cdm</var> to execute the following steps:</p>
             <ol>
-              <li><p>Process <var title="true">response</var></p>
-                <p>If <var title="true">response</var> contains keys, a license, or similar data, follow the stipulation for the first matching condition from the following list:</p>
+              <li><p>Process <var>message</var></p>
+                <p>If <var>message</var> contains keys, a license, or similar data, follow 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 the license does not specify it should be stored</dt>
-                  <dd>Do not store the license or other data contained in <var title="true">response</var>.</dd>
+                  <dd>Do not store the license or other data contained in <var>message</var>.</dd>
                   <dt>If <var title="true">sessionType</var> is "<coderef prefix="sessiontype">persistent</coderef>" and the license permits storage</dt>
-                  <dd>Store the license or other data contained in <var title="true">response</var>.</dd>
+                  <dd>Store the license or other data contained in <var>message</var>.</dd>
                   <dt>Otherwise</dt>
                   <dd>Fail with an appropriate <a href="#mediakeyerror-names">error name</a> and message.</dd>
                 </dl>
-                <p class="non-normative">Note: When <var title="true">response</var> contains key(s) and/or related data, <var title="true">cdm</var> will likely cache the key and related data indexed by key ID.</p>
+                <p class="non-normative">Note: When <var>message</var> contains key(s) and/or related data, <var title="true">cdm</var> will likely cache the key and related data indexed by key ID.</p>
                 <p class="non-normative">Note: The replacement algorithm within a session is <a href="#key-system">Key System</a>-dependent.</p>
                 <p class="non-normative">Note: Keys from different sessions should be cached independently such that closing one session does not affect keys in other sessions, even if they have overlapping key IDs.</p>
                 <p class="non-normative">Note: It is recommended that CDMs support a standard and reasonably high minimum number of keys per <coderef>MediaKeySession</coderef> object, including a standard replacement algorithm, and a standard and reasonably high minimum number of <coderef>MediaKeySession</coderef> objects.