fix(networkidle): do not produce networkidle event on errored pages (#13938)
This commit is contained in:
Родитель
f4933e6d8b
Коммит
cf5101d44a
|
@ -85,6 +85,8 @@ type SelectorInFrame = {
|
|||
info: SelectorInfo;
|
||||
};
|
||||
|
||||
const kDummyFrameId = '<dummy>';
|
||||
|
||||
export class FrameManager {
|
||||
private _page: Page;
|
||||
private _frames = new Map<string, Frame>();
|
||||
|
@ -99,6 +101,11 @@ export class FrameManager {
|
|||
this._mainFrame = undefined as any as Frame;
|
||||
}
|
||||
|
||||
createDummyMainFrameIfNeeded() {
|
||||
if (!this._mainFrame)
|
||||
this.frameAttached(kDummyFrameId, null);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
for (const frame of this._frames.values())
|
||||
frame._stopNetworkIdleTimer();
|
||||
|
@ -468,7 +475,8 @@ export class Frame extends SdkObject {
|
|||
|
||||
this._firedLifecycleEvents.add('commit');
|
||||
this._subtreeLifecycleEvents.add('commit');
|
||||
this._startNetworkIdleTimer();
|
||||
if (id !== kDummyFrameId)
|
||||
this._startNetworkIdleTimer();
|
||||
}
|
||||
|
||||
isDetached(): boolean {
|
||||
|
|
|
@ -587,8 +587,7 @@ export class Page extends SdkObject {
|
|||
|
||||
private _setIsError(error: Error) {
|
||||
this._pageIsError = error;
|
||||
if (!this._frameManager.mainFrame())
|
||||
this._frameManager.frameAttached('<dummy>', null);
|
||||
this._frameManager.createDummyMainFrameIfNeeded();
|
||||
}
|
||||
|
||||
isClosed(): boolean {
|
||||
|
|
Загрузка…
Ссылка в новой задаче