Skip to content

Commit e6c63cb

Browse files
committed
cdp: deinit the inspector after browser close session
1 parent 8060563 commit e6c63cb

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cdp/cdp.zig

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,6 @@ pub fn BrowserContext(comptime CDP_T: type) type {
397397
log.unregisterInterceptor();
398398
self.log_interceptor.deinit();
399399

400-
self.inspector.deinit();
401-
402400
// abort all intercepted requests before closing the sesion/page
403401
// since some of these might callback into the page/scriptmanager
404402
for (self.intercept_state.pendingTransfers()) |transfer| {
@@ -410,6 +408,11 @@ pub fn BrowserContext(comptime CDP_T: type) type {
410408
// so we need to shutdown the page one first.
411409
self.cdp.browser.closeSession();
412410

411+
// inspector must be deinit *after* the browser's session.
412+
// Mostly because closeSession drains the microtask queue and then
413+
// callback the inspector.
414+
self.inspector.deinit();
415+
413416
for (self.isolated_worlds.items) |*world| {
414417
world.deinit();
415418
}

0 commit comments

Comments
 (0)