@@ -14559,13 +14559,20 @@ The {{DOMException}} type is an [=interface type=] defined by the following IDL
14559
14559
fragment:
14560
14560
14561
14561
<pre class="idl">
14562
+
14563
+ dictionary DOMExceptionOptions {
14564
+ any cause;
14565
+ DOMString name = "Error";
14566
+ };
14567
+
14562
14568
[Exposed=(Window,Worker),
14563
14569
Serializable]
14564
14570
interface DOMException { // but see below note about ECMAScript binding
14565
- constructor(optional DOMString message = "", optional DOMString name = "Error" );
14571
+ constructor(optional DOMString message = "", optional (DOMExceptionOptions or DOMString) options = {} );
14566
14572
readonly attribute DOMString name;
14567
14573
readonly attribute DOMString message;
14568
14574
readonly attribute unsigned short code;
14575
+ readonly attribute any cause;
14569
14576
14570
14577
const unsigned short INDEX_SIZE_ERR = 1;
14571
14578
const unsigned short DOMSTRING_SIZE_ERR = 2;
@@ -14601,19 +14608,28 @@ requirements beyond the normal ones for [=interface types=].
14601
14608
Each {{DOMException}} object has an associated <dfn for="DOMException">name</dfn> and
14602
14609
<dfn for="DOMException">message</dfn>, both [=strings=].
14603
14610
14611
+ Each {{DOMException}} object has an associated <dfn for="DOMException">cause</dfn>, which
14612
+ is a JavaScript value. It is {{undefined}} unless specified otherwise.
14613
+
14604
14614
The
14605
- <dfn constructor for="DOMException" lt="DOMException(message, name )"><code>new DOMException(|message|, |name |)</code></dfn>
14615
+ <dfn constructor for="DOMException" lt="DOMException(message, options )"><code>new DOMException(|message|, |options |)</code></dfn>
14606
14616
constructor steps are:
14607
14617
14608
- 1. Set [=this=]'s [=DOMException/name=] to |name|.
14609
- 1. Set [=this=]'s [=DOMException/message=] to |message|.
14618
+ 1. Set [=this=]'s [=DOMException/message=] to |message|.
14619
+ 1. If |options| is a string, then set [=this=]'s [=DOMException/name=] to |options|.
14620
+ 1. Otherwise,
14621
+ 1. Set [=this=]'s [=DOMException/name=] to |options|["{{DOMExceptionOptions/name}}"].
14622
+ 1. Set [=this=]'s [=DOMException/cause=] to |options|["{{DOMExceptionOptions/cause}}"].
14610
14623
14611
14624
The <dfn attribute for="DOMException"><code>name</code></dfn> getter steps are to return
14612
14625
[=this=]'s [=DOMException/name=].
14613
14626
14614
14627
The <dfn attribute for="DOMException"><code>message</code></dfn> getter steps are to
14615
14628
return [=this=]'s [=DOMException/message=].
14616
14629
14630
+ The <dfn attribute for="DOMException"><code>cause</code></dfn> getter steps are to
14631
+ return [=this=]'s [=DOMException/cause=].
14632
+
14617
14633
The <dfn attribute for="DOMException"><code>code</code></dfn> getter steps are to return the legacy
14618
14634
code indicated in the [=error names table=] for [=this=]'s [=DOMException/name=], or 0 if no such
14619
14635
entry exists in the table.
@@ -14625,6 +14641,7 @@ Their [=serialization steps=], given <var>value</var> and <var>serialized</var>,
14625
14641
<ol>
14626
14642
<li>Set <var>serialized</var>.\[[Name]] to <var>value</var>'s [=DOMException/name=].</li>
14627
14643
<li>Set <var>serialized</var>.\[[Message]] to <var>value</var>'s [=DOMException/message=].</li>
14644
+ <li>Set <var>serialized</var>.\[[Cause]] to <var>value</var>'s [=DOMException/cause=].</li>
14628
14645
<li>User agents should attach a serialized representation of any interesting accompanying data
14629
14646
which are not yet specified, notably the <code>stack</code> property, to
14630
14647
<var>serialized</var>.</li>
@@ -14635,6 +14652,7 @@ Their [=deserialization steps=], given <var>value</var> and <var>serialized</var
14635
14652
<ol>
14636
14653
<li>Set <var>value</var>'s [=DOMException/name=] to <var>serialized</var>.\[[Name]].</li>
14637
14654
<li>Set <var>value</var>'s [=DOMException/message=] to <var>serialized</var>.\[[Message]].</li>
14655
+ <li>Set <var>value</var>'s [=DOMException/cause=] to <var>serialized</var>.\[[Cause]].</li>
14638
14656
<li>If any other data is attached to <var>serialized</var>, then deserialize and attach it to
14639
14657
<var>value</var>.</li>
14640
14658
</ol>
0 commit comments