Re: [whatwg/fetch] Editorial: align with new IDL patterns (#1054)

@domenic approved this pull request.

Looks good; this is a nice upgrade. (I wonder if we've killed off WHATWG uses of "context object" at this point?)

I found a number of potential additional improvements while I was reading the output, but they're pretty much all preexisting issues.

> @@ -6169,8 +6140,8 @@ initially a new {{AbortSignal}} object.
 <hr>
 
 <p>The
-<dfn constructor for=Request id=dom-request><code>Request(<var>input</var>, <var>init</var>)</code></dfn>
-constructor must run these steps:
+<dfn constructor for=Request id=dom-request lt="Request(input, init)"><code>new Request(<var>input</var>, <var>init</var>)</code></dfn>
+constructor steps are:

This uses "current settings object" for client

>  
-<p>The <dfn attribute for=Request><code>referrer</code></dfn> attribute's getter, when invoked, must
-return the empty string if the <a>context object</a>'s <a for=Request>request</a>'s
-<a for=request>referrer</a> is "<code>no-referrer</code>", "<code>about:client</code>" if the
-<a>context object</a>'s <a for=Request>request</a>'s <a for=request>referrer</a> is
-"<code>client</code>", and the <a>context object</a>'s <a for=Request>request</a>'s
-<a for=request>referrer</a>, <a lt="url serializer">serialized</a>, otherwise.
+<p>The <dfn attribute for=Request><code>referrer</code></dfn> getter steps are to return

This might be nicer as numbered steps

> @@ -6667,8 +6632,8 @@ enum ResponseType { "basic", "cors", "default", "error", "opaque", "opaqueredire
 <a for=Response>response</a>'s <a for=response>body</a>.
 
 <p>The
-<dfn constructor for=Response id=dom-response><code>Response(<var>body</var>, <var>init</var>)</code></dfn>
-constructor, when invoked, must run these steps:
+<dfn constructor for=Response id=dom-response lt="Response(body, init)"><code>new Response(<var>body</var>, <var>init</var>)</code></dfn>
+constructor steps are:
 
 <ol>
  <li><p>If <var>init</var>["{{ResponseInit/status}}"] is not in the range <code>200</code> to

This step could be slightly modernized, by linking RangeError and de-codeifying the numbers.

>  </ol>
 
-<p>The static <dfn method for=Response><code>error()</code></dfn> method, when invoked, must run
-these steps:
+<p>The static <dfn method for=Response><code>error()</code></dfn> method steps are:
 
 <ol>
  <li><p>Let <var>r</var> be a new {{Response}} object, whose <a for=Response>response</a> is a new

This could link to https://heycam.github.io/webidl/#new and state the realm (current realm).

There are a total of 6 nearby object creations that could do the same.

> @@ -6742,8 +6703,8 @@ these steps:
 </ol>
 
 <p>The static
-<dfn method for=Response><code>redirect(<var>url</var>, <var>status</var>)</code></dfn>
-method, when invoked, must run these steps:
+<dfn method for=Response><code>redirect(<var>url</var>, <var>status</var>)</code></dfn> method steps
+are:
 
 <ol>
  <li><p>Let <var>parsedURL</var> be the result of

In here there's an unlinked `RangeError`.

> @@ -6772,57 +6733,54 @@ method, when invoked, must run these steps:
  <li><p>Return <var>r</var>.

> Append `Location` to parsedURL, serialized and isomorphic encoded, in r’s response’s header list. 

This seems wrong; should it be something like

> 1. Let urlBytes be parsedURL, serialized and isomorphic encoded
> 2. Append `Location`/urlBytes to r's resopnse's header list

?

> @@ -6841,14 +6799,14 @@ partial interface mixin WindowOrWorkerGlobalScope {
 
 <p>The
 <dfn id=dom-global-fetch method for=WindowOrWorkerGlobalScope><code>fetch(<var>input</var>, <var>init</var>)</code></dfn>
-method, must run these steps:
+method steps are:
 
 <ol>
  <li><p>Let <var>p</var> be a new promise.

This could be `[=a new promise=]`, although then you should specify the realm; I'd be curious whether it's relevant or current in implementations...

> @@ -6841,14 +6799,14 @@ partial interface mixin WindowOrWorkerGlobalScope {
 
 <p>The
 <dfn id=dom-global-fetch method for=WindowOrWorkerGlobalScope><code>fetch(<var>input</var>, <var>init</var>)</code></dfn>
-method, must run these steps:
+method steps are:

The object construction in here is pretty sketchy, but I imagine you're aware already, and any solutions would probably be larger diffs than makes sense for this PR.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1054#pullrequestreview-448111934

Received on Tuesday, 14 July 2020 13:50:01 UTC