detach non-main frames; clear websockets, dialogs and workers
This commit is contained in:
parent
b55ad6028a
commit
4d7cac0c03
|
|
@ -114,10 +114,13 @@ export class FrameManager {
|
||||||
|
|
||||||
dispose(reason: string) {
|
dispose(reason: string) {
|
||||||
for (const frame of this._frames.values()) {
|
for (const frame of this._frames.values()) {
|
||||||
frame.dispose(reason);
|
frame._onDetached(reason);
|
||||||
frame._stopNetworkIdleTimer();
|
frame._stopNetworkIdleTimer();
|
||||||
frame._invalidateNonStallingEvaluations(reason);
|
frame._invalidateNonStallingEvaluations(reason);
|
||||||
|
this.clearWebSockets(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.closeOpenDialogs();
|
||||||
}
|
}
|
||||||
|
|
||||||
mainFrame(): Frame {
|
mainFrame(): Frame {
|
||||||
|
|
@ -1563,10 +1566,10 @@ export class Frame extends SdkObject {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDetached() {
|
_onDetached(reason = 'Frame was detached') {
|
||||||
this._stopNetworkIdleTimer();
|
this._stopNetworkIdleTimer();
|
||||||
this._detachedScope.close(new Error('Frame was detached'));
|
this._detachedScope.close(new Error(reason));
|
||||||
this.dispose('Frame was detached');
|
this.dispose(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
dispose(reason: string) {
|
dispose(reason: string) {
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,7 @@ export class Page extends SdkObject {
|
||||||
this._closedPromise.resolve();
|
this._closedPromise.resolve();
|
||||||
this.instrumentation.onPageClose(this);
|
this.instrumentation.onPageClose(this);
|
||||||
this.openScope.close(new TargetClosedError());
|
this.openScope.close(new TargetClosedError());
|
||||||
|
this._clearWorkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
_didCrash() {
|
_didCrash() {
|
||||||
|
|
@ -293,6 +294,7 @@ export class Page extends SdkObject {
|
||||||
this._crashed = true;
|
this._crashed = true;
|
||||||
this.instrumentation.onPageClose(this);
|
this.instrumentation.onPageClose(this);
|
||||||
this.openScope.close(new Error('Page crashed'));
|
this.openScope.close(new Error('Page crashed'));
|
||||||
|
this._clearWorkers();
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onFileChooserOpened(handle: dom.ElementHandle) {
|
async _onFileChooserOpened(handle: dom.ElementHandle) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue