diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-23 12:44:49 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2021-09-23 13:14:00 +0900 |
commit | 01242a2f0d174b4bf8b51fd5627edced465757e9 (patch) | |
tree | b8ab266625ae3244b6ed8c9ff7a92a979e532e91 /src/background/operators/impls/FindPrevOperator.ts | |
parent | cbf4b37bd0d5ba277d6400ed460d6a086ae1d7bb (diff) |
Search a content from frames successfully loaded
Diffstat (limited to 'src/background/operators/impls/FindPrevOperator.ts')
-rw-r--r-- | src/background/operators/impls/FindPrevOperator.ts | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/background/operators/impls/FindPrevOperator.ts b/src/background/operators/impls/FindPrevOperator.ts index 822c386..3c4411d 100644 --- a/src/background/operators/impls/FindPrevOperator.ts +++ b/src/background/operators/impls/FindPrevOperator.ts @@ -3,7 +3,7 @@ import TabPresenter from "../../presenters/TabPresenter"; import FindRepository from "../../repositories/FindRepository"; import FindClient from "../../clients/FindClient"; import ConsoleClient from "../../infrastructures/ConsoleClient"; -import FramePresenter from "../../presenters/FramePresenter"; +import ReadyFrameRepository from "../../repositories/ReadyFrameRepository"; export default class FindPrevOperator implements Operator { constructor( @@ -11,7 +11,7 @@ export default class FindPrevOperator implements Operator { private readonly findRepository: FindRepository, private readonly findClient: FindClient, private readonly consoleClient: ConsoleClient, - private readonly framePresenter: FramePresenter + private readonly frameRepository: ReadyFrameRepository ) {} async run(): Promise<void> { @@ -65,7 +65,11 @@ export default class FindPrevOperator implements Operator { const keyword = await this.findRepository.getGlobalKeyword(); if (keyword) { - const frameIds = await this.framePresenter.getAllFrameIds(tabId); + const frameIds = await this.frameRepository.getFrameIds(tabId); + if (typeof frameIds === "undefined") { + // No frames are ready + return; + } for (const frameId of frameIds) { await this.findClient.clearSelection(tabId, frameId); } |