Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(extension): keep service worker alive while the connect page is open (#40412)
Yury Semikhatsky00f48428cbd3
diff --git a/packages/extension/src/background.ts b/packages/extension/src/background.tsindex 0afc41b87c..216f658c67 100644--- a/packages/extension/src/background.ts+++ b/packages/extension/src/background.ts@@ -36,6 +36,8 @@ type PageMessage = {type: 'disconnect';} | {type: 'rejectConnection';+} | {+ type: 'keepalive';};class PlaywrightExtension {@@ -95,6 +97,10 @@ class PlaywrightExtension {this._pendingConnections.reject(sender.tab.id);sendResponse({ success: true });return true;+ case 'keepalive':+ // Connect page pings us every ~20s so receiving this message resets+ // the MV3 service worker idle timer and keeps the relay WebSocket alive.+ return false;}}diff --git a/packages/extension/src/ui/connect.tsx b/packages/extension/src/ui/connect.tsxindex 4b50034ee0..37e71b2417 100644--- a/packages/extension/src/ui/connect.tsx+++ b/packages/extension/src/ui/connect.tsx@@ -105,6 +105,12 @@ const ConnectApp: React.FC = () => {await loadTabs();};void runAsync();+ // Ping the background every 20s so the MV3 service worker (which owns the+ // relay WebSocket) stays above its 30s idle timeout while the user decides.+ const keepalive = setInterval(() => {+ chrome.runtime.sendMessage({ type: 'keepalive' }).catch(() => {});+ }, 20_000);+ return () => clearInterval(keepalive);}, []);const handleReject = useCallback((message: string) => {