-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Replace "asynchronous completions" with a callback algorithm #8264
Replace "asynchronous completions" with a callback algorithm #8264
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really great work; much appreciated!
@domenic This should be ready!
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, with a few nits! Impressive work on refactoring the worklet stuff and the descendants!
and run the remaining steps as part of the <span data-x="fetching-scripts-perform-fetch">perform | ||
the fetch</span>'s <i | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 )