Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the Error IDL type #728

Merged
merged 4 commits into from May 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
115 changes: 3 additions & 112 deletions index.bs
Expand Up @@ -3393,7 +3393,6 @@ the following algorithm returns <i>true</i>.
<dt>interface-like</dt>
<dd>
* [=interface types=]
* [=exception types=]
* [=buffer source types=]
<dt>dictionary-like</dt>
<dd>
Expand Down Expand Up @@ -4767,13 +4766,10 @@ listed in the [=error names table=] below.
The table also indicates the {{DOMException}}'s integer code for that error name,
if it has one.

There are two types that can be used to refer to exception objects:
{{DOMException}} and {{Error!!interface}},
where the latter encompasses [=simple exceptions=] and {{DOMException}}.
Note: As {{DOMException}} is an [=interface type=], it can be used as a type in IDL.
This allows for example an [=operation=]
to be declared to have a {{DOMException}}
[=return type=] or an [=attribute=]
to be of type {{Error!!interface}}.
[=return type=].

[=Simple exceptions=] can be <dfn id="dfn-create-exception" for="exception" export>created</dfn>
by providing their [=error name=].
Expand Down Expand Up @@ -5306,9 +5302,6 @@ The <dfn id="dfn-string-type" export>string types</dfn> are
{{DOMString}}, all [=enumeration types=],
{{ByteString}} and {{USVString}}.

The <dfn id="dfn-exception-type" export>exception types</dfn> are
{{Error!!interface}} and {{DOMException}}.

The <dfn id="dfn-typed-array-type" export>typed array types</dfn> are
{{Int8Array}},
{{Int16Array}},
Expand All @@ -5326,9 +5319,8 @@ are {{ArrayBuffer}},
and the [=typed array types=].

The {{object}} type,
all [=interface types=],
all [=interface types=], and
all [=callback interface types=]
and the [=exception types=]
are known as <dfn id="dfn-object-type" export>object types</dfn>.

Every type has a <dfn id="dfn-type-name" export>type name</dfn>, which
Expand Down Expand Up @@ -5394,7 +5386,6 @@ type.
"sequence" "&lt;" TypeWithExtendedAttributes "&gt;" Null
"object" Null
"symbol" Null
"Error" Null
BufferRelatedType Null
"FrozenArray" "&lt;" TypeWithExtendedAttributes "&gt;" Null
RecordType Null
Expand Down Expand Up @@ -6294,19 +6285,6 @@ type name of the original type with the set of strings corresponding to the [=id
The [=type name=] for a type of the form <code>[B, A] long?</code> is "LongOrNullAB".
</div>

<h4 oldids="dom-Error" id="idl-Error" interface>Error</h4>

The {{Error!!interface}} type corresponds to the
set of all possible non-null references to exception objects,
including [=simple exceptions=] and {{DOMException}} objects.

There is no way to represent a constant {{Error!!interface}}
value in IDL.

The [=type name=] of the
{{Error!!interface}} type is "<code>Error</code>".


<h4 id="idl-buffer-source-types">Buffer source types</h4>

There are a number of types that correspond to sets of all possible non-null
Expand Down Expand Up @@ -7905,19 +7883,6 @@ that correspond to the union’s [=member types=].
[=implements=], then return the IDL value that is a reference to the object |V|.
1. If |types| includes {{object}}, then return the IDL value
that is a reference to the object |V|.
1. If |V| is a {{DOMException}} platform object, then:
1. If |types| includes {{DOMException}} or
{{Error!!interface}}, then return the
result of [=converted to an IDL value|converting=]
|V| to that type.
1. If |types| includes {{object}}, then return the IDL value
that is a reference to the object |V|.
1. If <a abstract-op>Type</a>(|V|) is Object and |V| has an \[[ErrorData]] [=internal slot=]), then:
1. If |types| includes {{Error!!interface}}, then return the
result of [=converted to an IDL value|converting=]
|V| to {{Error!!interface}}.
1. If |types| includes {{object}}, then return the IDL value
that is a reference to the object |V|.
1. If <a abstract-op>Type</a>(|V|) is Object and |V| has an \[[ArrayBufferData]] [=internal slot=], then:
1. If |types| includes {{ArrayBuffer}}, then return the
result of [=converted to an IDL value|converting=]
Expand Down Expand Up @@ -8002,57 +7967,6 @@ that correspond to the union’s [=member types=].
</p>


