From 4511889f34573ed235dc27ae3a5b7b24fb8d17c0 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 f7dd36555..c300c43cb 100644 --- a/src/core/frames/frame_redirector.ts +++ b/src/core/frames/frame_redirector.ts @@ -31,8 +31,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 }