diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml
index 50af9e91..35584881 100644
--- a/.github/workflows/e2e-test.yml
+++ b/.github/workflows/e2e-test.yml
@@ -258,7 +258,7 @@ jobs:
- name: start http
run: |
- go run ws/main.go & echo $! > WS.pid
+ go run runner/main.go -serve & echo $! > WS.pid
sleep 2
- name: run lightpanda in cgroup
diff --git a/.github/workflows/wpt.yml b/.github/workflows/wpt.yml
index 89d640ab..229260a9 100644
--- a/.github/workflows/wpt.yml
+++ b/.github/workflows/wpt.yml
@@ -36,13 +36,8 @@ jobs:
os: ${{env.OS}}
arch: ${{env.ARCH}}
- - uses: ./.github/actions/v8-snapshot
- with:
- os: ${{env.OS}}
- arch: ${{env.ARCH}}
-
- name: zig build release
- run: zig build -Dsnapshot_path=../../snapshot.bin -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast -Dcpu=generic
+ run: zig build -Dwpt_extensions -Dprebuilt_v8_path=v8/libc_v8.a -Doptimize=ReleaseFast -Dcpu=generic
- name: upload artifact
uses: actions/upload-artifact@v7
diff --git a/src/browser/Frame.zig b/src/browser/Frame.zig
index 95f7e129..6205feab 100644
--- a/src/browser/Frame.zig
+++ b/src/browser/Frame.zig
@@ -722,7 +722,6 @@ fn scheduleNavigationWithArena(originator: *Frame, arena: Allocator, request_url
if (!opts.force and URL.eqlDocument(target.url, resolved_url)) {
target.url = try target.arena.dupeZ(u8, resolved_url);
target.window._location = try Location.init(target.url, target);
- target.document._location = target.window._location;
if (target.parent == null) {
try session.navigation.updateEntries(target.url, opts.kind, target, true);
}
diff --git a/src/browser/Session.zig b/src/browser/Session.zig
index 1d2a04e6..67686ed5 100644
--- a/src/browser/Session.zig
+++ b/src/browser/Session.zig
@@ -113,6 +113,9 @@ pub fn createPage(self: *Session) !*Frame {
self.page = @as(Page, undefined);
const page = &self.page.?;
+
+ errdefer self.page = null;
+
try Page.init(page, self, self.nextFrameId());
const frame = &page.frame;
@@ -184,6 +187,9 @@ pub fn replacePage(self: *Session) !*Frame {
self.page = @as(Page, undefined);
const page = &self.page.?;
+
+ errdefer self.page = null;
+
try Page.init(page, self, frame_id);
return &page.frame;
}
@@ -302,8 +308,9 @@ fn processFrameNavigation(self: *Session, frame: *Frame, qn: *QueuedNavigation)
frame.deinit(true);
frame.* = undefined;
- try Frame.init(frame, frame_id, page, parent);
errdefer {
+ // If anything fails from this point on, frame.deinit will be called
+ // and we need to remove the frame from the parent's frame list.
for (parent.child_frames.items, 0..) |f, i| {
if (f == frame) {
parent.child_frames_sorted = false;
@@ -311,6 +318,10 @@ fn processFrameNavigation(self: *Session, frame: *Frame, qn: *QueuedNavigation)
break;
}
}
+ }
+
+ try Frame.init(frame, frame_id, page, parent);
+ errdefer {
if (parent_notified) {
parent._pending_loads -= 1;
}
@@ -349,11 +360,16 @@ fn processRootQueuedNavigation(self: *Session) !void {
self.page = @as(Page, undefined);
const page = &self.page.?;
+
+ errdefer self.page = null;
+
try Page.init(page, self, frame_id);
const new_frame = &page.frame;
// Creates a new NavigationEventTarget for this frame.
- try self.navigation.onNewFrame(new_frame);
+ self.navigation.onNewFrame(new_frame) catch |err| {
+ log.err(.browser, "createPage onNewNewFrame", .{ .err = err });
+ };
// start JS env
// Inform CDP the main frame has been created such that additional context for other Worlds can be created as well
diff --git a/src/browser/js/Snapshot.zig b/src/browser/js/Snapshot.zig
index 517bf313..c625127c 100644
--- a/src/browser/js/Snapshot.zig
+++ b/src/browser/js/Snapshot.zig
@@ -587,6 +587,12 @@ fn attachClass(comptime JsApi: type, isolate: *v8.Isolate, template: *const v8.F
const prototype = v8.v8__FunctionTemplate__PrototypeTemplate(template);
const signature = v8.v8__Signature__New(isolate, template);
+ // Namespace objects (e.g. console) expose their members as own properties
+ // of each instance rather than via the prototype, so Object.entries(...)
+ // returns them. See https://console.spec.whatwg.org/#console-namespace.
+ const own_properties = @hasDecl(JsApi.Meta, "own_properties") and JsApi.Meta.own_properties;
+ const member_template = if (own_properties) instance else prototype;
+
const declarations = @typeInfo(JsApi).@"struct".decls;
var has_named_index_getter = false;
@@ -652,7 +658,7 @@ fn attachClass(comptime JsApi: type, isolate: *v8.Isolate, template: *const v8.F
if (value.static) {
v8.v8__Template__Set(@ptrCast(template), js_name, @ptrCast(function_template), v8.None);
} else {
- v8.v8__Template__Set(@ptrCast(prototype), js_name, @ptrCast(function_template), v8.None);
+ v8.v8__Template__Set(@ptrCast(member_template), js_name, @ptrCast(function_template), v8.None);
}
},
bridge.Indexed => {
diff --git a/src/browser/tests/console/console.html b/src/browser/tests/console/console.html
index 33c2fa62..8f68ccd8 100644
--- a/src/browser/tests/console/console.html
+++ b/src/browser/tests/console/console.html
@@ -1,6 +1,16 @@
+
+
+
+
+
+
+
+