From bd7b84e13681eac2b37c20985ff58ad3dfe94463 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 3 Mar 2025 15:17:59 +0100 Subject: [PATCH 1/3] loop: reset the loop after page end --- src/browser/browser.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/browser/browser.zig b/src/browser/browser.zig index 7b875657..ffedfb29 100644 --- a/src/browser/browser.zig +++ b/src/browser/browser.zig @@ -121,6 +121,7 @@ pub const Session = struct { loader: Loader, env: Env, + loop: *Loop, inspector: jsruntime.Inspector, window: Window, @@ -143,6 +144,7 @@ pub const Session = struct { .storageShed = storage.Shed.init(allocator), .arena = std.heap.ArenaAllocator.init(allocator), .window = Window.create(null, .{ .agent = user_agent }), + .loop = loop, }; const arena = self.arena.allocator(); @@ -278,6 +280,9 @@ pub const Page = struct { // reset js env and mem arena. pub fn end(self: *Page) void { + // Reset all existing callbacks. + self.session.loop.reset(); + self.session.env.stop(); // TODO unload document: https://html.spec.whatwg.org/#unloading-documents From 6b78b011b75ee7a4f145d010e7c39267ca4770a6 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 10 Mar 2025 15:43:30 +0100 Subject: [PATCH 2/3] upgrade zig-jsruntime --- vendor/zig-js-runtime | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/zig-js-runtime b/vendor/zig-js-runtime index 944c5f0a..c7f980e5 160000 --- a/vendor/zig-js-runtime +++ b/vendor/zig-js-runtime @@ -1 +1 @@ -Subproject commit 944c5f0a260a04aee284a0013d459e29c8151c2e +Subproject commit c7f980e5946cb0211a1827d9c0041a0820193f9f From a3045c98080d043e650f73d9c8c488ab290d4d59 Mon Sep 17 00:00:00 2001 From: Pierre Tachoire Date: Mon, 10 Mar 2025 15:52:27 +0100 Subject: [PATCH 3/3] ci: run demo's puppeteer scripts --- .github/workflows/e2e-test.yml | 36 ++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml index 9fb9c040..c52f022f 100644 --- a/.github/workflows/e2e-test.yml +++ b/.github/workflows/e2e-test.yml @@ -57,8 +57,8 @@ jobs: zig-out/bin/lightpanda retention-days: 1 - puppeteer: - name: puppeteer + puppeteer-perf: + name: puppeteer-perf needs: zig-build-release env: @@ -105,3 +105,35 @@ jobs: echo "puppeteer avg duration: $PUPPETEER_AVG_DURATION" test "$PUPPETEER_AVG_DURATION" -le "$MAX_AVG_DURATION" + demo-scripts: + name: demo-scripts + needs: zig-build-release + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + repository: 'lightpanda-io/demo' + fetch-depth: 0 + + - run: npm install + + - name: download artifact + uses: actions/download-artifact@v4 + with: + name: lightpanda-build-release + + - run: chmod a+x ./lightpanda + + - name: run puppeteer links + run: | + ./lightpanda serve & echo $! > LPD.pid + node puppeteer/links.js || exit 1 + kill `cat LPD.pid` + + - name: run puppeteer dump + run: | + ./lightpanda serve & echo $! > LPD.pid + node puppeteer/dump.js || exit 1 + kill `cat LPD.pid`