Repository navigation
Conversation
OrKoN
self-requested a review
October 15, 2026 11:57
OrKoN
requested changes
Oct 16, 2026
|
|
||
| if (!options.geolocation) { | ||
| await page.setGeolocation({latitude: 0, longitude: 0}); | ||
| // Puppeteer has no API to remove the override, and setting (0, 0) would |
Collaborator
There was a problem hiding this comment.
Let's fix this in Puppeteer first.
Contributor
Author
There was a problem hiding this comment.
Makes sense. I’ll send a Puppeteer PR that lets page.setGeolocation(null) remove the override, and update this PR to use it once it’s released.
johan-gorter
pushed a commit
to johan-gorter/chrome-devtools-mcp
that referenced
this pull request
Oct 20, 2026
…omeDevTools#3265) This PR applies the review comments from two stale PRs. A reviewer requested changes on each PR more than 2 days ago. There are two commits, one for each fix. ## take_snapshot timeout (from ChromeDevTools#3227) - `take_snapshot` waited for Puppeteer's `protocolTimeout` (180 s) when the page did not return the accessibility tree. The tool held the tool lock during this time. - `TextSnapshot.create()` now rejects after 10 s. The error tells the agent to navigate, reload, or select another page. - Review request: "extract a re-usable helper or better use the Deferred class from Puppeteer". This PR adds `withTimeout()` in `src/utils/timeout.ts`. It uses Puppeteer's `Deferred.race`. `src/third_party/index.ts` exports `Deferred`. - In this PR, only `TextSnapshot` calls `withTimeout()`. A separate PR can move the other timeout races to it. ## emulate geolocation (from ChromeDevTools#3145) - `emulate` without `geolocation` set the position to latitude 0, longitude 0. The tool description says that this clears the override. - Review request: "fix this in Puppeteer first". puppeteer/puppeteer#15590 adds `page.setGeolocation(null)`, and it ships in Puppeteer 25.15.0. This repository already uses 25.15.0. `McpPage.emulate()` now calls `setGeolocation(null)` and does not use an internal API. - User-visible change: each `emulate` call without `geolocation` now removes the geolocation override. Before, it set the position to 0,0. ## Tests - `tests/utils/timeout.test.ts`: the helper returns the value when the promise settles first. It rejects with `TimeoutError` when the promise does not settle in time. - `tests/TextSnapshot.test.ts`: a never-resolving `accessibility.snapshot` rejects after 10 s. The test fails on `main`. - `tests/McpPage.test.ts`: `emulate({})` calls `setGeolocation(null)`. The test fails on `main`. - `npm run test` passes. Closes ChromeDevTools#3227 Closes ChromeDevTools#3145 Fixes ChromeDevTools#2939 Fixes ChromeDevTools#2964 Co-authored-by: Rudy Mizrahi Celekli <[email protected]> Co-authored-by: nancy <[email protected]> --------- Co-authored-by: Rudy Mizrahi Celekli <[email protected]> Co-authored-by: nancy <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2964
emulatedocumentsgeolocationas "Omit to clear the geolocation override", butMcpPage.emulate()calledsetGeolocation({latitude: 0, longitude: 0}). Everyemulatecall withoutgeolocation(even one that only changes the color scheme) pinned the page to 0,0, and there was no way back to the real position.Puppeteer has no API to remove the override, so this sends CDP
Emulation.clearGeolocationOverrideon the page's session instead.Tests:
geolocationsendsEmulation.clearGeolocationOverrideinstead of a secondsetGeolocationcall (the old test asserted the (0, 0) behaviour).emulate({}). The page no longer reports0,0(it did on main).