Update repository metadata and README to ManagedCode Playwright.Stealth#2
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f7023b3b81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| // For whatever weird reason loops don't play nice with Object.defineProperty, here's the next best thing: | ||
| addProxy(WebGLRenderingContext.prototype, 'getParameter') | ||
| addProxy(WebGL2RenderingContext.prototype, 'getParameter') No newline at end of file |
There was a problem hiding this comment.
Guard WebGL2 proxy when WebGL2 is unavailable
This line unconditionally references WebGL2RenderingContext. In browsers or contexts where WebGL2 is disabled or unsupported, that global is undefined and this will throw a ReferenceError during init script evaluation, aborting the rest of the stealth script and potentially surfacing errors in the page. Consider checking typeof WebGL2RenderingContext !== 'undefined' before calling addProxy so the script remains safe on WebGL2‑less environments.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR creates a new .NET repository for ManagedCode.Playwright.Stealth, a library that provides stealth capabilities for Microsoft Playwright to evade bot detection. Despite the PR description stating it only updates metadata and documentation, this is actually a complete new repository setup with source code, tests, and CI/CD configuration.
Changes:
- Created complete .NET solution with stealth library implementation and tests
- Added JavaScript stealth scripts ported from puppeteer-extra-plugin-stealth
- Configured build properties, CI workflow, and package metadata for ManagedCode branding
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.props | Build configuration with package metadata pointing to ManagedCode repository |
| global.json | SDK and test runner configuration for .NET 10.0 |
| ManagedCode.Playwright.Stealth.sln | Solution file with source and test projects |
| src/ManagedCode.Playwright.Stealth/ManagedCode.Playwright.Stealth.csproj | Main library project configuration |
| src/ManagedCode.Playwright.Stealth/PlaywrightStealthExtensions.cs | Extension methods to apply stealth scripts to Playwright contexts/pages |
| src/ManagedCode.Playwright.Stealth/StealthConfig.cs | Configuration class for stealth options |
| src/ManagedCode.Playwright.Stealth/StealthScriptProvider.cs | Provider that loads embedded JavaScript stealth scripts |
| src/ManagedCode.Playwright.Stealth/Resources/js/*.js | JavaScript stealth scripts (18 files) |
| tests/ManagedCode.Playwright.Stealth.Tests/ManagedCode.Playwright.Stealth.Tests.csproj | Test project configuration |
| tests/ManagedCode.Playwright.Stealth.Tests/StealthConfigTests.cs | Unit tests for configuration |
| tests/ManagedCode.Playwright.Stealth.Tests/StealthIntegrationTests.cs | Integration tests against bot detection sites |
| README.md | Documentation with installation, usage, and development instructions |
| .github/workflows/ci.yml | CI workflow for build and test automation |
| .gitignore | Standard .NET gitignore patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,25 @@ | |||
| console.log(opts) | |||
There was a problem hiding this comment.
Console.log statement in production code can expose debugging information and potentially reveal the presence of stealth automation. Consider removing this line.
| console.log(opts) |
| getIsInstalled: function getDetails() { | ||
| if (arguments.length) { | ||
| throw makeError.ErrorInInvocation(`getIsInstalled`) | ||
| } | ||
| return false | ||
| }, | ||
| runningState: function getDetails() { | ||
| if (arguments.length) { | ||
| throw makeError.ErrorInInvocation(`runningState`) | ||
| } | ||
| return 'cannot_run' |
There was a problem hiding this comment.
The function name getDetails is duplicated for both getIsInstalled (line 57) and runningState (line 63). While this doesn't affect functionality due to how they're assigned as object properties, it's confusing and should be corrected to use the appropriate function names for better code clarity and debugging.
| ) | ||
| } | ||
| const MismatchError = (propName, expected, found) => | ||
| TypeError( |
There was a problem hiding this comment.
Missing new keyword before TypeError constructor. This should be return new TypeError(...) to properly instantiate the error object, consistent with the pattern used in line 73.
| TypeError( | |
| new TypeError( |
| @@ -0,0 +1,70 @@ | |||
| # ManagedCode.Playwright.Stealth (.NET) | |||
There was a problem hiding this comment.
The PR description states this change "only updates documentation and package metadata" and mentions removing references to "AtuboDad/playwright_stealth". However, this appears to be a completely new repository with all new files, not just metadata updates. The description should be updated to accurately reflect that this is an initial repository setup for ManagedCode.Playwright.Stealth, not just metadata changes.
| const {csi_timing} = window.performance | ||
|
|
||
| log.info('loading chrome.csi.js') | ||
| window.chrome.csi = function () { | ||
| return { | ||
| onloadT: csi_timing.domContentLoadedEventEnd, |
There was a problem hiding this comment.
The variable csi_timing is used but not defined. This should likely be window.performance.timing instead of window.performance.csi_timing. The Navigation Timing API v1 uses window.performance.timing, not window.performance.csi_timing.
| if (!('csi' in window.chrome) && (window.performance || window.performance.timing)) { | ||
| const {csi_timing} = window.performance | ||
|
|
||
| log.info('loading chrome.csi.js') |
There was a problem hiding this comment.
The variable log is referenced but never defined, which will cause a runtime error. Either define log or remove this line, or replace it with console.log if logging is intended.
| log.info('loading chrome.csi.js') | |
| console.info('loading chrome.csi.js') |
| console.log(`current window outer height ${window.outerHeight}`) | ||
| window.outerHeight = window.innerHeight + windowFrame | ||
| console.log(`new window outer height ${window.outerHeight}`) |
There was a problem hiding this comment.
Console.log statements should typically be removed from production code, especially in stealth scripts where the goal is to avoid detection. These logging statements could reveal the presence of stealth automation.
| console.log(`current window outer height ${window.outerHeight}`) | |
| window.outerHeight = window.innerHeight + windowFrame | |
| console.log(`new window outer height ${window.outerHeight}`) | |
| window.outerHeight = window.innerHeight + windowFrame |
| newHandler[trap] = function() { | ||
| try { | ||
| // Forward the call to the defined proxy handler | ||
| return handler[trap].apply(this, arguments || []) |
There was a problem hiding this comment.
This use of variable 'arguments' always evaluates to true.
| return handler[trap].apply(this, arguments || []) | |
| return handler[trap].apply(this, arguments) |
Motivation
AtuboDad/playwright_stealthproject and point package and repo metadata to the ManagedCode branded repository.Description
Directory.Build.propsto setRepositoryUrlandPackageProjectUrltohttps://github.com/managedcode/Playwright.Stealthand editedREADME.mdto remove the explicitAtuboDadattribution and reflect ManagedCode usage.Testing
Codex Task