[EME] Add an explicit check for the stored session to the loadSession() algorithm.
Also, clean up other parts of the CDM portion of the algorithm.
--- a/encrypted-media/encrypted-media.html Mon Mar 24 17:47:56 2014 -0700
+++ b/encrypted-media/encrypted-media.html Mon Mar 24 17:49:40 2014 -0700
@@ -503,12 +503,20 @@
<li>
<p>Use <var title="true">cdm</var> to execute the following steps:</p>
<ol>
- <li><p>Initialize the session with stored data for the <var title="true">sessionId</var>.</p></li>
<li>
-<p>If a message exchange <span class="non-normative">(e.g. a license request)</span> is required:</p>
+<p>If there is no data stored for the <var title="true">sessionId</var>, run the following steps:</p>
<ol>
- <li><p>Let <var title="true">request</var> be a request generated by the <a href="#cdm">CDM</a> using the <var title="true">sessionId</var>.</p></li>
- <li><p>If the stored data for the <var title="true">sessionId</var> indicates a destination URL relevant to <var title="true">keySystem</var>, let <var title="true">destination URL</var> be that URL.</p></li>
+ <li><p>Run the <a href="#algorithms-queue-error">Queue an "error" Event</a> algorithm on the <var title="true">session</var>, "<code><a href="http://www.w3.org/TR/dom/#notfounderror">NotFoundError</a></code>" and 0.</p></li>
+ <li><p>Abort the task.</p></li>
+ </ol>
+ </li>
+ <li><p>Let <var title="true">session data</var> be the data stored for the <var title="true">sessionId</var>.</p></li>
+ <li><p>Load the <var title="true">session data</var> and associate it with the <var title="true">session</var>.</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>
+ <li><p>If the <var title="true">session data</var> indicates a destination URL for the request, let <var title="true">destination URL</var> be that URL.</p></li>
</ol>
</li>
</ol>
--- a/encrypted-media/encrypted-media.xml Mon Mar 24 17:47:56 2014 -0700
+++ b/encrypted-media/encrypted-media.xml Mon Mar 24 17:49:40 2014 -0700
@@ -489,11 +489,18 @@
<li><p>Let <var title="true">cdm</var> be the <var title="true">cdm</var> loaded in the <a href="#dom-mediakeys-constructor"><code>MediaKeys</code> constructor</a>.</p></li>
<li><p>Use <var title="true">cdm</var> to execute the following steps:</p>
<ol>
- <li><p>Initialize the session with stored data for the <var title="true">sessionId</var>.</p></li>
- <li><p>If a message exchange <span class="non-normative">(e.g. a license request)</span> is required:</p>
+ <li><p>If there is no data stored for the <var title="true">sessionId</var>, run the following steps:</p>
<ol>
- <li><p>Let <var title="true">request</var> be a request generated by the <a href="#cdm">CDM</a> using the <var title="true">sessionId</var>.</p></li>
- <li><p>If the stored data for the <var title="true">sessionId</var> indicates a destination URL relevant to <var title="true">keySystem</var>, let <var title="true">destination URL</var> be that URL.</p></li>
+ <li><p>Run the <a href="#algorithms-queue-error">Queue an "error" Event</a> algorithm on the <var title="true">session</var>, "<code><dom4ref name="notfounderror">NotFoundError</dom4ref></code>" and 0.</p></li>
+ <li><p>Abort the task.</p></li>
+ </ol>
+ </li>
+ <li><p>Let <var title="true">session data</var> be the data stored for the <var title="true">sessionId</var>.</p></li>
+ <li><p>Load the <var title="true">session data</var> and associate it with the <var title="true">session</var>.</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>
+ <li><p>If the <var title="true">session data</var> indicates a destination URL for the request, let <var title="true">destination URL</var> be that URL.</p></li>
</ol>
</li>
</ol>