Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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`
5 changes: 5 additions & 0 deletions src/browser/browser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ pub const Session = struct {
loader: Loader,

env: Env,
loop: *Loop,
inspector: jsruntime.Inspector,

window: Window,
Expand All @@ -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();
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion vendor/zig-js-runtime
Submodule zig-js-runtime updated 1 files
+24 −0 src/loop.zig