Repository navigation
fix(screenshot): error when webp dimensions exceed 16383px limit - #42721
Closed
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Closed
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Mohan Ram (mohanram-dev) wants to merge 1 commit into
Conversation
Contributor
|
this is really an upstream issue and should be fixed there instead (and also i dont think it's really all that likely/common for a screenshot to be that large in the first place) |
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.
Fixes #42717
Description
WebP format uses 14 bits for pixel width and height (2^14 - 1 = 16,383 px maximum). When taking a screenshot with
type: 'webp'where either width or height exceeds 16,383 pixels:{ data: '' }).Buffer.from('', 'base64')) and silently returned it as a successful screenshot.@playwright/mcp,browser_take_screenshotwrote a 0-byte file to disk and returned an empty image without raising an error.Changes
crPage.ts, computerenderScale(factoring indeviceScaleFactorwhenscale: 'device'). Ifformat === 'webp'and either width or height exceeds 16,383 pixels, throwCannot take screenshot larger than 16383 pixels on any dimension when using webp format.crPage.tsandscreenshotter.ts, guard against empty screenshot data by throwingFailed to take screenshot, received empty image data from browserif empty data is returned.wkPage.tsandwvPage.ts, validate the 16,383 px limit for WebP format invalidateScreenshotDimension.@playwright/mcp'sbrowser_take_screenshottool, ensure empty image data throws an error rather than writing a 0-byte file.tests/mcp/screenshot.spec.tsandtests/page/page-screenshot.spec.ts.