[EME] Bug 26575 - Fix Example 8.5 to save the sessionId when generateRequest() is resolved.
--- 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")
);
}