mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
fix: catch websocket error events (#1595)
This commit is contained in:
parent
eabba567bc
commit
950d427927
@ -18,7 +18,7 @@
|
||||
import * as fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { helper } from '../helper';
|
||||
import { debugError, helper } from '../helper';
|
||||
import { CRBrowser } from '../chromium/crBrowser';
|
||||
import * as platform from '../platform';
|
||||
import * as ws from 'ws';
|
||||
@ -269,6 +269,8 @@ function wrapTransportWithWebSocket(transport: ConnectionTransport, port: number
|
||||
session.queue!.push(parsedMessage);
|
||||
});
|
||||
|
||||
socket.on('error', error => debugError(error));
|
||||
|
||||
socket.on('close', (socket as any).__closeListener = () => {
|
||||
const session = socketToBrowserSession.get(socket);
|
||||
if (!session || !session.sessionId)
|
||||
|
@ -25,7 +25,7 @@ import { TimeoutError } from '../errors';
|
||||
import { Events } from '../events';
|
||||
import { FFBrowser } from '../firefox/ffBrowser';
|
||||
import { kBrowserCloseMessageId } from '../firefox/ffConnection';
|
||||
import { helper } from '../helper';
|
||||
import { debugError, helper } from '../helper';
|
||||
import * as platform from '../platform';
|
||||
import { BrowserServer, WebSocketWrapper } from './browserServer';
|
||||
import { BrowserArgOptions, BrowserType, LaunchOptions } from './browserType';
|
||||
@ -297,6 +297,8 @@ function wrapTransportWithWebSocket(transport: ConnectionTransport, port: number
|
||||
pendingBrowserContextDeletions.set(seqNum, params.browserContextId);
|
||||
});
|
||||
|
||||
socket.on('error', error => debugError(error));
|
||||
|
||||
socket.on('close', (socket as any).__closeListener = () => {
|
||||
for (const [browserContextId, s] of browserContextIds) {
|
||||
if (s === socket) {
|
||||
|
@ -22,7 +22,7 @@ import * as fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as platform from '../platform';
|
||||
import * as os from 'os';
|
||||
import { helper } from '../helper';
|
||||
import { debugError, helper } from '../helper';
|
||||
import { kBrowserCloseMessageId } from '../webkit/wkConnection';
|
||||
import { LaunchOptions, BrowserArgOptions, BrowserType } from './browserType';
|
||||
import { ConnectionTransport, SequenceNumberMixer } from '../transport';
|
||||
@ -276,6 +276,8 @@ function wrapTransportWithWebSocket(transport: ConnectionTransport, port: number
|
||||
pendingBrowserContextDeletions.set(seqNum, params.browserContextId);
|
||||
});
|
||||
|
||||
socket.on('error', error => debugError(error));
|
||||
|
||||
socket.on('close', (socket as any).__closeListener = () => {
|
||||
for (const [pageProxyId, s] of pageProxyIds) {
|
||||
if (s === socket)
|
||||
|
Loading…
Reference in New Issue
Block a user