Use TypeError for argument validation: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23346
authorJungkee Song <jungkee.song@samsung.com>
Wed, 23 Oct 2013 15:54:59 +0900
changeset 140 4f9d511e8556
parent 139 6823b412deb4
child 141 71cfc398c10e
Use TypeError for argument validation: https://www.w3.org/Bugs/Public/show_bug.cgi?id=23346
Overview.html
Overview.src.html
data/xrefs/dom/webidl.json
--- a/Overview.html	Wed Oct 23 15:23:05 2013 +0900
+++ b/Overview.html	Wed Oct 23 15:54:59 2013 +0900
@@ -748,7 +748,7 @@
     <p>Sets the <a href="#request-method">request method</a>, <a href="#request-url">request URL</a>, and
     <a href="#synchronous-flag">synchronous flag</a>.</p>
 
-    <p>Throws a "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception if
+    <p>Throws a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code> if
     either <var title="">method</var> is not a valid HTTP method or
     <var title="">url</var> cannot be parsed.
 
@@ -815,8 +815,7 @@
   </ol>
 
  <li><p>If <var>method</var> does not match the <a class="external" href="http://tools.ietf.org/html/rfc2616/#section-5.1.1">Method</a> 
- token production, <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a
- "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception.
+ token production, <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code>.
 
  <li>
   <p>If <var>method</var> is a case-insensitive match for <code>CONNECT</code>, 
@@ -843,8 +842,7 @@
  with <var title="">base</var>.
 
  <li><p>If <var title="">parsed URL</var> is failure, 
- <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a 
- "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception.
+ <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code>.
 
  <li>
   <p>If <var title="">parsed URL</var>'s <a class="external" href="http://url.spec.whatwg.org/#relative-flag">relative flag</a> is 
@@ -922,7 +920,7 @@
     <a href="#dom-xmlhttprequest-opened" title="dom-XMLHttpRequest-OPENED">OPENED</a> or if the
     <a href="#send-flag"><code>send()</code> flag</a> is set.</p>
 
-    <p>Throws a "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception if
+    <p>Throws a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code> if
     <var title="">header</var> is not a valid HTTP header field name or if
     <var title="">value</var> is not a valid HTTP header field value.</p>
    </dd>
@@ -956,14 +954,12 @@
 
    <li><p>If <var>header</var> does not match the
    <a class="external" href="http://tools.ietf.org/html/rfc2616/#section-4.2">field-name</a> production,
-   <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a
-   "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception.
+   <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code>.
 
    <li>
     <p>If <var>value</var> does not match the
     <a class="external" href="http://tools.ietf.org/html/rfc2616/#section-4.2">field-value</a> production,
-    <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a
-    "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception.
+    <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code>.
 
     <p class="note">An empty string represents an empty header field value.
 
@@ -2308,7 +2304,7 @@
     <a href="#dom-xmlhttprequest-loading" title="dom-XMLHttpRequest-LOADING">LOADING</a> or
     <a href="#dom-xmlhttprequest-done" title="dom-XMLHttpRequest-DONE">DONE</a>.
 
-    <p>Throws a "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception if
+    <p>Throws a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code> if
     <var title="">mime</var> is not a valid media type.</p>
    </dd>
   </dl>
@@ -2326,8 +2322,7 @@
 
    <li><p>If parsing <var title="">mime</var> analogously to the value of
    the <code>Content-Type</code> header fails,
-   <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a
-   "<code class="external"><a href="http://dev.w3.org/2006/webapi/DOM4Core/#syntaxerror">SyntaxError</a></code>" exception.
+   <a class="external" href="http://dev.w3.org/2006/webapi/DOM4Core/#concept-throw" title="concept-throw">throw</a> a JavaScript <code class="external"><a href="http://dev.w3.org/2006/webapi/WebIDL/#dfn-predefined-exception">TypeError</a></code>.
 
    <li><p>If <var title="">mime</var> is successfully parsed, set
    <a href="#override-mime-type">override MIME type</a> to its MIME type,
--- a/Overview.src.html	Wed Oct 23 15:23:05 2013 +0900
+++ b/Overview.src.html	Wed Oct 23 15:54:59 2013 +0900
@@ -757,7 +757,7 @@
     <p>Sets the <span>request method</span>, <span>request URL</span>, and
     <span>synchronous flag</span>.</p>
 
