Chrome DevTools for coding agents
chore: use pptrPage consistently in McpPage (#3104)
Wolfgang Beyer7070ff0ae8bf
diff --git a/src/McpPage.ts b/src/McpPage.tsindex 161c1b2b..9d87159e 100644--- a/src/McpPage.ts+++ b/src/McpPage.ts@@ -239,7 +239,7 @@ export class McpPage implements ContextPage {}url(): string {- return this.#pptrPage ? this.#pptrPage.url() : this.target.url();+ return this.#pptrPage?.url() ?? this.target.url();}get targetId(): string {@@ -380,10 +380,7 @@ export class McpPage implements ContextPage {}#getDebuggingWebMcpToolGroups(): ToolGroups {- if (!this.#pptrPage) {- return [];- }- const webmcpTools = this.#pptrPage.webmcp+ const webmcpTools = this.pptrPage.webmcp.tools().filter(isDebuggingWebMcpTool);if (webmcpTools.length === 0) {@@ -1260,14 +1257,14 @@ export class McpPage implements ContextPage {// For waiters 5sec timeout should be sufficient.// Increased in case we throttle the CPUconst cpuMultiplier = this.cpuThrottlingRate;- this.#pptrPage.setDefaultTimeout(DEFAULT_TIMEOUT * cpuMultiplier);+ this.pptrPage.setDefaultTimeout(DEFAULT_TIMEOUT * cpuMultiplier);// 10sec should be enough for the load event to be emitted during// navigations.// Increased in case we throttle the network requests or the CPUconst networkMultiplier = getNetworkMultiplierFromString(this.networkConditions,);- this.#pptrPage.setDefaultNavigationTimeout(+ this.pptrPage.setDefaultNavigationTimeout(this.#navigationTimeout * networkMultiplier * cpuMultiplier,);}diff --git a/tests/McpPage.test.ts b/tests/McpPage.test.tsindex bd000240..6d44b800 100644--- a/tests/McpPage.test.ts+++ b/tests/McpPage.test.ts@@ -327,6 +327,11 @@ describe('McpPage', () => {sinon.assert.notCalled(target.page);sinon.assert.notCalled(target.asPage);assert.throws(() => mcpPage.pptrPage, /not initialized/);+ assert.throws(+ () => mcpPage.getThirdPartyDeveloperTools(),+ /not initialized/,+ );+ assert.throws(() => mcpPage.getWebMcpTools(), /not initialized/);assert.strictEqual(mcpPage.url(), 'https://target-only.example.com');assert.strictEqual(mcpPage.getTitle(), 'Target Title');