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

HTTP-redirect does not call processResponse and breaks navigation expectations #1629

Closed
kalenikaliaksandr opened this issue Apr 9, 2023 · 2 comments · Fixed by #1638
Closed
Assignees

Comments

@kalenikaliaksandr
Copy link

kalenikaliaksandr commented Apr 9, 2023

"create navigation params by fetching" in HTML navigation spec does following:

"6. Otherwise, process the next manual redirect for fetchController."

and has a note:

"This will result in calling the processResponse we supplied above, during our first iteration through the loop, and thus setting response."

but if we will look into fetch spec that what will happen while processing next manual redirect:

  1. Process manual redirect is set to HTTP-redirect fetch (https://fetch.spec.whatwg.org/#concept-http-fetch 7.2, "manual" case).
  2. Step 20 of HTTP-redirect fetch calls main fetch with fetchParams and true (redirect param).
  3. main fetch does early return of response on step 13:

If recursive is true, then return response.

because "HTTP-redirect fetch" passed recursive=true earlier.

This way main fetch never reaches fetch response handover where processResponse is called which means navigation code will stuck waiting for processResponse to be called.

I checked spec commit history and in the past instead of

Return the result of running main fetch given fetchParams and true.

there was in the HTTP-redirect fetch

Return the result of performing a main fetch using request with recursive flag set if request's redirect mode is not manual.

note that recursive should be false for manual redirect mode was introduced here c958914

and then got removed 12dd6fa

but for me it looks like this note should not have been removed because with redirect=false in manual redirect mode processResponse will be called which is what navigation expects.

@annevk
Copy link
Member

annevk commented Apr 20, 2023

Thank you for the clear report and doing the blame investigation. Very helpful.

As "navigate-redirect fetch" was removed in 8023bd0 we indeed need to restore the behavior of not passing recursive=true when redirect mode is manual.

@noamr @domenic does that make sense to you as well? @noamr want to make the fix?

@noamr
Copy link
Contributor

noamr commented Apr 20, 2023

Thank you for the clear report and doing the blame investigation. Very helpful.

As "navigate-redirect fetch" was removed in 8023bd0 we indeed need to restore the behavior of not passing recursive=true when redirect mode is manual.

@noamr @domenic does that make sense to you as well? @noamr want to make the fix?

On it

@noamr noamr self-assigned this Apr 23, 2023
noamr added a commit to noamr/fetch that referenced this issue Apr 23, 2023
annevk pushed a commit that referenced this issue Apr 24, 2023
Otherwise a navigation wouldn't get callbacks from processing its redirect.

Closes #1629.
kalenikaliaksandr added a commit to kalenikaliaksandr/serenity that referenced this issue Apr 24, 2023
kalenikaliaksandr added a commit to kalenikaliaksandr/serenity that referenced this issue Apr 24, 2023
linusg pushed a commit to SerenityOS/serenity that referenced this issue Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants