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

await for FetchRequest delegate to handle response #1039

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/frames/frame_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ export class FrameController {
}
}

async #visit(url) {
#visit(url) {
const request = new FetchRequest(this, FetchMethod.get, url, new URLSearchParams(), this.element)

this.#currentFetchRequest?.cancel()
Expand All @@ -333,7 +333,7 @@ export class FrameController {
this.#currentFetchRequest = null
resolve()
}
request.perform()
return request.perform()
})
}

Expand Down
4 changes: 2 additions & 2 deletions src/http/fetch_request.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ export class FetchRequest {
if (event.defaultPrevented) {
this.delegate.requestPreventedHandlingResponse(this, fetchResponse)
} else if (fetchResponse.succeeded) {
this.delegate.requestSucceededWithResponse(this, fetchResponse)
await this.delegate.requestSucceededWithResponse(this, fetchResponse)
} else {
this.delegate.requestFailedWithResponse(this, fetchResponse)
await this.delegate.requestFailedWithResponse(this, fetchResponse)
}
return fetchResponse
}
Expand Down
4 changes: 2 additions & 2 deletions src/tests/functional/frame_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ test("navigating pushing URL state from a frame navigation fires events", async
await nextEventOnTarget(page, "frame", "turbo:before-fetch-response")
await nextEventOnTarget(page, "frame", "turbo:frame-render")
await nextEventOnTarget(page, "frame", "turbo:frame-load")
assert.notOk(await nextAttributeMutationNamed(page, "frame", "aria-busy"), "removes aria-busy from the <turbo-frame>")

assert.equal(await nextAttributeMutationNamed(page, "html", "aria-busy"), "true", "sets aria-busy on the <html>")

assert.notOk(await nextAttributeMutationNamed(page, "frame", "aria-busy"), "removes aria-busy from the <turbo-frame>")
await nextEventOnTarget(page, "html", "turbo:before-visit")
await nextEventOnTarget(page, "html", "turbo:visit")
await nextEventOnTarget(page, "html", "turbo:before-cache")
Expand Down
Loading