-    <p>Throws a "<code data-anolis-spec=dom>SyntaxError</code>" exception if
+    <p>Throws a JavaScript <code data-anolis-spec=webidl>TypeError</code> if
     either <var title>method</var> is not a valid HTTP method or
     <var title>url</var> cannot be parsed.
 
@@ -824,8 +824,7 @@
   </ol>
 
  <li><p>If <var>method</var> does not match the <span data-anolis-spec=http>Method</span> 
- token production, <span data-anolis-spec=dom title=concept-throw>throw</span> a
- "<code data-anolis-spec=dom>SyntaxError</code>" exception.
+ token production, <span data-anolis-spec=dom title=concept-throw>throw</span> a JavaScript <code data-anolis-spec=webidl>TypeError</code>.
 
  <li>
   <p>If <var>method</var> is a case-insensitive match for <code>CONNECT</code>, 
@@ -852,8 +851,7 @@
  with <var title>base</var>.
 
  <li><p>If <var title>parsed URL</var> is failure, 
- <span data-anolis-spec=dom title=concept-throw>throw</span> a 
- "<code data-anolis-spec=dom>SyntaxError</code>" exception.
+ <span data-anolis-spec=dom title=concept-throw>throw</span> a JavaScript <code data-anolis-spec=webidl>TypeError</code>.
 
  <li>
   <p>If <var title>parsed URL</var>'s <span data-anolis-spec=url>relative flag</span> is 
@@ -931,7 +929,7 @@
     <span title="dom-XMLHttpRequest-OPENED">OPENED</span> or if the
     <span><code>send()</code> flag</span> is set.</p>
 
-    <p>Throws a "<code data-anolis-spec=dom>SyntaxError</code>" exception if
+    <p>Throws a JavaScript <code data-anolis-spec=webidl>TypeError</code> if
     <var title>header</var> is not a valid HTTP header field name or if
     <var title>value</var> is not a valid HTTP header field value.</p>
    </dd>
@@ -965,14 +963,12 @@
 
    <li><p>If <var>header</var> does not match the
    <span data-anolis-spec=http>field-name</span> production,
-   <span data-anolis-spec=dom title=concept-throw>throw</span> a
-   "<code data-anolis-spec=dom>SyntaxError</code>" exception.
+   <span data-anolis-spec=dom title=concept-throw>throw</span> a JavaScript <code data-anolis-spec=webidl>TypeError</code>.
 
    <li>
     <p>If <var>value</var> does not match the
     <span data-anolis-spec=http>field-value</span> production,
-    <span data-anolis-spec=dom title=concept-throw>throw</span> a
-    "<code data-anolis-spec=dom>SyntaxError</code>" exception.
+    <span data-anolis-spec=dom title=concept-throw>throw</span> a JavaScript <code data-anolis-spec=webidl>TypeError</code>.
 
     <p class=note>An empty string represents an empty header field value.
 
@@ -2317,7 +2313,7 @@
     <span title="dom-XMLHttpRequest-LOADING">LOADING</span> or
     <span title="dom-XMLHttpRequest-DONE">DONE</span>.
 
-    <p>Throws a "<code data-anolis-spec=dom>SyntaxError</code>" exception if
+    <p>Throws a JavaScript <code data-anolis-spec=webidl>TypeError</code> if
     <var title>mime</var> is not a valid media type.</p>
    </dd>
   </dl>
@@ -2335,8 +2331,7 @@
 
    <li><p>If parsing <var title>mime</var> analogously to the value of
    the <code>Content-Type</code> header fails,
-   <span data-anolis-spec=dom title=concept-throw>throw</span> a
-   "<code data-anolis-spec=dom>SyntaxError</code>" exception.
+   <span data-anolis-spec=dom title=concept-throw>throw</span> a JavaScript <code data-anolis-spec=webidl>TypeError</code>.
 
    <li><p>If <var title>mime</var> is successfully parsed, set
    <span>override MIME type</span> to its MIME type,
--- a/data/xrefs/dom/webidl.json	Wed Oct 23 15:23:05 2013 +0900
+++ b/data/xrefs/dom/webidl.json	Wed Oct 23 15:54:59 2013 +0900
@@ -17,6 +17,7 @@
     "supported property names": "dfn-supported-property-names",
     "support named properties": "dfn-support-named-properties",
     "throw": "dfn-throw",
+    "typeerror": "dfn-predefined-exception",
     "unsigned long": "idl-unsigned-long"
   },
   "url": "http://dev.w3.org/2006/webapi/WebIDL/#"