Skip to content

Conversation

@ACTCD
Copy link
Collaborator

@ACTCD ACTCD commented Aug 30, 2025

fix #863

ACTCD added 2 commits August 30, 2025 13:25
`browser.runtime.onMessage` listeners seems to prevent content scripts recycle from causing memory leaks
@ACTCD ACTCD requested a review from Copilot August 30, 2025 13:46
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 memory leak issue in browser tab content scripts by properly managing event listeners and preventing accumulation of orphaned listeners when tabs become hidden or inactive.

  • Adds proper cleanup for runtime message listeners using visibility state tracking
  • Implements the { once: true } option for one-time event listeners
  • Manually removes event listeners for document state changes to prevent accumulation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/ext/content-scripts/entry-userscripts.js Adds memory leak prevention through proper event listener cleanup and once-only DOM events
src/ext/content-scripts/entry-script-market.js Implements visibility-based listener management and removes unnecessary variable reset

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ACTCD ACTCD merged commit 879b272 into main Aug 30, 2025
1 check passed
@ACTCD ACTCD deleted the fix/863/content-scripts-memory-leak branch August 30, 2025 13:53
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.

Potential memory leak

2 participants