mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: don't run destroyHandles
if realm is already disposed (#12365)
This commit is contained in:
parent
41d43200b7
commit
3103744a67
@ -95,10 +95,14 @@ export abstract class Realm implements Disposable {
|
|||||||
|
|
||||||
#disposed = false;
|
#disposed = false;
|
||||||
/** @internal */
|
/** @internal */
|
||||||
[disposeSymbol](): void {
|
dispose(): void {
|
||||||
this.#disposed = true;
|
this.#disposed = true;
|
||||||
this.taskManager.terminateAll(
|
this.taskManager.terminateAll(
|
||||||
new Error('waitForFunction failed: frame got detached.')
|
new Error('waitForFunction failed: frame got detached.')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/** @internal */
|
||||||
|
[disposeSymbol](): void {
|
||||||
|
this.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ export abstract class BidiRealm extends Realm {
|
|||||||
protected initialize(): void {
|
protected initialize(): void {
|
||||||
this.realm.on('destroyed', ({reason}) => {
|
this.realm.on('destroyed', ({reason}) => {
|
||||||
this.taskManager.terminateAll(new Error(reason));
|
this.taskManager.terminateAll(new Error(reason));
|
||||||
|
this.dispose();
|
||||||
});
|
});
|
||||||
this.realm.on('updated', () => {
|
this.realm.on('updated', () => {
|
||||||
this.internalPuppeteerUtil = undefined;
|
this.internalPuppeteerUtil = undefined;
|
||||||
@ -224,6 +225,10 @@ export abstract class BidiRealm extends Realm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async destroyHandles(handles: Array<BidiJSHandle<unknown>>): Promise<void> {
|
async destroyHandles(handles: Array<BidiJSHandle<unknown>>): Promise<void> {
|
||||||
|
if (this.disposed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handleIds = handles
|
const handleIds = handles
|
||||||
.map(({id}) => {
|
.map(({id}) => {
|
||||||
return id;
|
return id;
|
||||||
|
Loading…
Reference in New Issue
Block a user