aboutsummaryrefslogtreecommitdiff
path: root/src/background/presenters/FramePresenter.ts
blob: c94f8dd5dc1f20a66c198f9c503120fa21e4ba0d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
export default interface FramePresenter {
  getAllFrameIds(tabId: number): Promise<Array<number>>;
}

export class FramePresenterImpl implements FramePresenter {
  async getAllFrameIds(tabId: number): Promise<Array<number>> {
    const frames = await browser.webNavigation.getAllFrames({ tabId: tabId });
    return frames
      .filter((f) => !f.url.startsWith("moz-extension://"))
      .map((f) => f.frameId);
  }
}