[EME] Bug 21977 - Swap isTypeSupported() parameter order so keySystem is first.
authorDavid Dorwin <ddorwin@google.com>
Fri, 24 May 2013 15:42:16 -0700
changeset 126 85fbfad2339e
parent 125 4a8be9f80c1a
child 127 80be415b8be1
[EME] Bug 21977 - Swap isTypeSupported() parameter order so keySystem is first.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Fri May 24 15:31:11 2013 -0700
+++ b/encrypted-media/encrypted-media.html	Fri May 24 15:42:16 2013 -0700
@@ -275,7 +275,7 @@
 
   <a href="#dom-mediakeysession">MediaKeySession</a> <a href="#dom-createsession">createSession</a>(DOMString type, Uint8Array initData);
 
-  static bool <a href="#dom-istypesupported">isTypeSupported</a>(DOMString type, DOMstring <a href="#key-system">keySystem</a>);
+  static bool <a href="#dom-istypesupported">isTypeSupported</a>(DOMstring <a href="#key-system">keySystem</a>, DOMString? type);
 };
 
 interface <dfn id="dom-mediakeysession">MediaKeySession</dfn> : <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#eventtarget">EventTarget</a> {
@@ -419,18 +419,18 @@
       <li>Return the new object to the caller.</li>
     </ol>
 
-    <p>The <dfn id="dom-istypesupported"><code>isTypeSupported(type, keySystem)</code></dfn> method returns whether <var title="true">keySystem</var> is supported with the specified container and codec <var title="true">type</var>(s).</p>
+    <p>The <dfn id="dom-istypesupported"><code>isTypeSupported(keySystem, type)</code></dfn> method returns whether <var title="true">keySystem</var> is supported with the specified container and codec <var title="true">type</var>(s).</p>
     <div class="example">
       <p>The following list shows some examples.</p>
       <dl>
         <dt>Returns whether the Some System <a href="#key-system">Key System</a> is supported. Specific containers and codecs may or may not be supported with Some System.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(null, "com.example.somesystem")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem")</pre></dd>
         <dt>Returns whether version 1.5 of the Some System <a href="#key-system">Key System</a> is supported. Specific containers and codecs may or may not be supported with Some System 1.5.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(null, "com.example.somesystem.1_5")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem.1_5")</pre></dd>
         <dt>Returns whether the Some System <a href="#key-system">Key System</a> is present and supports the container and codec(s) specified by <var title="true">mimeType</var>.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(<var title="true">mimeType</var>, "com.example.somesystem")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem", <var title="true">mimeType</var>)</pre></dd>
         <dt>Returns whether the user agent supports <a href="#simple-decryption-clear-key">Clear Key</a> <a href="#simple-decryption">Simple Decryption</a> of the container and codec(s) specified by <var title="true">mimeType</var>.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(<var title="true">mimeType</var>, "org.w3.clearkey")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("org.w3.clearkey", <var title="true">mimeType</var>)</pre></dd>
       </dl>
     </div>
     
@@ -1161,16 +1161,16 @@
   var licenseUrl;
 
   function selectKeySystem() {
-    if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem")) {
+    if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("com.example.somesystem", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.example.com/getkey"; // OR "https://example.&lt;My Video Site domain&gt;"
-      if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem.2_0")) {
+      if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("com.example.somesystem.2_0", "video/webm; codecs='vp8, vorbis'")) {
         keySystem = "com.example.somesystem.2_0";
-      } else if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem.1_5")) {
+      } else if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("com.example.somesystem.1_5", "video/webm; codecs='vp8, vorbis'")) {
         keySystem = "com.example.somesystem.1_5";
       }
