mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-10-12 00:25:14 +03:00
chore(extension): show error when connection is rejected due to inact… (#836)
…ivity
This commit is contained in:
@@ -166,8 +166,10 @@ class TabShareExtension {
|
||||
if (!pending.timerId) {
|
||||
pending.timerId = setTimeout(() => {
|
||||
const existed = this._pendingTabSelection.delete(tabId);
|
||||
if (existed)
|
||||
if (existed) {
|
||||
pending.connection.close('Tab has been inactive for 5 seconds');
|
||||
chrome.tabs.sendMessage(tabId, { type: 'connectionTimeout' });
|
||||
}
|
||||
}, 5000);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,6 +121,13 @@ const ConnectApp: React.FC = () => {
|
||||
setStatus({ type: 'error', message: 'Connection rejected. This tab can be closed.' });
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
chrome.runtime.onMessage.addListener(message => {
|
||||
if (message.type === 'connectionTimeout')
|
||||
handleReject();
|
||||
});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className='app-container'>
|
||||
<div className='content-wrapper'>
|
||||
|
||||
Reference in New Issue
Block a user