[EME] Bug 25537 - Expose expiration information to the application
authorDavid Dorwin <ddorwin@google.com>
Fri, 09 May 2014 15:17:25 -0700
changeset 310 30b372d9798b
parent 309 055b9f0b9ecd
child 311 67e151641669
[EME] Bug 25537 - Expose expiration information to the application
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Fri May 09 14:43:28 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Fri May 09 15:17:25 2014 -0700
@@ -197,7 +197,8 @@
           <li><a href="#algorithms-queue-message">4.3. Queue a "message" Event</a></li>
           <li><a href="#algorithms-queue-error">4.4. Queue an "error" Event</a></li>
           <li><a href="#algorithms-update-usable-key-ids">4.5. Update Usable Key IDs</a></li>
-          <li><a href="#algorithms-session-close">4.6. Session Close</a></li>
+          <li><a href="#algorithms-update-expiration">4.6 Update Expiration</a></li>
+          <li><a href="#algorithms-session-close">4.7. Session Close</a></li>
         </ul></li>
       <li><a href="#simple-decryption">5. Simple Decryption</a></li>
         <li><ul style="list-style-type:none">
@@ -360,6 +361,7 @@
 <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 Date <a href="#dom-expiration">expiration</a>;
   readonly attribute Promise&lt;any&gt; <a href="#dom-closed">closed</a>;
 
   // session operations
@@ -508,6 +510,7 @@
               <li><p>Set the <code><a href="#dom-sessionkeysystem">keySystem</a></code> attribute to the value of the <code><a href="#dom-mediakeys">MediaKeys</a></code> object's <code><a href="#dom-keysystem">keySystem</a></code> attribute.</p></li>
               <li><p>Set the <code><a href="#dom-sessionid">sessionId</a></code> attribute to <var title="true">session ID</var>.</p></li>
               <li><p>Set the <code><a href="#dom-usablekeyids">usableKeyIds</a></code> attribute to an empty Array.</p></li>
+              <li><p>Let <code><a href="#dom-expiration">expiration</a></code> be <code>undefined</code>.</p></li>
               <li><p>Let <code><a href="#dom-closed">closed</a></code> be a new promise.</p></li>
               <li><p>Let the session type be <var title="true">sessionType</var>.</p></li>
               <li><p>Let the session initData be the <var title="true">initDataType</var>-<var>init data</var> pair.</p></li>
@@ -530,6 +533,7 @@
       <li>
 <p>Run the following steps asynchronously:</p>
         <ol>
+          <li><p>Let <var title="true">expiration time</var> be <code>undefined</code>.</p></li>
           <li><p>Let <var title="true">request</var> be null.</p></li>
           <li><p>Let <var title="true">destination URL</var> be null.</p></li>
           <li><p>Let <var title="true">origin</var> be the <a href="http://www.w3.org/TR/html5/browsers.html#origin-0">origin</a> of the <code><a href="#dom-mediakeys">MediaKeys</a></code> object's <code><a href="http://www.w3.org/TR/dom/#document">Document</a></code>.</p></li>
@@ -541,6 +545,7 @@
               <li><p>Let <var title="true">session data</var> be the data stored for the <var title="true">sessionId</var> in the <var title="true">origin</var>.
               This must not include data from other origin(s) or that is not associated with an origin.</p></li>
               <li><p>Load the <var title="true">session data</var>.</p></li>
+              <li><p>If the <var title="true">session data</var> indicates an expiration time for the session, let <var title="true">expiration time</var> be a Date object representing that time.</p></li>
               <li>
 <p>If a message exchange is required:</p>
                 <ol>
@@ -560,6 +565,7 @@
 <p>Set the <code><a href="#dom-usablekeyids">usableKeyIds</a></code> attribute to an Array containing the set of key IDs for which the session contains a key the CDM <em>knows</em> is currently usable.</p>
                 <p>The <a href="#algorithms-update-usable-key-ids">Update Usable Key IDs</a> algorithm may also be run later should additional processing be necessary to determine with certainty whether one or more keys is usable.</p>
               </li>
+              <li><p>Let <code><a href="#dom-expiration">expiration</a></code> be <var title="true">expiration time</var>.</p></li>
               <li><p>Let <code><a href="#dom-closed">closed</a></code> be a new promise.</p></li>
               <li><p>Let the session type be "<code><a href="#dom-sessiontypepersistent">persistent</a></code>".</p></li>
             </ol>
@@ -708,6 +714,10 @@
       Each element must be unique.
     </p>
 
+    <p>The <dfn id="dom-expiration"><code>expiration</code></dfn> attribute is the time, if any, at which the the key(s) in the session will no longer be usable usable to decrypt <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-data">media data</a> as determined by the CDM.
+      It may be <code>undefined</code>.
+    </p>
+
     <p>The <dfn id="dom-closed"><code>closed</code></dfn> attribute signals when object becomes closed as a result of the <a href="#algorithms-session-close">Session Close</a> algorithm being run.
     This promise can only be fulfilled and is never rejected.</p>
 