-    } else if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("video/webm; codecs='vp8, vorbis'", "foobar")) {
+    } else if (<a href="#dom-mediakeys">MediaKeys</a>.<a href="#dom-istypesupported">isTypeSupported</a>("com.foobar", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.foobar.com/request";
-      keySystem = "foobar";
+      keySystem = "com.foobar";
     } else {
       throw "Key System not supported";
     }
--- a/encrypted-media/encrypted-media.xml	Fri May 24 15:31:11 2013 -0700
+++ b/encrypted-media/encrypted-media.xml	Fri May 24 15:42:16 2013 -0700
@@ -271,7 +271,7 @@
 
   <precoderef>MediaKeySession</precoderef> <premethodref>createSession</premethodref>(DOMString type, Uint8Array initData);
 
-  static bool <premethodref>isTypeSupported</premethodref>(DOMString type, DOMstring <a href="#key-system">keySystem</a>);
+  static bool <premethodref>isTypeSupported</premethodref>(DOMstring <a href="#key-system">keySystem</a>, DOMString? type);
 };
 
 interface <precodedfn>MediaKeySession</precodedfn> : <dom4ref name="eventtarget">EventTarget</dom4ref> {
@@ -404,18 +404,18 @@
       <li>Return the new object to the caller.</li>
     </ol>
 
-    <p>The <methoddfn name="isTypeSupported">isTypeSupported(<var title="true">type</var>, <var title="true">keySystem</var>)</methoddfn> method returns whether <var title="true">keySystem</var> is supported with the specified container and codec <var title="true">type</var>(s).</p>
+    <p>The <methoddfn name="isTypeSupported">isTypeSupported(<var title="true">keySystem</var>, <var title="true">type</var>)</methoddfn> method returns whether <var title="true">keySystem</var> is supported with the specified container and codec <var title="true">type</var>(s).</p>
     <div class="example">
       <p>The following list shows some examples.</p>
       <dl>
         <dt>Returns whether the Some System <a href="#key-system">Key System</a> is supported. Specific containers and codecs may or may not be supported with Some System.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(null, "com.example.somesystem")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem")</pre></dd>
         <dt>Returns whether version 1.5 of the Some System <a href="#key-system">Key System</a> is supported. Specific containers and codecs may or may not be supported with Some System 1.5.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(null, "com.example.somesystem.1_5")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem.1_5")</pre></dd>
         <dt>Returns whether the Some System <a href="#key-system">Key System</a> is present and supports the container and codec(s) specified by <var title="true">mimeType</var>.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(<var title="true">mimeType</var>, "com.example.somesystem")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("com.example.somesystem", <var title="true">mimeType</var>)</pre></dd>
         <dt>Returns whether the user agent supports <a href="#simple-decryption-clear-key">Clear Key</a> <a href="#simple-decryption">Simple Decryption</a> of the container and codec(s) specified by <var title="true">mimeType</var>.</dt>
-        <dd><pre class="code">MediaKeys.isTypeSupported(<var title="true">mimeType</var>, "org.w3.clearkey")</pre></dd>
+        <dd><pre class="code">MediaKeys.isTypeSupported("org.w3.clearkey", <var title="true">mimeType</var>)</pre></dd>
       </dl>
     </div>
     
@@ -1105,16 +1105,16 @@
   var licenseUrl;
 
   function selectKeySystem() {
-    if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem")) {
+    if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.example.somesystem", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.example.com/getkey"; // OR "https://example.&lt;My Video Site domain&gt;"
-      if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem.2_0")) {
+      if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.example.somesystem.2_0", "video/webm; codecs='vp8, vorbis'")) {
         keySystem = "com.example.somesystem.2_0";
-      } else if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("video/webm; codecs='vp8, vorbis'", "com.example.somesystem.1_5")) {
+      } else if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.example.somesystem.1_5", "video/webm; codecs='vp8, vorbis'")) {
         keySystem = "com.example.somesystem.1_5";
       }
-    } else if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("video/webm; codecs='vp8, vorbis'", "foobar")) {
+    } else if (<precoderef>MediaKeys</precoderef>.<premethodref>isTypeSupported</premethodref>("com.foobar", "video/webm; codecs='vp8, vorbis'")) {
       licenseUrl = "https://license.foobar.com/request";
-      keySystem = "foobar";
+      keySystem = "com.foobar";
     } else {
       throw "Key System not supported";
     }