[EME] Use .catch() where appropriate.
authorDavid Dorwin <ddorwin@google.com>
Thu, 17 Apr 2014 13:11:20 -0700
changeset 282 1c29df86b88f
parent 281 5597e8e2da41
child 283 0500bb0b593a
[EME] Use .catch() where appropriate.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Tue Apr 15 17:07:15 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Thu Apr 17 13:11:20 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 15 April 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 17 April 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>
@@ -1279,8 +1279,7 @@
     var keySession = event.target;
 
     var license = new Uint8Array([ ... ]);
-    keySession.<a href="#dom-update">update</a>(license).then(
-      null,
+    keySession.<a href="#dom-update">update</a>(license).catch(
       console.error.bind(console, "update() failed")
     );
   }
@@ -1332,8 +1331,7 @@
           return video.<a href="#dom-setmediakeys">setMediaKeys</a>(createdMediaKeys);
         },
         console.error.bind(console, "Unable to create MediaKeys")
-      ).then(
-        null,
+      ).catch(
         console.error.bind(console, "Unable to set MediaKeys")
       );
     }
@@ -1366,8 +1364,7 @@
     xmlhttp.onreadystatechange = function() {
       if (xmlhttp.readyState == 4) {
         var license = new Uint8Array(xmlhttp.response);
-        keySession.<a href="#dom-update">update</a>(license).then(
-          null,
+        keySession.<a href="#dom-update">update</a>(license).catch(
           console.error.bind(console, "update() failed")
         );
       }
@@ -1410,9 +1407,10 @@
 
   function handleMessageResponse(keySession, response) {
     var license = new Uint8Array(response);
-    keySession.<a href="#dom-update">update</a>(license).then(
-      null,
-      console.error.bind(console, "update() failed")
+    keySession.<a href="#dom-update">update</a>(license).catch(
+      function(err) {
+        console.error("update() failed: " + err);
+      }
     );
   }
   
--- a/encrypted-media/encrypted-media.xml	Tue Apr 15 17:07:15 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Thu Apr 17 13:11:20 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 15 April 2014</h2>
+      <h2 id="draft-date">W3C Editor's Draft 17 April 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>
@@ -1222,8 +1222,7 @@
     var keySession = event.target;
 
     var license = new Uint8Array([ ... ]);
-    keySession.<premethodref>update</premethodref>(license).then(
-      null,
+    keySession.<premethodref>update</premethodref>(license).catch(
       console.error.bind(console, "update() failed")
     );
   }
@@ -1275,8 +1274,7 @@
           return video.<premethodref>setMediaKeys</premethodref>(createdMediaKeys);
         },
         console.error.bind(console, "Unable to create MediaKeys")
-      ).then(
-        null,
+      ).catch(
         console.error.bind(console, "Unable to set MediaKeys")
       );
     }
@@ -1309,8 +1307,7 @@
     xmlhttp.onreadystatechange = function() {
       if (xmlhttp.readyState == 4) {
         var license = new Uint8Array(xmlhttp.response);
-        keySession.<premethodref>update</premethodref>(license).then(
-          null,
+        keySession.<premethodref>update</premethodref>(license).catch(
           console.error.bind(console, "update() failed")
         );
       }
@@ -1353,9 +1350,10 @@
 
   function handleMessageResponse(keySession, response) {
     var license = new Uint8Array(response);
-    keySession.<premethodref>update</premethodref>(license).then(
-      null,
-      console.error.bind(console, "update() failed")
+    keySession.<premethodref>update</premethodref>(license).catch(
+      function(err) {
+        console.error("update() failed: " + err);
+      }
     );
   }