mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(page): navigating 11 pages simultaneously should not throw warning (#3560)
NavigatorWatcher subscribes to Connection to get a `Disconnected` event, causing us to hit the default max of 10 listeners constraint. Technically we don't leak anything here and can safely bump the maxListenersCount to Infinity. However, we conveniently have `CDPSession`, and can re-dispatch the event on it and keep the safety check in place.
This commit is contained in:
@@ -228,6 +228,7 @@ class CDPSession extends EventEmitter {
|
||||
callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed.`));
|
||||
this._callbacks.clear();
|
||||
this._connection = null;
|
||||
this.emit(CDPSession.Events.Disconnected);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -240,6 +241,11 @@ class CDPSession extends EventEmitter {
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
CDPSession.Events = {
|
||||
Disconnected: Symbol('CDPSession.Events.Disconnected'),
|
||||
};
|
||||
|
||||
helper.tracePublicAPI(CDPSession);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user