aboutsummaryrefslogtreecommitdiff
path: root/src/background/operators
diff options
context:
space:
mode:
Diffstat (limited to 'src/background/operators')
-rw-r--r--src/background/operators/impls/FindNextOperator.ts11
-rw-r--r--src/background/operators/impls/FindOperatorFactoryChain.ts10
-rw-r--r--src/background/operators/impls/FindPrevOperator.ts10
3 files changed, 20 insertions, 11 deletions
diff --git a/src/background/operators/impls/FindNextOperator.ts b/src/background/operators/impls/FindNextOperator.ts
index 241f71d..2aed9fb 100644
--- a/src/background/operators/impls/FindNextOperator.ts
+++ b/src/background/operators/impls/FindNextOperator.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 FindNextOperator implements Operator {
constructor(
@@ -11,7 +11,7 @@ export default class FindNextOperator 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,12 @@ export default class FindNextOperator 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);
}
diff --git a/src/background/operators/impls/FindOperatorFactoryChain.ts b/src/background/operators/impls/FindOperatorFactoryChain.ts
index b71f032..cc169dd 100644
--- a/src/background/operators/impls/FindOperatorFactoryChain.ts
+++ b/src/background/operators/impls/FindOperatorFactoryChain.ts
@@ -7,8 +7,8 @@ import FindNextOperator from "./FindNextOperator";
import FindPrevOperator from "./FindPrevOperator";
import FindRepository from "../../repositories/FindRepository";
import FindClient from "../../clients/FindClient";
-import FramePresenter from "../../presenters/FramePresenter";
import ConsoleClient from "../../infrastructures/ConsoleClient";
+import ReadyFrameRepository from "../../repositories/ReadyFrameRepository";
@injectable()
export default class FindOperatorFactoryChain implements OperatorFactoryChain {
@@ -21,8 +21,8 @@ export default class FindOperatorFactoryChain implements OperatorFactoryChain {
private readonly findClient: FindClient,
@inject("ConsoleClient")
private readonly consoleClient: ConsoleClient,
- @inject("FramePresenter")
- private readonly framePresenter: FramePresenter
+ @inject("ReadyFrameRepository")
+ private readonly frameRepository: ReadyFrameRepository
) {}
create(op: operations.Operation): Operator | null {
@@ -33,7 +33,7 @@ export default class FindOperatorFactoryChain implements OperatorFactoryChain {
this.findRepository,
this.findClient,
this.consoleClient,
- this.framePresenter
+ this.frameRepository
);
case operations.FIND_PREV:
return new FindPrevOperator(
@@ -41,7 +41,7 @@ export default class FindOperatorFactoryChain implements OperatorFactoryChain {
this.findRepository,
this.findClient,
this.consoleClient,
- this.framePresenter
+ this.frameRepository
);
}
return null;
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);
}