fix: treat querySelector/querySelectorAll as methods in untainted pro…#1802
Open
juliecheng wants to merge 1 commit intorrweb-io:masterfrom
Open
fix: treat querySelector/querySelectorAll as methods in untainted pro…#1802juliecheng wants to merge 1 commit intorrweb-io:masterfrom
juliecheng wants to merge 1 commit intorrweb-io:masterfrom
Conversation
🦋 Changeset detectedLatest commit: b66b5eb The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Size Change: -169 B (0%) Total Size: 10.1 MB
ℹ️ View Unchanged
|
2 tasks
pauldambra
pushed a commit
to PostHog/posthog-rrweb
that referenced
this pull request
Apr 2, 2026
… iframe creation (#159) ## Summary - Adopts upstream rrweb [#1770](rrweb-io/rrweb#1770) and [#1802](rrweb-io/rrweb#1802) - **#1770**: Wraps untainted prototype iframe creation in `try/finally` so the iframe is always removed, even on early return (when `contentWindow` is null) or exception. Previously these iframes would leak into the DOM. - **#1802**: Moves `querySelector`/`querySelectorAll` from `testableAccessors` to `testableMethods` and switches helpers from `getUntaintedAccessor` to `getUntaintedMethod`. These are methods, not property accessors, so the accessor check (`getOwnPropertyDescriptor(...).get`) always failed, causing a throwaway iframe to be created every time just to get the untainted prototype. ## Why Both fixes are in `packages/utils/src/index.ts` and affect the same `getUntaintedPrototype` code path. #1770 prevents DOM pollution from leaked iframes. #1802 avoids unnecessary iframe creation on every querySelector/querySelectorAll call, which is a hot path during recording. ## Test plan - [ ] Verify no regressions in recording on pages with patched DOM prototypes (Angular apps) - [ ] Inspect DOM during recording to confirm no orphaned iframes from untainted prototype detection
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.
…totype check
issue:
querySelectorandquerySelectorAllwere listed undertestableAccessors= the checks always failed = we're always creating/removing iframes to try and get the untainted versions when it's not necessaryfix:
move both
querySelectorandquerySelectorAllintotestableMethods