Skip to content

Commit

Permalink
Editorial: use global task to resolve promises (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoscaceres authored May 30, 2022
1 parent c1e3ac9 commit a13659e
Showing 1 changed file with 26 additions and 19 deletions.
45 changes: 26 additions & 19 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ <h4>
return [=a promise rejected with=] an {{"InvalidStateError"}}
{{DOMException}}.
</li>
<li>Let |window| be [=relevant global object=] of [=this=].
<li>Let |global:Window| be [=this=]'s [=relevant global object=].
</li>
<li>If |window| does not have [=transient activation=], return [=a
<li>If |global| does not have [=transient activation=], return [=a
promise rejected with=] a {{"NotAllowedError"}} {{DOMException}}.
</li>
<li>[=Consume user activation=] of |window|.
<li>[=Consume user activation=] of |global|.
</li>
<li>Let |base:URL| be [=this=]'s <a>relevant settings object</a>'s
[=environment settings object/API base URL=].
Expand Down Expand Up @@ -224,11 +224,12 @@ <h4>
<li>Return [=this=].{{Navigator/[[sharePromise]]}} and <a>in
parallel</a>:
<ol>
<li>If there are no <a>share targets</a> available:
<li>If there are no <a>share targets</a> available, [=queue a
global task=] on the [=user interaction task source=] using
|global| to:
<ol>
<li>
<a>Reject</a> [=this=].{{Navigator/[[sharePromise]]}}
with an {{"AbortError"}} {{DOMException}}.
<li>[=Reject=] [=this=].{{Navigator/[[sharePromise]]}} with
an {{"AbortError"}} {{DOMException}}.
</li>
<li>Set [=this=].{{Navigator/[[sharePromise]]}} to `null`.
</li>
Expand All @@ -241,11 +242,12 @@ <h4>
MUST be given the option to cancel rather than choosing any of
the share targets. Wait for the user's choice.
</li>
<li>If the user chose to cancel the share operation:
<li>If the user chose to cancel the share operation, [=queue a
global task=] on the [=user interaction task source=] using
|global| to:
<ol>
<li>
<a>Reject</a> [=this=].{{Navigator/[[sharePromise]]}}
with an {{"AbortError"}} {{DOMException}},
<li>[=Reject=] [=this=].{{Navigator/[[sharePromise]]}} with
an {{"AbortError"}} {{DOMException}},
</li>
<li>Set [=this=].{{Navigator/[[sharePromise]]}} to `null`.
</li>
Expand All @@ -258,11 +260,11 @@ <h4>
transmit the converted data to the target.
</li>
<li>If an error occurs starting the target or transmitting the
data:
data, [=queue a global task=] on the [=user interaction task
source=] using |global| to:
<ol>
<li>
<a>Reject</a> [=this=].{{Navigator/[[sharePromise]]}}
with an {{"DataError"}} {{DOMException}}.
<li>[=Reject=] [=this=].{{Navigator/[[sharePromise]]}} with
an {{"DataError"}} {{DOMException}}.
</li>
<li>Set [=this=].{{Navigator/[[sharePromise]]}} to `null`.
</li>
Expand All @@ -273,10 +275,15 @@ <h4>
<li>Once the data has either been successfully transmitted to
the [=share target=], or successfully transmitted to the OS (if
the transmission to the [=share target=] cannot be confirmed),
<a>resolve</a> [=this=].{{Navigator/[[sharePromise]]}} with
`undefined`.
</li>
<li>Set [=this=].{{Navigator/[[sharePromise]]}} to `null`.
[=queue a global task=] on the [=user interaction task source=]
using |global| to:
<ol>
<li>[=Resolve=] [=this=].{{Navigator/[[sharePromise]]}}
with `undefined`.
</li>
<li>Set [=this=].{{Navigator/[[sharePromise]]}} to `null`.
</li>
</ol>
</li>
</ol>
</li>
Expand Down

0 comments on commit a13659e

Please sign in to comment.