Uh oh!
There was an error while loading. Please reload this page.
fix(trace-viewer): store snapshot style text in an attribute - #42405
Conversation
Stylesheet text nodes were emitted into the snapshot unescaped, so a
literal "</style>" inside style content would close the <style> element
early and the trailing text would be reparsed as markup. Escape it with
a CSS backslash ("\/" is still "/" in CSS) so the stylesheet is preserved
verbatim and renders correctly.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Escape the fully serialized <style> text as one unit rather than per text node, so a "</style>" split across adjacent text nodes cannot reassemble after join and terminate the element. Add an end-to-end trace-viewer test that records a real trace and asserts the style text stays contained.
Keep the end-to-end coverage only.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading. Please reload this page.
Render stylesheet text into __playwright_style_content__ on the <style> element and restore it as textContent in the snapshot script. Content in an attribute cannot terminate the element, so escapeURLsInStyleSheet and the closing tag escaping are no longer needed and url() values round-trip verbatim instead of being percent-encoded.
Uh oh!
There was an error while loading. Please reload this page.
The snapshotter always emits STYLE as [name, {}, cssText], so there is no
need to render children and join them back. Fall back to empty text when
a malformed trace has no text child, to keep rendering non-throwing.Pass the attribute name and value as separate parts, matching how the attribute loop above emits every other attribute.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔴 The one hard failure is this PR's own new test, failing on FirefoxHi, I'm the Playwright bot and I took a first look at the CI failures.
DetailsOverall: one real, PR-caused failure on Firefox plus one unrelated pre-existing flake. Every other job (all three engines across ubuntu/windows/macos, test-runner shards, installation) is green. Caused by this PR
Pre-existing flake / infra
Triaged by the Playwright bot - agent run |
The body only held a display:none <style> and an empty <div>, so it had zero height and the click never found a visible target on Firefox.
Test results for "tests 1"4 flaky51327 passed, 1240 skipped Merge workflow run. |
Test results for "MCP"1 failed 8258 passed, 1361 skipped Merge workflow run. |
20e2f50
into
microsoft:mainUh oh!
There was an error while loading. Please reload this page.
🟢 The one hard failure is a pre-existing Firefox flake — this PR is clearHi, I'm the Playwright bot and I took a look at the CI failures. The latest reports have a single real failure: DetailsThis PR changes Pre-existing flake / infra
Resolved (was caused by this PR, now green)
Triaged by the Playwright bot - agent run |
Summary
</style>in recorded stylesheet text closed the<style>element early, so the trailing content was reparsed as markup and the snapshot rendered incorrectly.__playwright_style_content__attribute and restore it astextContentin the snapshot script, where it is never HTML-parsed.escapeURLsInStyleSheetunnecessary, sourl()values now round-trip verbatim instead of being percent-encoded.