Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 31, 2025

Large MSI files and LZX-compressed files cause the browser to hang with "page unresponsive" warnings during parsing and extraction.

Changes

Architecture: Moved all Pyodide operations to a dedicated web worker thread

  • msi_viewer_worker.js: New worker handling Pyodide initialization, MSI parsing, and file extraction
  • msi_viewer.js: Refactored to communicate with worker via postMessage, handle UI updates only
  • msi_viewer.md: Enhanced CSS with animated loading spinner and error states

Progress feedback: Added visual indicators for background operations

  • Animated spinner during processing
  • Error state styling with clear messaging
  • Progress messages for each operation phase

Resilience: Exponential backoff retry logic with timeout protection

// Configuration constants for retry behavior
this.WORKER_INIT_MAX_RETRIES = 10;
this.WORKER_INIT_BASE_DELAY = 500;
this.WORKER_INIT_MAX_DELAY = 5000;
this.WORKER_INIT_BACKOFF_FACTOR = 1.5;

Security: Input validation and safe variable passing

  • Table names validated via regex to prevent control characters
  • Python variables set via pyodide.globals.set() instead of string interpolation
  • CodeQL analysis: 0 alerts

Memory management: Timeout cleanup prevents leak accumulation

if (this._loadRetryTimeout) {
  clearTimeout(this._loadRetryTimeout);
}
this._loadRetryTimeout = setTimeout(/* ... */);

Screenshot

MSI Viewer with enhanced progress indicators

The UI now remains responsive during all MSI operations, with clear visual feedback showing current processing status.

Original prompt

This section details on the original issue you should resolve

<issue_title>[Feature] Use web workers to avoid blocking the main UI thread</issue_title>
<issue_description>For extracting some MSI files (particularly ones that are large or that use LZX compression), the main UI thread for a browser tab can hang for a bit, resulting in a pop up asking if the user wants to wait. Running the Pyodide scripts in a separate thread using web workers might help avoid those pop-ups -- and some form of indicator could be added to show that work is still happening in the background.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 8 commits October 31, 2025 22:02
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Co-authored-by: nightlark <3969255+nightlark@users.noreply.github.com>
Copilot AI changed the title [WIP] Add web workers to prevent UI thread blocking Use web workers to avoid blocking the main UI thread during MSI processing Oct 31, 2025
Copilot AI requested a review from nightlark October 31, 2025 22:24
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.

[Feature] Use web workers to avoid blocking the main UI thread

2 participants