Skip to content

Commit

Permalink
extract duplication.
Browse files Browse the repository at this point in the history
  • Loading branch information
botandrose-machine committed Sep 26, 2024
1 parent 966ddda commit 064357c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/core/frames/frame_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,7 @@ export class FrameController {
const frame = this.#findFrameElement(formSubmission.formElement, formSubmission.submitter)

frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(formSubmission.submitter, formSubmission.formElement, frame))
if (frame.src && pathnamesAreEqual(frame.src, response.response.url) && frame.shouldReloadWithMorph) {
frame.delegate.#shouldMorphFrame = true
}
frame.delegate.decideOnMorphingTo(response.response.url)
frame.delegate.loadResponse(response)

if (!formSubmission.isSafe) {
Expand Down Expand Up @@ -345,13 +343,17 @@ export class FrameController {
frame.delegate.proposeVisitIfNavigatedWithAction(frame, getVisitAction(submitter, element, frame))

this.#withCurrentNavigationElement(element, () => {
if (frame.src && pathnamesAreEqual(frame.src, url) && frame.shouldReloadWithMorph) {
frame.delegate.#shouldMorphFrame = true
}
frame.delegate.decideOnMorphingTo(url)
frame.src = url
})
}

decideOnMorphingTo(url) {
if (this.element.src && pathnamesAreEqual(this.element.src, url) && this.element.shouldReloadWithMorph) {
this.#shouldMorphFrame = true
}
}

proposeVisitIfNavigatedWithAction(frame, action = null) {
this.action = action

Expand Down

0 comments on commit 064357c

Please sign in to comment.