Skip to content

Commit

Permalink
Migrate to references exported from the WebIDL spec
Browse files Browse the repository at this point in the history
Algorithms for working with Promises have moved from [promises-guide] to
[WebIDL].

This change also creates an anchor for the "initializing the Document
object" algorithm in the HTML specification. This may not be the right
way of extending this algorithm with additional steps.
  • Loading branch information
reillyeon committed Sep 30, 2019
1 parent c225f0b commit f055705
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
41 changes: 21 additions & 20 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ spec: fingerprinting-guidance; urlPrefix: https://w3c.github.io/fingerprinting-g
type: dfn
text: fingerprinting surface; url: dfn-fingerprinting-surface

spec: html; urlPrefix: https://html.spec.whatwg.org/#
type: dfn
text: initializing the Document object; url: initialise-the-document-object

spec: WebIDL; urlPrefix: https://heycam.github.io/webidl/#
type: dfn
text: a copy of the bytes held; url: dfn-get-buffer-source-copy
Expand All @@ -121,7 +125,7 @@ spec: html
type: dfn
text: browsing context; for: /
text: global object; for: /
spec: promises-guide-1
spec: webidl
type: dfn
text: resolve
</pre>
Expand Down Expand Up @@ -1073,7 +1077,7 @@ spec: promises-guide-1
`null`
</td>
<td>
Set to a {{BluetoothDevice}} while <a>initializing a new `Document` object</a>
Set to a {{BluetoothDevice}} while <a>initializing the `Document` object</a>
if the `Document` was opened from the device.
</td>
</tr>
Expand All @@ -1096,7 +1100,7 @@ spec: promises-guide-1
advertises a URL,
the UA may allow the user to navigate to this URL.
</span>
If this happens, then as part of <a>initializing a new `Document` object</a>,
If this happens, then as part of <a>initializing the `Document` object</a>,
the UA MUST run the following steps:
</p>
<ol>
Expand Down Expand Up @@ -3114,15 +3118,15 @@ spec: promises-guide-1
Let <var>promise</var> be the result.
</li>
<li>
Return the result of
<a>transforming</a> <var>promise</var> with a fulfillment handler that:
<a>Upon fulfillment</a> of <var>promise</var> with |result|, run the
following steps:
<ul>
<li>If its argument is empty, throws a {{NotFoundError}},</li>
<li>If |result| is empty, throw a {{NotFoundError}},</li>
<li>
Otherwise, if the <var>single</var> flag is set,
returns the first (only) element of its argument.
returns the first (only) element of |result|.
</li>
<li>Otherwise, returns its argument.</li>
<li>Otherwise, return |result|.</li>
</ul>
</li>
</ol>
Expand Down Expand Up @@ -3430,16 +3434,14 @@ spec: promises-guide-1
<code><var>gattServer</var>.{{BluetoothRemoteGATTServer/[[activeAlgorithms]]}}</code>.
</li>
<li>
Return the result of <a>transforming</a> <var>promise</var>
with fulfillment and rejection handlers that perform the following steps:
<dl>
<dt>fulfillment handler</dt>
<dd>
<a>React</a> to <var>promise</var>:
<ul>
<li>If |promise| was fulfilled with value |result|, then:
<ol>
<li>
If <var>promise</var> is in
<code><var>gattServer</var>.{{BluetoothRemoteGATTServer/[[activeAlgorithms]]}}</code>,
remove it and return the first argument.
remove it and return |result|.
</li>
<li>
Otherwise, throw a {{NetworkError}}.
Expand All @@ -3449,14 +3451,13 @@ spec: promises-guide-1
</span>
</li>
</ol>
</dd>
<dt>rejection handler</dt>
<dd>
</li>
<li>If |promise| was rejected with reason |error|, then:
<ol>
<li>
If <var>promise</var> is in
<code><var>gattServer</var>.{{BluetoothRemoteGATTServer/[[activeAlgorithms]]}}</code>,
remove it and throw the first argument.
remove it and throw |error|.
</li>
<li>
Otherwise, throw a {{NetworkError}}.
Expand All @@ -3466,8 +3467,8 @@ spec: promises-guide-1
</span>
</li>
</ol>
</dd>
</dl>
</li>
</ul>
</li>
</ol>
</div>
Expand Down
2 changes: 1 addition & 1 deletion scanning.bs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec: web-bluetooth; urlPrefix: index.html#
text: BluetoothDevice
</pre>
<pre class="link-defaults">
spec: promises-guide-1
spec: webidl
type: dfn
text: resolve
spec:web-bluetooth
Expand Down

0 comments on commit f055705

Please sign in to comment.