Replace "asynchronous completions" with a callback algorithm#8264
Conversation
domenic
left a comment
There was a problem hiding this comment.
Really great work; much appreciated!
|
@domenic This should be ready!
|
domenic
left a comment
There was a problem hiding this comment.
Looks great, with a few nits! Impressive work on refactoring the worklet stuff and the descendants!
| data-x="fetching-scripts-processCustomFetchResponse">processCustomFetchResponse</i> given <span | ||
| data-x="concept-response">response</span> <var>response</var>.</p> | ||
|
|
||
| <p>Otherwise, <span data-x="concept-fetch">fetch</span> <var>request</var>. Return from this |
There was a problem hiding this comment.
Hmm, I guess we are using processResponseConsumeBody here, but that is not really correct since step 10 later tries to mess with the body, and it mismatches processCustomFetchResponse which takes a response, not a body...
I guess since this is a preexisting problem, we can defer it until we fix the third bullet point from #7996. It just got a little easier to see the problem now, since processCustomFetchResponse and processResponseConsumeBody have a clear signature mismatch.
| @@ -92878,9 +92900,10 @@ document.querySelector("button").addEventListener("click", bound); | |||
| <p>If the caller specified custom steps to <span data-x="fetching-scripts-perform-fetch">perform | |||
| the fetch</span>, perform them on <var>request</var>, with the <var | |||
| data-x="fetching-scripts-is-top-level">is top-level</var> flag set. Return from this algorithm, | |||
There was a problem hiding this comment.
I think as part of #7996 we should eventually stop using the "Return from this algorithm and run the remaining steps" style, and just use explicit callbacks. Especially since we have the same callback being passed to two different algorithms.
I think your "onComplete as defined below" style is pretty good for this.
|
Thanks for the review! I added the two more general comments to #7996 and I'll handle them in separate PRs, to keep this one about async completions. |
domenic
left a comment
There was a problem hiding this comment.
LGTM with one suggested change that I'd like your confirmation on, otherwise I would just push it and merge myself.
This fixes the first bullet point of #7996.
/links.html ( diff )
/scripting.html ( diff )
/webappapis.html ( diff )
/workers.html ( diff )
/worklets.html ( diff )