-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix: inject HTML before <script> if top-level #32982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
|
@alexsch01 Can you provide the failing example of this (just a static html file is fine even)? Curious how this problem manifests. |
I discovered this when manually testing #32925 <script>
console.log(1, XMLHttpRequest.prototype.open.toString())
</script>
<html>
<head>
<script>
console.log(2, XMLHttpRequest.prototype.open.toString())
</script>
</head>
</html>the console log with 1 will be the original unmodified version I added a unit test |
|
@jennifer-shehane if there's a commented <script> tag, this breaks, marking as draft |
Additional details
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?Note
Injects the Cypress payload before a top‑level
<script>appearing before<html>, adds unit tests for edge cases, and updates the changelog.packages/proxy/lib/http/util/rewriter.ts)<script>before<html>and injects payload before it (scriptRe,isScriptTopLevel).html()to accept optionalmockedHtmlToInjectfor testing and adjusts injection order.packages/proxy/test/unit/http/util/rewriter.spec.tscovering top‑level and nested<script>scenarios.<script>appears before<html>incli/CHANGELOG.md.Written by Cursor Bugbot for commit 51eee94. This will update automatically on new commits. Configure here.