Skip to content

Commit 763d8d0

Browse files
Merge pull request #453 from lightpanda-io/loop-reset
Reset loop event after page stop.
2 parents 2a9bab3 + a3045c9 commit 763d8d0

File tree

3 files changed

+40
-3
lines changed

3 files changed

+40
-3
lines changed

.github/workflows/e2e-test.yml

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ jobs:
5757
zig-out/bin/lightpanda
5858
retention-days: 1
5959

60-
puppeteer:
61-
name: puppeteer
60+
puppeteer-perf:
61+
name: puppeteer-perf
6262
needs: zig-build-release
6363

6464
env:
@@ -105,3 +105,35 @@ jobs:
105105
echo "puppeteer avg duration: $PUPPETEER_AVG_DURATION"
106106
test "$PUPPETEER_AVG_DURATION" -le "$MAX_AVG_DURATION"
107107
108+
demo-scripts:
109+
name: demo-scripts
110+
needs: zig-build-release
111+
112+
runs-on: ubuntu-latest
113+
114+
steps:
115+
- uses: actions/checkout@v4
116+
with:
117+
repository: 'lightpanda-io/demo'
118+
fetch-depth: 0
119+
120+
- run: npm install
121+
122+
- name: download artifact
123+
uses: actions/download-artifact@v4
124+
with:
125+
name: lightpanda-build-release
126+
127+
- run: chmod a+x ./lightpanda
128+
129+
- name: run puppeteer links
130+
run: |
131+
./lightpanda serve & echo $! > LPD.pid
132+
node puppeteer/links.js || exit 1
133+
kill `cat LPD.pid`
134+
135+
- name: run puppeteer dump
136+
run: |
137+
./lightpanda serve & echo $! > LPD.pid
138+
node puppeteer/dump.js || exit 1
139+
kill `cat LPD.pid`

src/browser/browser.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ pub const Session = struct {
121121
loader: Loader,
122122

123123
env: Env,
124+
loop: *Loop,
124125
inspector: jsruntime.Inspector,
125126

126127
window: Window,
@@ -143,6 +144,7 @@ pub const Session = struct {
143144
.storageShed = storage.Shed.init(allocator),
144145
.arena = std.heap.ArenaAllocator.init(allocator),
145146
.window = Window.create(null, .{ .agent = user_agent }),
147+
.loop = loop,
146148
};
147149

148150
const arena = self.arena.allocator();
@@ -278,6 +280,9 @@ pub const Page = struct {
278280

279281
// reset js env and mem arena.
280282
pub fn end(self: *Page) void {
283+
// Reset all existing callbacks.
284+
self.session.loop.reset();
285+
281286
self.session.env.stop();
282287
// TODO unload document: https://html.spec.whatwg.org/#unloading-documents
283288

vendor/zig-js-runtime

0 commit comments

Comments
 (0)