mirror of
https://github.com/penpot/penpot.git
synced 2026-10-30 14:30:37 +00:00
Build one extension per browser, in dist/chrome and dist/firefox, from the same source. A script makes each manifest. The code keeps the chrome namespace, which Firefox implements with promises in Manifest V3. The Firefox manifest runs the background as an event page, leaves out the debugger permission, and sets the add-on ID and Firefox 140 as the minimum version. Its extension page policy drops the default upgrade-insecure-requests, which would turn ws:// servers into wss://. Firefox has no debugger API, and it does not freeze background pages: it only slows their timers, which the plugin's heartbeat survives. The background therefore unfreezes in place only where the debugger API exists, and otherwise brings the tab forward and goes back, as a fallback that should rarely run. Firefox stops an event page that is idle for 30 s, even while its WebSocket is open, so the wake agent connection would drop and come back with each alarm. While it holds a connection, the background calls an extension API every 20 s, which Firefox counts as activity.