@@ -749,6 +759,7 @@
 <p>If the set of usable keys changed, run the <a href="#algorithms-update-usable-key-ids">Update Usable Key IDs</a> algorithm on the <var title="true">session</var>.</p>
                 <p>The algorithm may also be run later should additional processing be necessary to determine with certainty whether one or more keys is usable.</p>
               </li>
+              <li><p>If the expiration time for the session changed, run the <a href="#algorithms-update-expiration">Update Expiration</a> algorithm on the <var title="true">session</var>, providing the new expiration time.</p></li>
               <li>
 <p>If another message needs to be sent to the server, execute the following steps:</p>
                 <ol>
@@ -1249,6 +1260,7 @@
     <h3 id="algorithms-update-usable-key-ids">4.5. Update Usable Key IDs</h3>
     <p>The Update Usable Key IDs algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
     This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
+    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
     </p>
     <p>The following steps are run:</p>
     <ol>
@@ -1258,7 +1270,20 @@
       <li><p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-eventkeyschange">keyschange</a></code> at the <var title="true">session</var>.</p></li>
     </ol>
 
-    <h3 id="algorithms-session-close">4.6. Session Close</h3>
+    <h3 id="algorithms-update-expiration">4.6. Update Expiration</h3>
+    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
+    This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
+    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object and the new expiration time, which may be <code>undefined</code>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
+      <li><p>Let <var title="true">expiration time</var> be <code>undefined</code>.</p></li>
+      <li><p>If the new expiration time is not <code>undefined</code>, let <var title="true">expiration time</var> be a Date object representing the new expiration time.</p></li>
+      <li><p>Set the <var title="true">session</var>'s <code><a href="#dom-expiration">expiration</a></code> attribute to <var title="true">expiration time</var>.</p></li>
+    </ol>
+
+    <h3 id="algorithms-session-close">4.7. Session Close</h3>
     <p>The Session Close algorithm is run when the CDM closes the session associated with a <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p>
     <p class="non-normative">The CDM may close a session at any point, such as in response to a <code><a href="#dom-close">close()</a></code> call, when the session is no longer needed, or when system resources are lost.
     Keys in other sessions should be unaffected, even if they have overlapping key IDs.
--- a/encrypted-media/encrypted-media.xml	Fri May 09 14:43:28 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Fri May 09 15:17:25 2014 -0700
@@ -194,7 +194,8 @@
           <li><a href="#algorithms-queue-message">4.3. Queue a "message" Event</a></li>
           <li><a href="#algorithms-queue-error">4.4. Queue an "error" Event</a></li>
           <li><a href="#algorithms-update-usable-key-ids">4.5. Update Usable Key IDs</a></li>
-          <li><a href="#algorithms-session-close">4.6. Session Close</a></li>
+          <li><a href="#algorithms-update-expiration">4.6 Update Expiration</a></li>
+          <li><a href="#algorithms-session-close">4.7. Session Close</a></li>
         </ul></li>
       <li><a href="#simple-decryption">5. Simple Decryption</a></li>
         <li><ul style="list-style-type:none">
@@ -354,6 +355,7 @@
   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 Date <precoderef>expiration</precoderef>;
   readonly attribute Promise&lt;any&gt; <precoderef>closed</precoderef>;
 
   // session operations
@@ -487,6 +489,7 @@
               <li><p>Set the <coderef prefix="session">keySystem</coderef> attribute to the value of the <coderef>MediaKeys</coderef> object's <coderef>keySystem</coderef> attribute.</p></li>
               <li><p>Set the <coderef>sessionId</coderef> attribute to <var title="true">session ID</var>.</p></li>
               <li><p>Set the <coderef>usableKeyIds</coderef> attribute to an empty Array.</p></li>
+              <li><p>Let <coderef>expiration</coderef> be <code>undefined</code>.</p></li>
               <li><p>Let <coderef>closed</coderef> be a new promise.</p></li>
               <li><p>Let the session type be <var title="true">sessionType</var>.</p></li>
               <li><p>Let the session initData be the <var title="true">initDataType</var>-<var>init data</var> pair.</p></li>
@@ -508,6 +511,7 @@
       <li><p>Let <var>promise</var> be a new promise.</p></li>
       <li><p>Run the following steps asynchronously:</p>
         <ol>
+          <li><p>Let <var title="true">expiration time</var> be <code>undefined</code>.</p></li>
           <li><p>Let <var title="true">request</var> be null.</p></li>
           <li><p>Let <var title="true">destination URL</var> be null.</p></li>
           <li><p>Let <var title="true">origin</var> be the <a href="http://www.w3.org/TR/html5/browsers.html#origin-0">origin</a> of the <coderef>MediaKeys</coderef> object's <code><dom4ref name="document">Document</dom4ref></code>.</p></li>
@@ -518,6 +522,7 @@
               <li><p>Let <var title="true">session data</var> be the data stored for the <var title="true">sessionId</var> in the <var title="true">origin</var>.
               This must not include data from other origin(s) or that is not associated with an origin.</p></li>
               <li><p>Load the <var title="true">session data</var>.</p></li>
+              <li><p>If the <var title="true">session data</var> indicates an expiration time for the session, let <var title="true">expiration time</var> be a Date object representing that time.</p></li>
               <li><p>If a message exchange is required:</p>
                 <ol>
                   <li><p>Let <var title="true">request</var> be a request generated by the <a href="#cdm">CDM</a> based on the <var title="true">session data</var>.</p></li>
@@ -534,6 +539,7 @@
               <li><p>Set the <coderef>usableKeyIds</coderef> attribute to an Array containing the set of key IDs for which the session contains a key the CDM <em>knows</em> is currently usable.</p>
                 <p>The <a href="#algorithms-update-usable-key-ids">Update Usable Key IDs</a> algorithm may also be run later should additional processing be necessary to determine with certainty whether one or more keys is usable.</p>
               </li>
+              <li><p>Let <coderef>expiration</coderef> be <var title="true">expiration time</var>.</p></li>
               <li><p>Let <coderef>closed</coderef> be a new promise.</p></li>
               <li><p>Let the session type be "<coderef prefix="sessiontype">persistent</coderef>".</p></li>
             </ol>
@@ -667,6 +673,10 @@
       Each element must be unique.
     </p>
 
+    <p>The <codedfn>expiration</codedfn> attribute is the time, if any, at which the the key(s) in the session will no longer be usable usable to decrypt <videoanchor name="media-data">media data</videoanchor> as determined by the CDM.
+      It may be <code>undefined</code>.
+    </p>
+
     <p>The <codedfn>closed</codedfn> attribute signals when object becomes closed as a result of the <a href="#algorithms-session-close">Session Close</a> algorithm being run.
     This promise can only be fulfilled and is never rejected.</p>
 
@@ -704,6 +714,7 @@
               <li><p>If the set of usable keys changed, run the <a href="#algorithms-update-usable-key-ids">Update Usable Key IDs</a> algorithm on the <var title="true">session</var>.</p>
                 <p>The algorithm may also be run later should additional processing be necessary to determine with certainty whether one or more keys is usable.</p>
               </li>
+              <li><p>If the expiration time for the session changed, run the <a href="#algorithms-update-expiration">Update Expiration</a> algorithm on the <var title="true">session</var>, providing the new expiration time.</p></li>
               <li><p>If another message needs to be sent to the server, execute the following steps:</p>
                 <ol>
                   <li><p>Let <var title="true">request</var> be that message.</p></li>
@@ -1174,6 +1185,7 @@
     <h3 id="algorithms-update-usable-key-ids">4.5. Update Usable Key IDs</h3>
     <p>The Update Usable Key IDs algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
     This can happen as the result of an <methodref>update</methodref> call or some other event.
+    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object.
     </p>
     <p>The following steps are run:</p>
     <ol>
@@ -1183,7 +1195,20 @@
       <li><p><Queue-a-task/> to <fire-a-simple-event/> named <coderef prefix="event">keyschange</coderef> at the <var title="true">session</var>.</p></li>
     </ol>
 
-    <h3 id="algorithms-session-close">4.6. Session Close</h3>
+    <h3 id="algorithms-update-expiration">4.6. Update Expiration</h3>
+    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
+    This can happen as the result of an <methodref>update</methodref> call or some other event.
+    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object and the new expiration time, which may be <code>undefined</code>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
+      <li><p>Let <var title="true">expiration time</var> be <code>undefined</code>.</p></li>
+      <li><p>If the new expiration time is not <code>undefined</code>, let <var title="true">expiration time</var> be a Date object representing the new expiration time.</p></li>
+      <li><p>Set the <var title="true">session</var>'s <coderef>expiration</coderef> attribute to <var title="true">expiration time</var>.</p></li>
+    </ol>
+
+    <h3 id="algorithms-session-close">4.7. Session Close</h3>
     <p>The Session Close algorithm is run when the CDM closes the session associated with a <coderef>MediaKeySession</coderef> object.</p>
     <p class="non-normative">The CDM may close a session at any point, such as in response to a <methodref>close</methodref> call, when the session is no longer needed, or when system resources are lost.
     Keys in other sessions should be unaffected, even if they have overlapping key IDs.