[EME] Bug 26575 - Fix Example 8.5 to save the sessionId when generateRequest() is resolved.
authorDavid Dorwin <ddorwin@google.com>
Wed, 27 Aug 2014 10:51:49 -0700
changeset 411 3a5e8f5332a2
parent 410 cd26fc618e9e
child 412 0713fffe9928
[EME] Bug 26575 - Fix Example 8.5 to save the sessionId when generateRequest() is resolved.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Wed Aug 27 10:22:17 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Wed Aug 27 10:51:49 2014 -0700
@@ -1854,8 +1854,11 @@
         console.log("Session " + this.sessionId + " closed");
       }.bind(keySession)        
     );
-    // Store keySession.<a href="#dom-sessionid">sessionId</a> in the application.
-    keySession.<a href="#dom-generaterequest">generateRequest</a>(initDataType, initData).catch(
+    keySession.<a href="#dom-generaterequest">generateRequest</a>(initDataType, initData).then(
+      function() {
+        // Store this.<a href="#dom-sessionid">sessionId</a> in the application.
+      }.bind(keySession)
+    ).catch(
       console.error.bind(console, "Unable to create or initialize a persistable key session")
     );
   }
--- a/encrypted-media/encrypted-media.xml	Wed Aug 27 10:22:17 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Wed Aug 27 10:51:49 2014 -0700
@@ -1785,8 +1785,11 @@
         console.log("Session " + this.sessionId + " closed");
       }.bind(keySession)        
     );
-    // Store keySession.<precoderef>sessionId</precoderef> in the application.
-    keySession.<premethodref>generateRequest</premethodref>(initDataType, initData).catch(
+    keySession.<premethodref>generateRequest</premethodref>(initDataType, initData).then(
+      function() {
+        // Store this.<precoderef>sessionId</precoderef> in the application.
+      }.bind(keySession)
+    ).catch(
       console.error.bind(console, "Unable to create or initialize a persistable key session")
     );
   }