[EME] Explicitly check for null and empty parameters.
authorDavid Dorwin <ddorwin@google.com>
Fri, 24 Jan 2014 17:40:34 -0800
changeset 239 2e9c25eede16
parent 238 b24748c3d28a
child 240 f82e3cd5b09c
[EME] Explicitly check for null and empty parameters.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Fri Jan 24 17:02:55 2014 -0800
+++ b/encrypted-media/encrypted-media.html	Fri Jan 24 17:40:34 2014 -0800
@@ -383,6 +383,8 @@
     </p>
 
     <ol>
+      <li><p>If <var title="true">contentType</var> is null or an empty string, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</p></li>
+      <li><p>If <var title="true">initData</var> is null or an empty array, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</p></li>
       <li><p>If <var title="true">contentType</var> contains a MIME type that is not supported or is not supported by the <code><a href="#dom-keysystem">keySystem</a></code>, throw a <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-not_supported_err">NOT_SUPPORTED_ERR</a></code> exception and abort these steps.</p></li>
 
       <li>Create a new <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
@@ -480,6 +482,7 @@
     <p>The <dfn id="dom-loadsession"><code>loadSession(sessionId)</code></dfn> method must run the following steps:</p>
     <ol>
       <li><p>If the <code><a href="#dom-keysystem">keySystem</a></code> does not support loading previous sessions, throw a <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-not_supported_err">NOT_SUPPORTED_ERR</a></code> exception and abort these steps.</p></li>
+      <li><p>If <var title="true">sessionId</var> is null or an empty string, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</p></li>
       <li>Create a new <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
         <ol>
           <li><p>Let the <code><a href="#dom-keysystem">keySystem</a></code> attribute be <var title="true">keySystem</var>.</p></li>
@@ -572,6 +575,7 @@
     <p>It must run the following steps:</p>
     
     <ol>
+      <li><p>If <var title="true">keySystem</var> is null or an empty string, return false and abort these steps.</p></li>
       <li><p>If <var title="true">keySystem</var> contains an unrecognized or unsupported <a href="#key-system">Key System</a>, return false and abort these steps. Key system string comparison is case-sensitive.</p></li>
       <li><p>If <var title="true">contentType</var> is null or an empty string, return true and abort these steps.</p></li>
       <li><p>If the <a href="#key-system">Key System</a> specified by <var title="true">keySystem</var> does not support decrypting the container and/or codec specified by <var title="true">contentType</var>, return false and abort these steps.</p></li>
@@ -586,7 +590,7 @@
     <p class="non-normative">Note: The contents of <var title="true">response</var> are <var title="true"><a href="#key-system">keySystem</a></var>-specific.</p>
 
     <ol>
-      <li><p>If the argument is null or an empty array, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code>.</p></li>
+      <li><p>If <var title="true">response</var> is null or an empty array, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_access_err">INVALID_ACCESS_ERR</a></code> exception and abort these steps.</p></li>
       <li><p>If the session is not in the <code><a href="#dom-statepending">PENDING</a></code> state, throw an <code><a href="https://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-invalid_state_err">INVALID_STATE_ERR</a></code>.</p></li>
 
       <li>
--- a/encrypted-media/encrypted-media.xml	Fri Jan 24 17:02:55 2014 -0800
+++ b/encrypted-media/encrypted-media.xml	Fri Jan 24 17:40:34 2014 -0800
@@ -379,6 +379,8 @@
     </p>
 
     <ol>
+      <li><p>If <var title="true">contentType</var> is null or an empty string, throw an <invalid-access-err/> exception and abort these steps.</p></li>
+      <li><p>If <var title="true">initData</var> is null or an empty array, throw an <invalid-access-err/> exception and abort these steps.</p></li>
       <li><p>If <var title="true">contentType</var> contains a MIME type that is not supported or is not supported by the <coderef>keySystem</coderef>, throw a <not-supported-err/> exception and abort these steps.</p></li>
 
       <li>Create a new <coderef>MediaKeySession</coderef> object.
@@ -467,6 +469,7 @@
     <p>The <methoddfn name="loadSession">loadSession(<var title="true">sessionId</var>)</methoddfn> method must run the following steps:</p>
     <ol>
       <li><p>If the <coderef>keySystem</coderef> does not support loading previous sessions, throw a <not-supported-err/> exception and abort these steps.</p></li>
+      <li><p>If <var title="true">sessionId</var> is null or an empty string, throw an <invalid-access-err/> exception and abort these steps.</p></li>
       <li>Create a new <coderef>MediaKeySession</coderef> object.
         <ol>
           <li><p>Let the <coderef>keySystem</coderef> attribute be <var title="true">keySystem</var>.</p></li>
@@ -553,6 +556,7 @@
     <p>It must run the following steps:</p>
     
     <ol>
+      <li><p>If <var title="true">keySystem</var> is null or an empty string, return false and abort these steps.</p></li>
       <li><p>If <var title="true">keySystem</var> contains an unrecognized or unsupported <a href="#key-system">Key System</a>, return false and abort these steps. Key system string comparison is case-sensitive.</p></li>
       <li><p>If <var title="true">contentType</var> is null or an empty string, return true and abort these steps.</p></li>
       <li><p>If the <a href="#key-system">Key System</a> specified by <var title="true">keySystem</var> does not support decrypting the container and/or codec specified by <var title="true">contentType</var>, return false and abort these steps.</p></li>
@@ -567,7 +571,7 @@
     <p class="non-normative">Note: The contents of <var title="true">response</var> are <var title="true"><a href="#key-system">keySystem</a></var>-specific.</p>
 
     <ol>
-      <li><p>If the argument is null or an empty array, throw an <invalid-access-err/>.</p></li>
+      <li><p>If <var title="true">response</var> is null or an empty array, throw an <invalid-access-err/> exception and abort these steps.</p></li>
       <li><p>If the session is not in the <coderef prefix="state">PENDING</coderef> state, throw an <invalid-state-err/>.</p></li>
 
       <li><p>Schedule a task to handle the call, providing <var title="true">response</var>.</p>