Bug 25966 - convert Uint8Array to ArrayBuffer or ArrayBufferView as appropriate
authorMark Watson <watsonm@netflix.com>
Tue, 24 Jun 2014 13:31:00 -0700
changeset 352 b8e333b8510c
parent 351 0505b9684488
child 353 a0f72cc27b6d
Bug 25966 - convert Uint8Array to ArrayBuffer or ArrayBufferView as appropriate
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Fri Jun 20 10:16:25 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Tue Jun 24 13:31:00 2014 -0700
@@ -349,9 +349,9 @@
 interface <dfn id="dom-mediakeys">MediaKeys</dfn> {
   readonly attribute DOMString <a href="#dom-keysystem">keySystem</a>;
 
-  Promise&lt;<a href="#dom-mediakeysession">MediaKeySession</a>&gt; <a href="#dom-createsession">createSession</a>(DOMString <a href="#initialization-data-type">initDataType</a>, Uint8Array initData, optional <a href="#dom-sessiontype">SessionType</a> sessionType = "<a href="#dom-sessiontypetemporary">temporary</a>");
+  Promise&lt;<a href="#dom-mediakeysession">MediaKeySession</a>&gt; <a href="#dom-createsession">createSession</a>(DOMString <a href="#initialization-data-type">initDataType</a>, (ArrayBuffer or ArrayBufferView) initData, optional <a href="#dom-sessiontype">SessionType</a> sessionType = "<a href="#dom-sessiontypetemporary">temporary</a>");
   Promise&lt;<a href="#dom-mediakeysession">MediaKeySession</a>&gt; <a href="#dom-loadsession">loadSession</a>(DOMString sessionId);
-  Promise&lt;any&gt; <a href="#dom-setservercertificate">setServerCertificate</a>(Uint8Array serverCertificate);
+  Promise&lt;any&gt; <a href="#dom-setservercertificate">setServerCertificate</a>((ArrayBuffer or ArrayBufferView) serverCertificate);
 
   static Promise&lt;<a href="#dom-mediakeys">MediaKeys</a>&gt; <a href="#dom-create">create</a>(DOMString <a href="#key-system">keySystem</a>)
   static <a href="#dom-istypesupportedresult">IsTypeSupportedResult</a> <a href="#dom-istypesupported">isTypeSupported</a>(DOMstring <a href="#key-system">keySystem</a>, optional DOMString <a href="#initialization-data-type">initDataType</a>, optional DOMString contentType, optional DOMString capability);
@@ -367,12 +367,12 @@
 <div class="issue-title"><span>Issue 7</span></div>
 <p class=""><a href="#dom-usablekeyids">usableKeyIds</a> is not WebIDL-compliant. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=25594">Bug 25594</a>.</p>
 </div>
-  readonly attribute Array&lt;Uint8Array&gt; <a href="#dom-usablekeyids">usableKeyIds</a>;
+  readonly attribute Array&lt;ArrayBuffer&gt; <a href="#dom-usablekeyids">usableKeyIds</a>;
   readonly attribute Date <a href="#dom-expiration">expiration</a>;
   readonly attribute Promise&lt;any&gt; <a href="#dom-closed">closed</a>;
 
   // session operations
-  Promise&lt;any&gt; <a href="#dom-update">update</a>(Uint8Array response);
+  Promise&lt;any&gt; <a href="#dom-update">update</a>((ArrayBuffer or ArrayBufferView) response);
   Promise&lt;any&gt; <a href="#dom-close">close</a>();
   Promise&lt;any&gt; <a href="#dom-remove">remove</a>();
 };
@@ -973,24 +973,24 @@
 [Constructor(DOMString type, optional <a href="#dom-mediakeyneededeventinit">MediaKeyNeededEventInit</a> eventInitDict)]
 interface <dfn id="dom-mediakeyneededevent">MediaKeyNeededEvent</dfn> : <a href="http://www.w3.org/TR/dom/#event">Event</a> {
   readonly attribute DOMString <a href="#dom-initdatatype">initDataType</a>;
-  readonly attribute Uint8Array? <a href="#dom-initdata">initData</a>;
+  readonly attribute ArrayBuffer? <a href="#dom-initdata">initData</a>;
 };
 
 dictionary <dfn id="dom-mediakeyneededeventinit">MediaKeyNeededEventInit</dfn> : <a href="http://www.w3.org/TR/dom/#eventinit">EventInit</a> {
   DOMString <a href="#dom-initdatatype">initDataType</a>;
-  Uint8Array? <a href="#dom-initdata">initData</a>;
+  ArrayBuffer? <a href="#dom-initdata">initData</a>;
 };
 </pre>
 
     <pre class="idl">
 [Constructor(DOMString type, optional <a href="#dom-mediakeymessageeventinit">MediaKeyMessageEventInit</a> eventInitDict)]
 interface <dfn id="dom-mediakeymessageevent">MediaKeyMessageEvent</dfn> : <a href="http://www.w3.org/TR/dom/#event">Event</a> {
-  readonly attribute Uint8Array <a href="#dom-message">message</a>;
+  readonly attribute ArrayBuffer <a href="#dom-message">message</a>;
   readonly attribute DOMString? <a href="#dom-destinationurl">destinationURL</a>;
 };
 
 dictionary <dfn id="dom-mediakeymessageeventinit">MediaKeyMessageEventInit</dfn> : <a href="http://www.w3.org/TR/dom/#eventinit">EventInit</a> {
-  Uint8Array <a href="#dom-message">message</a>;
+  ArrayBuffer <a href="#dom-message">message</a>;
   DOMString? <a href="#dom-destinationurl">destinationURL</a>;
 };
 </pre>
@@ -1401,8 +1401,8 @@
 </dd>
     </dl>
 
-    <p>When contained in the Uint8Array <code><a href="#dom-message">message</a></code> attribute of a <code><a href="#dom-mediakeymessageevent">MediaKeyMessageEvent</a></code> object, the JSON string is encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
-      Applications may decode the contents of the Uint8Array to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
+    <p>When contained in the ArrayBuffer <code><a href="#dom-message">message</a></code> attribute of a <code><a href="#dom-mediakeymessageevent">MediaKeyMessageEvent</a></code> object, the JSON string is encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may decode the contents of the ArrayBuffer to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
     </p>
 
     
@@ -1442,7 +1442,7 @@
       The <code><a href="#dom-update">update()</a></code> algorithm compares this value to the <var title="true">sessionType</var>.
     </p>
 
-    <p>When passed to the <code><a href="#dom-update">update()</a></code> method as the Uint8Array <var title="true">response</var> parameter, the JSON string must be encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+    <p>When passed to the <code><a href="#dom-update">update()</a></code> method as the ArrayBuffer <var title="true">response</var> parameter, the JSON string must be encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
       Applications may encode the JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textencoder">TextEncoder interface</a>.
     </p>
 
--- a/encrypted-media/encrypted-media.xml	Fri Jun 20 10:16:25 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Tue Jun 24 13:31:00 2014 -0700
@@ -346,9 +346,9 @@
 interface <precodedfn>MediaKeys</precodedfn> {
   readonly attribute DOMString <precoderef>keySystem</precoderef>;
 
-  Promise&lt;<precoderef>MediaKeySession</precoderef>&gt; <premethodref>createSession</premethodref>(DOMString <a href="#initialization-data-type">initDataType</a>, Uint8Array initData, optional <precoderef>SessionType</precoderef> sessionType = "<precoderef prefix="sessiontype">temporary</precoderef>");
+  Promise&lt;<precoderef>MediaKeySession</precoderef>&gt; <premethodref>createSession</premethodref>(DOMString <a href="#initialization-data-type">initDataType</a>, (ArrayBuffer or ArrayBufferView) initData, optional <precoderef>SessionType</precoderef> sessionType = "<precoderef prefix="sessiontype">temporary</precoderef>");
   Promise&lt;<precoderef>MediaKeySession</precoderef>&gt; <premethodref>loadSession</premethodref>(DOMString sessionId);
-  Promise&lt;any&gt; <premethodref>setServerCertificate</premethodref>(Uint8Array serverCertificate);
+  Promise&lt;any&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);
@@ -361,12 +361,12 @@
   // session properties
   readonly attribute DOMString <precoderef>sessionId</precoderef>;
   <div class="issue"><div class="issue-title"><span>Issue 7</span></div><p class=""><precoderef>usableKeyIds</precoderef> is not WebIDL-compliant. See <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=25594">Bug 25594</a>.</p></div>
-  readonly attribute Array&lt;Uint8Array&gt; <precoderef>usableKeyIds</precoderef>;
+  readonly attribute Array&lt;ArrayBuffer&gt; <precoderef>usableKeyIds</precoderef>;
   readonly attribute Date <precoderef>expiration</precoderef>;
   readonly attribute Promise&lt;any&gt; <precoderef>closed</precoderef>;
 
   // session operations
-  Promise&lt;any&gt; <premethodref>update</premethodref>(Uint8Array response);
+  Promise&lt;any&gt; <premethodref>update</premethodref>((ArrayBuffer or ArrayBufferView) response);
   Promise&lt;any&gt; <premethodref>close</premethodref>();
   Promise&lt;any&gt; <premethodref>remove</premethodref>();
 };
@@ -915,24 +915,24 @@
 [Constructor(DOMString type, optional <precoderef>MediaKeyNeededEventInit</precoderef> eventInitDict)]
 interface <precodedfn>MediaKeyNeededEvent</precodedfn> : <dom4ref name="event">Event</dom4ref> {
   readonly attribute DOMString <precoderef>initDataType</precoderef>;
-  readonly attribute Uint8Array? <precoderef>initData</precoderef>;
+  readonly attribute ArrayBuffer? <precoderef>initData</precoderef>;
 };
 
 dictionary <precodedfn>MediaKeyNeededEventInit</precodedfn> : <dom4ref name="eventinit">EventInit</dom4ref> {
   DOMString <precoderef>initDataType</precoderef>;
-  Uint8Array? <precoderef>initData</precoderef>;
+  ArrayBuffer? <precoderef>initData</precoderef>;
 };
 </pre>
 
     <pre class="idl">
 [Constructor(DOMString type, optional <precoderef>MediaKeyMessageEventInit</precoderef> eventInitDict)]
 interface <precodedfn>MediaKeyMessageEvent</precodedfn> : <dom4ref name="event">Event</dom4ref> {
-  readonly attribute Uint8Array <precoderef>message</precoderef>;
+  readonly attribute ArrayBuffer <precoderef>message</precoderef>;
   readonly attribute DOMString? <precoderef>destinationURL</precoderef>;
 };
 
 dictionary <precodedfn>MediaKeyMessageEventInit</precodedfn> : <dom4ref name="eventinit">EventInit</dom4ref> {
-  Uint8Array <precoderef>message</precoderef>;
+  ArrayBuffer <precoderef>message</precoderef>;
   DOMString? <precoderef>destinationURL</precoderef>;
 };
 </pre>
@@ -1321,8 +1321,8 @@
       <dd>The requested <coderef>SessionType</coderef></dd>
     </dl>
 
-    <p>When contained in the Uint8Array <coderef>message</coderef> attribute of a <coderef>MediaKeyMessageEvent</coderef> object, the JSON string is encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
-      Applications may decode the contents of the Uint8Array to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
+    <p>When contained in the ArrayBuffer <coderef>message</coderef> attribute of a <coderef>MediaKeyMessageEvent</coderef> object, the JSON string is encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+      Applications may decode the contents of the ArrayBuffer to a JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textdecoder">TextDecoder interface</a>.
     </p>
 
     <!-- Will be <section class="informative"> -->
@@ -1362,7 +1362,7 @@
       The <methodref>update</methodref> algorithm compares this value to the <var title="true">sessionType</var>.
     </p>
 
-    <p>When passed to the <methodref>update</methodref> method as the Uint8Array <var title="true">response</var> parameter, the JSON string must be encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
+    <p>When passed to the <methodref>update</methodref> method as the ArrayBuffer <var title="true">response</var> parameter, the JSON string must be encoded in UTF-8 as specified in the <a href="http://www.w3.org/TR/encoding/">Encoding</a> specification.
       Applications may encode the JSON string using the <a href="http://www.w3.org/TR/encoding/#interface-textencoder">TextEncoder interface</a>.
     </p>