<h4 id="es-Error">Error</h4>

IDL {{Error!!interface}} values are represented
by native ECMAScript {{ECMAScript/Error}} objects and
by {{DOMException}} platform objects.

<div id="es-to-Error" algorithm="convert an ECMAScript value to Error">

An ECMAScript value |V| is [=converted to an IDL value|converted=]
to an IDL {{Error!!interface}} value by running the following algorithm:

1. If <a abstract-op>Type</a>(|V|) is not Object,
or |V| does not have an \[[ErrorData]] [=internal slot=],
then [=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
1. Return the IDL {{Error!!interface}} value that is a reference
to the same object as |V|.
</div>

<p id="Error-to-es">
The result of [=converted to an ECMAScript value|converting=]
an IDL {{Error!!interface}} value to an ECMAScript
value is the {{ECMAScript/Error}} value that represents a reference to the same object that the
IDL {{Error!!interface}} represents.
</p>


<h4 id="es-DOMException">DOMException</h4>

IDL {{DOMException}} values are represented by
ECMAScript Object values.

<div id="es-to-DOMException" algorithm="convert an ECMAScript value to DOMException">

An ECMAScript value |V| is [=converted to an IDL value|converted=]
to an IDL {{DOMException}} value by running the following algorithm:

1. If <a abstract-op>Type</a>(|V|) is not Object,
or |V| is not a platform object that represents a {{DOMException}},
then [=ECMAScript/throw=] a {{ECMAScript/TypeError}}.
1. Return the IDL {{DOMException}} value that is a reference
to the same object as |V|.
</div>

<p id="DOMException-to-es">
The result of [=converted to an ECMAScript value|converting=]
an IDL {{DOMException}} value to an ECMAScript
value is the Object value that represents a reference to the same object that the
IDL {{DOMException}} represents.
</p>


<h4 id="es-buffer-source-types">Buffer source types</h4>

Values of the IDL [=buffer source types=]
Expand Down Expand Up @@ -10349,29 +10263,6 @@ Note: The HTML Standard defines how a security check is performed. [[!HTML]]

then remove from |S| all other entries.

1. Otherwise: if |V| is a {{DOMException}} platform object and
there is an entry in |S| that has one of the following types at position |i| of its type list,
* {{DOMException}}
* {{Error!!interface}}
* {{object}}
* a [=nullable type|nullable=] version of either of the above types
* an [=annotated type=] whose [=annotated types/inner type=] is one of the above types
* a [=union type=], [=nullable type|nullable=] union type, or [=annotated type|annotated=] union type
that has one of the above types in its [=flattened member types=]

then remove from |S| all other entries.

1. Otherwise: if <a abstract-op>Type</a>(|V|) is Object, |V| has an \[[ErrorData]] [=internal slot=], and
there is an entry in |S| that has one of the following types at position |i| of its type list,
* {{Error!!interface}}
* {{object}}
* a [=nullable type|nullable=] version of either of the above types
* an [=annotated type=] whose [=annotated types/inner type=] is one of the above types
* a [=union type=], [=nullable type|nullable=] union type, or [=annotated type|annotated=] union type
that has one of the above types in its [=flattened member types=]

then remove from |S| all other entries.

1. Otherwise: if <a abstract-op>Type</a>(|V|) is Object, |V| has an \[[ArrayBufferData]] [=internal slot=], and
there is an entry in |S| that has one of the following types at position |i| of its type list,
* {{ArrayBuffer}}
Expand Down