fix: add PageRegistry.clear() and getAll(), fix BrowserManager.cleanup() to clear registry
This commit is contained in:
@@ -90,10 +90,10 @@ export class BrowserManager {
|
||||
|
||||
async cleanup(): Promise<void> {
|
||||
// Close all contexts / 关闭所有上下文
|
||||
const entries = this.registry['pages']?.values() ?? [];
|
||||
for (const entry of entries) {
|
||||
for (const entry of this.registry.getAll()) {
|
||||
try { await entry.context.close(); } catch { /* ignore / 忽略 */ }
|
||||
}
|
||||
this.registry.clear();
|
||||
if (this.browser) {
|
||||
await this.browser.close();
|
||||
this.browser = null;
|
||||
|
||||
Reference in New Issue
Block a user