mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-03-22 04:34:44 +00:00
Merge pull request #1651 from lightpanda-io/more_pump_message_loop
Run the MessageLoop [a lot] more.
This commit is contained in:
@@ -436,17 +436,18 @@ pub fn BrowserContext(comptime CDP_T: type) type {
|
||||
|
||||
pub fn deinit(self: *Self) void {
|
||||
const browser = &self.cdp.browser;
|
||||
const env = &browser.env;
|
||||
|
||||
// Drain microtasks makes sure we don't have inspector's callback
|
||||
// in progress before deinit.
|
||||
browser.env.runMicrotasks();
|
||||
env.runMicrotasks();
|
||||
|
||||
// resetContextGroup detach the inspector from all contexts.
|
||||
// It append async tasks, so we make sure we run the message loop
|
||||
// before deinit it.
|
||||
browser.env.inspector.?.resetContextGroup();
|
||||
browser.runMessageLoop();
|
||||
browser.env.inspector.?.stopSession();
|
||||
env.inspector.?.resetContextGroup();
|
||||
_ = env.pumpMessageLoop();
|
||||
env.inspector.?.stopSession();
|
||||
|
||||
// abort all intercepted requests before closing the sesion/page
|
||||
// since some of these might callback into the page/scriptmanager
|
||||
|
||||
Reference in New Issue
Block a user