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

Only snapshot frame visits that have actions #827

Merged
merged 1 commit into from
Dec 23, 2022
Merged
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
6 changes: 2 additions & 4 deletions src/core/frames/frame_controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export class FrameController
readonly restorationIdentifier: string
private previousFrameElement?: FrameElement
private currentNavigationElement?: Element
pageSnapshot?: PageSnapshot

constructor(element: FrameElement) {
this.element = element
Expand Down Expand Up @@ -199,7 +198,6 @@ export class FrameController
// Appearance observer delegate

elementAppearedInViewport(element: FrameElement) {
this.pageSnapshot = PageSnapshot.fromElement(element).clone()
this.proposeVisitIfNavigatedWithAction(element, element)
this.loadSourceURL()
}
Expand Down Expand Up @@ -369,7 +367,6 @@ export class FrameController

private navigateFrame(element: Element, url: string, submitter?: HTMLElement) {
const frame = this.findFrameElement(element, submitter)
this.pageSnapshot = PageSnapshot.fromElement(frame).clone()

frame.delegate.proposeVisitIfNavigatedWithAction(frame, element, submitter)

Expand All @@ -382,6 +379,7 @@ export class FrameController
this.action = getVisitAction(submitter, element, frame)

if (this.action) {
const pageSnapshot = PageSnapshot.fromElement(frame).clone()
const { visitCachedSnapshot } = frame.delegate

frame.delegate.fetchResponseLoaded = (fetchResponse: FetchResponse) => {
Expand All @@ -395,7 +393,7 @@ export class FrameController
willRender: false,
updateHistory: false,
restorationIdentifier: this.restorationIdentifier,
snapshot: this.pageSnapshot,
snapshot: pageSnapshot,
}

if (this.action) options.action = this.action
Expand Down