fix: add PageRegistry.clear() and getAll(), fix BrowserManager.cleanup() to clear registry

This commit is contained in:
2026-08-12 20:56:16 +08:00
parent ac503a5ca3
commit dd79194179
2 changed files with 13 additions and 2 deletions
+2 -2
View File
@@ -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;