Skip to content

Chrome DevTools for coding agents

refactor: use #private names instead of the private modifier (#3301)

Nikolay Vitkov2e13311bb329
diff --git a/scripts/eval_result.ts b/scripts/eval_result.ts
index dbd4a38a..2593156f 100644
--- a/scripts/eval_result.ts
+++ b/scripts/eval_result.ts
@@ -12,7 +12,7 @@ export interface CapturedFunctionCall {
}
export class Result {
- private nextCallIndex = 0;
+ #nextCallIndex = 0;
readonly calls: CapturedFunctionCall[];
readonly serverArgs: string[];
/** The model's final response text. */
@@ -29,7 +29,7 @@ export class Result {
}
get remainingCalls(): CapturedFunctionCall[] {
- return this.calls.slice(this.nextCallIndex);
+ return this.calls.slice(this.#nextCallIndex);
}
/**
@@ -40,20 +40,20 @@ export class Result {
* - Returns the active pageId.
*/
consumePageNavigation(): number | undefined {
- if (this.calls[this.nextCallIndex]?.name === 'list_pages') {
- this.nextCallIndex++;
+ if (this.calls[this.#nextCallIndex]?.name === 'list_pages') {
+ this.#nextCallIndex++;
}
- const navCall = this.calls[this.nextCallIndex];
+ const navCall = this.calls[this.#nextCallIndex];
assert.ok(
navCall &&
(navCall.name === 'new_page' || navCall.name === 'navigate_page'),
`Expected navigation call (new_page or navigate_page), but got: ${navCall?.name || 'none'}`,
);
- this.nextCallIndex++;
+ this.#nextCallIndex++;
- if (this.calls[this.nextCallIndex]?.name === 'list_pages') {
- this.nextCallIndex++;
+ if (this.calls[this.#nextCallIndex]?.name === 'list_pages') {
+ this.#nextCallIndex++;
}
const isNewPage = navCall.name === 'new_page';
@@ -73,15 +73,15 @@ export class Result {
name: string,
expectedArgs?: Record<string, unknown>,
): CapturedFunctionCall {
- const call = this.calls[this.nextCallIndex];
+ const call = this.calls[this.#nextCallIndex];
assert.ok(
call,
- `Expected call at index ${this.nextCallIndex} (name: '${name}') to exist`,
+ `Expected call at index ${this.#nextCallIndex} (name: '${name}') to exist`,
);
assert.strictEqual(
call.name,
name,
- `Expected call at index ${this.nextCallIndex} to be '${name}', but got '${call.name}'`,
+ `Expected call at index ${this.#nextCallIndex} to be '${name}', but got '${call.name}'`,
);
if (expectedArgs) {
@@ -96,7 +96,7 @@ export class Result {
}
}
- this.nextCallIndex++;
+ this.#nextCallIndex++;
return call;
}
diff --git a/src/TextSnapshot.ts b/src/TextSnapshot.ts
index 66b60f63..a2aeb78a 100644
--- a/src/TextSnapshot.ts
+++ b/src/TextSnapshot.ts
@@ -135,7 +135,7 @@ export class TextSnapshot {
const rootNodeWithId = assignIds(rootNode);
- await TextSnapshot.insertExtraNodes(
+ await TextSnapshot.#insertExtraNodes(
page,
idToNode,
seenUniqueIds,
@@ -195,7 +195,7 @@ export class TextSnapshot {
// ExtraHandles represent DOM nodes which might not be part of the accessibility tree, e.g. DOM nodes
// returned by third-party developer tools. We insert them into the tree by finding the closest ancestor
// in the tree and inserting the node as a child. The ancestor's child nodes are re-parented if necessary.
- private static async insertExtraNodes(
+ static async #insertExtraNodes(
page: McpPage,
idToNode: Map<string, TextSnapshotNode>,
seenUniqueIds: Set<string>,