Skip to content

fix: replace deprecated unload event with pagehide for Chrome 120+#329

Open
frank-ih wants to merge 1 commit intohangwin:masterfrom
frank-ih:fix/pagehide-permissions-policy
Open

fix: replace deprecated unload event with pagehide for Chrome 120+#329
frank-ih wants to merge 1 commit intohangwin:masterfrom
frank-ih:fix/pagehide-permissions-policy

Conversation

@frank-ih
Copy link
Copy Markdown

Summary

  • Replace deprecated window.addEventListener('unload', ...) with pagehide in content scripts
  • Fixes Chrome 120+ Permissions Policy violation error

Problem

Chrome 120+ blocks window.addEventListener('unload') via Permissions Policy, causing:

Permissions policy violation: unload is not allowed in this document

Solution

Use pagehide event instead - provides equivalent cleanup functionality while remaining compatible with Chrome's stricter permissions policy.

Files Changed

  • app/chrome-extension/entrypoints/element-picker.content.ts
  • app/chrome-extension/entrypoints/quick-panel.content.ts

Testing

  • Local extension patched and tested
  • Verified no "Permissions policy violation" errors after fix

Chrome 120+ blocks window.addEventListener('unload') via Permissions Policy,
causing "Permissions policy violation: unload is not allowed" errors.

This replaces 'unload' with 'pagehide' in both element-picker and quick-panel
content scripts, which provides equivalent cleanup functionality while
remaining compatible with Chrome's stricter permissions policy.

Fixes the error:
"Permissions policy violation: unload is not allowed in this document"

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants