From c0286151b5248114eeac91ec2297c9502f30e28a Mon Sep 17 00:00:00 2001 From: Sean Doyle Date: Tue, 21 Sep 2021 10:49:25 -0400 Subject: [PATCH] Add `linkClickIntercepted` to FrameElementDelegate Expand the `FrameElementDelegate` interface to include a `linkClickIntercepted` to match its existing `formSubmissionIntercepted`, then replace a manual `setAttribute` and `src` assignment with a delegation to the `FrameElementDelegate` instance. --- src/core/frames/frame_redirector.ts | 3 +-- src/elements/frame_element.ts | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/frames/frame_redirector.ts b/src/core/frames/frame_redirector.ts index 96fb89bcc..99bed0023 100644 --- a/src/core/frames/frame_redirector.ts +++ b/src/core/frames/frame_redirector.ts @@ -30,8 +30,7 @@ export class FrameRedirector implements LinkInterceptorDelegate, FormInterceptor linkClickIntercepted(element: Element, url: string) { const frame = this.findFrameElement(element) if (frame) { - frame.setAttribute("reloadable", "") - frame.src = url + frame.delegate.linkClickIntercepted(element, url) } } diff --git a/src/elements/frame_element.ts b/src/elements/frame_element.ts index d13abce7f..bfde5d66c 100644 --- a/src/elements/frame_element.ts +++ b/src/elements/frame_element.ts @@ -9,6 +9,7 @@ export interface FrameElementDelegate { sourceURLChanged(): void disabledChanged(): void formSubmissionIntercepted(element: HTMLFormElement, submitter?: HTMLElement): void + linkClickIntercepted(element: Element, url: string): void loadResponse(response: FetchResponse): void isLoading: boolean }