mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
loop: reset the loop after page end
This commit is contained in:
@@ -121,6 +121,7 @@ pub const Session = struct {
|
|||||||
loader: Loader,
|
loader: Loader,
|
||||||
|
|
||||||
env: Env,
|
env: Env,
|
||||||
|
loop: *Loop,
|
||||||
inspector: jsruntime.Inspector,
|
inspector: jsruntime.Inspector,
|
||||||
|
|
||||||
window: Window,
|
window: Window,
|
||||||
@@ -143,6 +144,7 @@ pub const Session = struct {
|
|||||||
.storageShed = storage.Shed.init(allocator),
|
.storageShed = storage.Shed.init(allocator),
|
||||||
.arena = std.heap.ArenaAllocator.init(allocator),
|
.arena = std.heap.ArenaAllocator.init(allocator),
|
||||||
.window = Window.create(null, .{ .agent = user_agent }),
|
.window = Window.create(null, .{ .agent = user_agent }),
|
||||||
|
.loop = loop,
|
||||||
};
|
};
|
||||||
|
|
||||||
const arena = self.arena.allocator();
|
const arena = self.arena.allocator();
|
||||||
@@ -278,6 +280,9 @@ pub const Page = struct {
|
|||||||
|
|
||||||
// reset js env and mem arena.
|
// reset js env and mem arena.
|
||||||
pub fn end(self: *Page) void {
|
pub fn end(self: *Page) void {
|
||||||
|
// Reset all existing callbacks.
|
||||||
|
self.session.loop.reset();
|
||||||
|
|
||||||
self.session.env.stop();
|
self.session.env.stop();
|
||||||
// TODO unload document: https://html.spec.whatwg.org/#unloading-documents
|
// TODO unload document: https://html.spec.whatwg.org/#unloading-documents
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user