Merge pull request #453 from lightpanda-io/loop-reset
Some checks failed
e2e-test / zig build release (push) Waiting to run
e2e-test / puppeteer-perf (push) Blocked by required conditions
e2e-test / demo-scripts (push) Blocked by required conditions
wpt / web platform tests (push) Waiting to run
wpt / perf-fmt (push) Blocked by required conditions
zig-test / zig build dev (push) Waiting to run
zig-test / zig test (push) Waiting to run
zig-test / perf-fmt (push) Blocked by required conditions
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled

Reset loop event after page stop.
This commit is contained in:
Pierre Tachoire
2025-03-10 16:07:34 +01:00
committed by GitHub
3 changed files with 40 additions and 3 deletions

View File

@@ -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`

View File

@@ -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