@@ -5158,11 +5158,6 @@ over just using {{SyntaxError!!exception}} to refer to the {{DOMException}}. [[D
5158
5158
<td><strong>Deprecated.</strong></td>
5159
5159
<td><dfn id="dom-domexception-url_mismatch_err" for="DOMException" const export><code>URL_MISMATCH_ERR</code></dfn> (21)</td>
5160
5160
</tr>
5161
- <tr>
5162
- <td>"<dfn id="quotaexceedederror" exception export><code>QuotaExceededError</code></dfn>"</td>
5163
- <td>The quota has been exceeded.</td>
5164
- <td><dfn id="dom-domexception-quota_exceeded_err" for="DOMException" const export><code>QUOTA_EXCEEDED_ERR</code></dfn> (22)</td>
5165
- </tr>
5166
5161
<tr>
5167
5162
<td>"<dfn id="timeouterror" exception export><code>TimeoutError</code></dfn>"</td>
5168
5163
<td>The operation timed out.</td>
@@ -5260,70 +5255,114 @@ certain rules, in order to have a predictable shape for developers. Specifically
5260
5255
<p class=note>These requirements mean that the inherited {{DOMException/code}} property of these
5261
5256
interfaces will always return 0.
5262
5257
5263
- <div class=example id=example-domexception-derived-interface>
5264
- The definition for a {{DOMException}} derived interface which carries along an additional
5265
- "protocol error code", which is derived from what the server sent over some some hypothetical
5266
- network protocol "protocol X", could look something like this:
5258
+ To [=exception/create=] or [=exception/throw=] a {{DOMException}} derived interface, supply its
5259
+ [=interface=] [=identifier=] as well as the additional information needed to construct it.
5267
5260
5268
- <pre highlight=webidl>
5269
- [Exposed=Window, Serializable]
5270
- interface ProtocolXError : DOMException {
5271
- constructor(optional DOMString message = "", ProtocolXErrorOptions options);
5261
+ <div class=example id=example-domexception-derived-throwing>
5262
+ <p>To throw an instance of {{QuotaExceededError}}:
5272
5263
5273
- readonly attribute unsigned long long errorCode;
5274
- };
5264
+ <blockquote>
5265
+ <p>[=exception/Throw=] a {{QuotaExceededError}} whose [=QuotaExceededError/quota=] is 42 and
5266
+ [=QuotaExceededError/requested=] is 50.
5267
+ </blockquote>
5268
+ </div>
5275
5269
5276
- dictionary ProtocolXErrorOptions {
5277
- required [EnforceRange] unsigned long long errorCode;
5278
- };
5279
- </pre>
5270
+ <h4 id="idl-DOMException-derived-predefineds" oldids="example-domexception-derived-interface">Predefined {{DOMException}} derived interfaces</h4>
5280
5271
5281
- Every <code>ProtocolXError</code> instance has an <dfn for="ProtocolXError">error code</dfn>,
5282
- a number.
5272
+ This standard so far defines one predefined {{DOMException}} derived interface:
5283
5273
5284
- <div algorithm="ProtocolXError constructor">
5285
- The <b><code>new ProtocolXError(|message|, |options|)</code></b> constructor steps are:
5274
+ <pre class=idl>
5275
+ [Exposed=*, Serializable]
5276
+ interface QuotaExceededError : DOMException {
5277
+ constructor(optional DOMString message = "", optional QuotaExceededErrorOptions options = {});
5286
5278
5287
- 1. Set [=this=]'s [=DOMException/name=] to "<code>ProtocolXError</code>".
5288
- 1. Set [=this=]'s [=DOMException/message=] to |message|.
5289
- 1. Set [=this=]'s [=ProtocolXError/error code=] to |options|["<code>errorCode</code>"].
5290
- </div>
5279
+ readonly attribute double? quota;
5280
+ readonly attribute double? requested;
5281
+ };
5291
5282
5292
- <div algorithm="ProtocolXError errorCode">
5293
- The <b><code>errorCode</code></b> getter steps are to return [=this=]'s
5294
- [=ProtocolXError/error code=].
5295
- </div>
5283
+ dictionary QuotaExceededErrorOptions {
5284
+ double quota;
5285
+ double requested;
5286
+ };
5287
+ </pre>
5296
5288
5297
- <code>ProtocolXError</code> objects are [=serializable objects=].
5289
+ The {{QuotaExceededError}} exception can be thrown when a quota is exceeded. It has two properties
5290
+ that are optionally present, to give more information to the web developer about their request
5291
+ compared to the quota value.
5298
5292
5299
- <div algorithm="ProtocolXError serialization steps">
5300
- Their [=serialization steps=], given |value| and |serialized|, are:
5293
+ <p class="note">Previous versions of this standard defined "<code>QuotaExceededError</code>" as one
5294
+ of the <a href="#idl-DOMException-error-names">base <code>DOMException</code> error names</a>. It
5295
+ has been upgraded to a full interface to support including such information.</p>
5301
5296
5302
- 1. Run the {{DOMException}} [=serialization steps=] given |value| and |serialized|.
5303
- 1. Set |serialized|.\[[ErrorCode]] to |value|'s [=ProtocolXError/error code=].
5304
- </div>
5297
+ Every {{QuotaExceededError}} instance has a <dfn for="QuotaExceededError">requested</dfn> and a
5298
+ <dfn for="QuotaExceededError">quota</dfn>, both numbers or null. They are both initially null.
5299
+
5300
+ <div algorithm>
5301
+ The <dfn constructor for="QuotaExceededError" lt="QuotaExceededError(message, options)">new QuotaExceededError(|message|, |options|)</dfn>
5302
+ constructor steps are:
5305
5303
5306
- <div algorithm="ProtocolXError deserialization steps">
5307
- Their [=deserialization steps=], given |serialized| and |value|, are:
5304
+ 1. Set [=this=]'s [=DOMException/name=] to "<code>QuotaExceededError</code>".
5308
5305
5309
- 1. Run the {{DOMException}} [=deserialization steps=] given |serialized| and |value|.
5310
- 1. Set |value|'s [=ProtocolXError/error code=] to |serialized|.\[[ErrorCode]].
5311
- </div>
5306
+ 1. Set [=this=]'s [=DOMException/message=] to |message|.
5307
+
5308
+ 1. If |options|["{{QuotaExceededErrorOptions/quota}}"] is present, then:
5309
+
5310
+ 1. If |options|["{{QuotaExceededErrorOptions/quota}}"] is less than 0, then throw a
5311
+ {{RangeError}}.
5312
+
5313
+ 1. Set [=this=]'s [=QuotaExceededError/quota=] to
5314
+ |options|["{{QuotaExceededErrorOptions/quota}}"].
5315
+
5316
+ 1. If |options|["{{QuotaExceededErrorOptions/requested}}"] is present, then:
5317
+
5318
+ 1. If |options|["{{QuotaExceededErrorOptions/requested}}"] is less than 0, then throw a
5319
+ {{RangeError}}.
5320
+
5321
+ 1. Set [=this=]'s [=QuotaExceededError/requested=] to
5322
+ |options|["{{QuotaExceededErrorOptions/requested}}"].
5323
+
5324
+ 1. If [=this=]'s [=QuotaExceededError/quota=] is not null, [=this=]'s [=QuotaExceededError/requested=] is not null,
5325
+ and [=this=]'s [=QuotaExceededError/requested=] is less than [=this=]'s [=QuotaExceededError/quota=], then
5326
+ throw a {{RangeError}}.
5312
5327
</div>
5313
5328
5314
- To [=exception/create=] or [=exception/throw=] a {{DOMException}} derived interface, supply its
5315
- [=interface=] [=identifier=] as well as the additional information needed to construct it .
5329
+ The <dfn attribute for="QuotaExceededError">quota</dfn> getter steps are to return [=this=]'s
5330
+ [=QuotaExceededError/quota=] .
5316
5331
5317
- <div class=example id=example-domexception-derived-throwing>
5318
- <p>To throw an instance of the <code>ProtocolXError</code> exemplified
5319
- <a href=#example-domexception-derived-interface>above</a>:
5332
+ The <dfn attribute for="QuotaExceededError">requested</dfn> getter steps are to return [=this=]'s
5333
+ [=QuotaExceededError/requested=].
5320
5334
5321
- <blockquote>
5322
- <p>[=exception/Throw=] a <code>ProtocolXError</code> whose [=ProtocolXError/error code=]
5323
- is 42.
5324
- </blockquote>
5335
+ <hr>
5336
+
5337
+ {{QuotaExceededError}} objects are [=serializable objects=].
5338
+
5339
+ <div algorithm="QuotaExceededError serialization steps">
5340
+ Their [=serialization steps=], given |value| and |serialized|, are:
5341
+
5342
+ 1. Run the {{DOMException}} [=serialization steps=] given |value| and |serialized|.
5343
+
5344
+ 1. Set |serialized|.\[[Quota]] to |value|'s [=QuotaExceededError/quota=].
5345
+
5346
+ 1. Set |serialized|.\[[Requested]] to |value|'s [=QuotaExceededError/requested=].
5325
5347
</div>
5326
5348
5349
+ <div algorithm="QuotaExceededError deserialization steps">
5350
+ Their [=deserialization steps=], given |serialized| and |value|, are:
5351
+
5352
+ 1. Run the {{DOMException}} [=deserialization steps=] given |serialized| and |value|.
5353
+
5354
+ 1. Set |value|'s [=QuotaExceededError/quota=] to |serialized|.\[[Quota]].
5355
+
5356
+ 1. Set |value|'s [=QuotaExceededError/requested=] to |serialized|.\[[Requested]].
5357
+ </div>
5358
+
5359
+ <hr>
5360
+
5361
+ Specifications that [=exception/create=] or [=exception/throw=] a {{QuotaExceededError}} must not
5362
+ provide a [=QuotaExceededError/requested=] and [=QuotaExceededError/quota=] that are both non-null
5363
+ and where [=QuotaExceededError/requested=] is less than [=QuotaExceededError/quota=].
5364
+
5365
+
5327
5366
<h3 id="idl-enums">Enumerations</h3>
5328
5367
5329
5368
An <dfn id="dfn-enumeration" export>enumeration</dfn> is a definition (matching
@@ -6651,7 +6690,8 @@ There is no way to represent a constant observable array value in IDL.
6651
6690
6652
6691
1. If |employee| is not allowed to enter the building today, then throw a
6653
6692
"{{NotAllowedError}}" {{DOMException}}.
6654
- 1. If |index| is greater than 200, then throw a "{{QuotaExceededError}}" {{DOMException}}.
6693
+ 1. If |index| is greater than or equal to 200, then throw a {{QuotaExceededError}} whose
6694
+ [=QuotaExceededError/quota=] is 200 and [=QuotaExceededError/requested=] is |index|.
6655
6695
1. Put |employee| to work!
6656
6696
6657
6697
The [=observable array attribute/delete an indexed value=] algorithm for
0 commit comments