Skip to content

test: verify AddStyleTagAsync does not mutate options when a path is used - #3797

Merged
kblok merged 1 commit into
masterfrom
implement-upstream-change-15757
Nov 17, 2026
Merged

kblok merged 1 commit into
masterfrom
implement-upstream-change-15757

Conversation

@kblok

@kblok kblok commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Ports puppeteer/puppeteer#15757 ("do not modify the options passed to addStyleTag").

Upstream fixed Frame.addStyleTag overwriting options.content when path was provided. PuppeteerSharp's CdpFrame/BidiFrame already read the file into a local variable and never mutate AddTagOptions, so no library change is needed. This PR adds the upstream test ("should work with a path when the options are reused") to guard that behavior.

Note: the test could not be executed locally (build of the test project was still running / environment issues with the dev certificate), so CI should verify it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Added coverage for consecutive stylesheet additions using the same path options.

…ppeteer#15757)

Upstream stopped mutating the options passed to addStyleTag when a path is
provided. PuppeteerSharp already reads the file into a local variable and
never mutates AddTagOptions, so only the upstream test is ported.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request adds a test that reuses the same path-based AddTagOptions instance for two consecutive AddStyleTagAsync calls. It checks the second call’s handle and confirms Content and Url remain null.

Changes: Style tag options reuse

Layer / File(s) Summary
Verify reused path-based options
lib/PuppeteerSharp.Tests/PageTests/AddStyleTagTests.cs
Adds a test that calls AddStyleTagAsync twice with the same path-based options. It checks that the second call returns a handle and that Content and Url remain null.

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to 6cc27

This change adds a test that checks reusing path-based style tag options across consecutive calls. It does not change runtime behavior, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title matches the change. The PR adds a regression test, ShouldWorkWithAPathWhenTheOptionsAreReused in AddStyleTagTests, which checks that AddStyleTagAsync does not mutate AddTagOptions when a Pat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title matches the change. The PR adds a regression test, ShouldWorkWithAPathWhenTheOptionsAreReused in AddStyleTagTests, which checks that AddStyleTagAsync does not mutate AddTagOptions when a Path is reused. The title names the test type and the behavior under test. It is specific and concise, and it does not use vague terms.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c8af1245-9a1f-4a8c-ae61-b4080999fea2
Commits

Reviewing files that changed from the base of the PR and between 8a53894 and 6cc271e.

Files selected for processing: 1

  • lib/PuppeteerSharp.Tests/PageTests/AddStyleTagTests.cs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant