Skip to content
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

Add abstractions for creating Request and Response objects #1157

Merged
merged 3 commits into from
Feb 2, 2021

Conversation

annevk
Copy link
Member

@annevk annevk commented Feb 1, 2021

Closes #771.


Preview | Diff


<li><p><a>Abort fetch</a> with <var>p</var>, <var>request</var>, and
<var>responseObject</var>.
<li><p><a>Abort fetch</a> with <var>p</var>, <var>request</var>, and <var>responseObject</var>.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this works as at this point responseObject is null and later it might get a value at which point we'd want this to operate on that value I think. Is there a better way to tackle this?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you check the signal right before creating the response object?

fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
fetch.bs Outdated Show resolved Hide resolved
Copy link
Collaborator

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor things, otherwise LGTM

@annevk
Copy link
Member Author

annevk commented Feb 1, 2021

For the eventual commit message:

@@ -6633,7 +6653,8 @@ method steps are:
<li><p>If <var>response</var> is a <a>network error</a>, then <a for=/>reject</a> <var>p</var>
with a {{TypeError}} and terminate these substeps.

<li><p>Associate <var>responseObject</var> with <var>response</var>.
<li><p>Set <var>responseObject</var> to the result of <a for=Response>creating</a> a {{Response}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're worried about races between this and the "Abort fetch" line above, you could check the state locallyAborted and abort these steps if it's true.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's step 1 here so I think we're good, no?

Copy link
Collaborator

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@annevk annevk merged commit 987c3fd into main Feb 2, 2021
@annevk annevk deleted the annevk/abstract-request-response branch February 2, 2021 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Creating new request & response objects could be easier
2 participants