Skip to content

Conversation

@heathdutton
Copy link

Fixes #1627

The getUntaintedPrototype function creates a temporary iframe to get clean prototypes, but fails to remove it when:

  • contentWindow is null (early return)
  • An exception is thrown

This adds a finally block to ensure the iframe is always cleaned up.

Copilot AI review requested due to automatic review settings January 2, 2026 22:43
@changeset-bot
Copy link

changeset-bot bot commented Jan 2, 2026

⚠️ No Changeset found

Latest commit: b64b625

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a resource leak where temporary iframes created to access untainted prototypes were not always properly cleaned up. The fix ensures the iframe is removed from the DOM in all exit paths.

Key Changes:

  • Moved iframe variable declaration outside try block to make it accessible in finally block
  • Replaced inline cleanup with a finally block that executes regardless of how the function exits
  • Added safety check for parentNode existence before attempting removal

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

[Bug]: Injected iframe cleanup on error

1 participant