Repository navigation
feat(page): reveal dynamic pages before the capture - #8
Merged
Merged
Conversation
…olls, freeze every frame
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.
What
Stash captured interceptingoutliers.com as 10,000px of blank cream: the site reveals each section as the reader scrolls, so the page as first loaded is empty below the fold. The
pagecapturer now reveals the page before it writes anything:prefers-reduced-motion: reduceand sets the animation playback rate to 50x before the load.requestAnimationFramein every frame, sets the playback rate to 0.Then the MHTML, the PNG and the PDF. The PNG goes through
Page.captureScreenshotwith a clip capped at 16384px and at the walked height, so a feed that grows on every scroll cannot ask for a 60,000px capture.Also:
--use-angle=swiftshader --enable-unsafe-swiftshader) instead of--disable-gpu. WebGL pages were a blank gradient before. The freeze is what keeps a software WebGL render loop from making one screenshot take 16 minutes (1390 s to 19 s on bruno-simon.com), and pausing media is what stoppedbrowser.quitfrom hanging four minutes on a YouTube page (291 s to 29 s).CAPTURE_TIMEOUTis spent.bin/capture-sample <urls or file>: runs the capturers on real URLs with no database rows and writes anindex.htmlwith every screenshot and log. Run it before changing a capturer.docs/design.md, "Dynamic pages", and a note on the SwiftShader tradeoff indocs/deploy.md.Results
A 15-URL matrix (scroll-animated site, Wikipedia, React docs, Apple, Framer, Webflow, Notion, The Verge, GitHub repo and issue, a PDF, a YouTube page, a Google Slides URL, a WebGL portfolio, a Substack) captures in 3 to 60 seconds each, with the content present down the whole page. interceptingoutliers.com is 7,181px with every chart and section.
Checks
bin/rails test: 71 runs, 0 failures. The page capturer has 10 unit tests against a fake browser; no test starts Chromium.bin/rubocopclean.bin/capture-sampledirectory collisions and unescaped report fields; doc drift. Accepted and documented: the--enable-unsafe-swiftshaderattack surface with the container as the boundary; pages that un-reveal on scroll up or pin sections to the scroll position still capture as they are.docker build. Check in the built image that WebGL is on:chromium --headless --no-sandbox --use-angle=swiftshader --enable-unsafe-swiftshader --dump-dom 'data:text/html,<script>document.write(!!document.createElement("canvas").getContext("webgl"))</script>'printstrue.