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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Zig
uses: mlugg/setup-zig@v2
with:
version: master
version: 0.17.0

- name: Zig Version
run: zig version
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Use Zig **0.16.0**, Git, and an installed Brave browser for the required Chromium integration gate.
Use Zig **0.17.0**, Git, and an installed Brave browser for the required Chromium integration gate.

```sh
zig build
Expand Down
2 changes: 1 addition & 1 deletion DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alldriver API

`alldriver` requires Zig 0.16.0. The supported browser scope is Chromium over CDP. The required real-browser suite targets Brave; Chrome and Edge use the same Chromium protocol surface, but a Brave run does not independently certify every browser/version/OS combination.
`alldriver` requires Zig 0.17.0. The supported browser scope is Chromium over CDP. The required real-browser suite targets Brave; Chrome and Edge use the same Chromium protocol surface, but a Brave run does not independently certify every browser/version/OS combination.

Firefox and other Gecko browsers, BiDi, Safari/WebKit, Lightpanda, and platform-specific webviews are outside the currently validated scope. Their discovery entries or existing APIs are not support guarantees.

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# alldriver

Chromium browser automation for Zig 0.16, using the Chrome DevTools Protocol (CDP).
Chromium browser automation for Zig 0.17, using the Chrome DevTools Protocol (CDP).

Launch or attach to a browser, navigate pages, send trusted input, inspect network traffic, and collect screenshots, traces, logs, and downloads. The public API lives under `driver.modern`.

Expand Down Expand Up @@ -33,7 +33,7 @@ Install with `zig fetch --save git+https://github.com/SmallThingz/alldriver`, th

## Validation

Use Zig **0.16.0** and an installed Brave browser:
Use Zig **0.17.0** and an installed Brave browser:

```sh
zig build
Expand Down
8 changes: 2 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,12 @@ pub fn build(b: *std.Build) void {

// This allows the user to pass arguments to the application in the build
// command itself, like this: `zig build run -- arg1 arg2 etc`
if (b.args) |args| {
run_cmd.addArgs(args);
}
run_cmd.addPassthruArgs();

const tools_step = b.step("tools", "Run alldriver_tools commands (pass args after --)");
const run_tools_cmd = b.addRunArtifact(tools_exe);
tools_step.dependOn(&run_tools_cmd.step);
if (b.args) |args| {
run_tools_cmd.addArgs(args);
}
run_tools_cmd.addPassthruArgs();

const example_specs = [_]struct { name: []const u8, path: []const u8 }{
.{ .name = "example-01-discover", .path = "examples/01_discover.zig" },
Expand Down
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
.fingerprint = 0xc6e7cf56a1c47921, // Changing this has security and trust implications.
// Tracks the earliest Zig version that the package considers to be a
// supported use case.
.minimum_zig_version = "0.16.0",
.minimum_zig_version = "0.17.0",
// This field is optional.
// Each dependency must either provide a `url` and `hash`, or a `path`.
// `zig build --fetch` can be used to fetch all dependencies of a package, recursively.
Expand Down
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Examples

These examples target Zig 0.16.0. Desktop launch examples select Chromium browsers; compilation alone does not validate their runtime behavior.
These examples target Zig 0.17.0. Desktop launch examples select Chromium browsers; compilation alone does not validate their runtime behavior.

## Build All Examples

Expand Down
12 changes: 6 additions & 6 deletions src/core/network.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1050,11 +1050,11 @@ fn cloneOwned(comptime T: type, allocator: std.mem.Allocator, source: T) !T {
.@"struct" => |info| {
var out: T = undefined;
var initialized: usize = 0;
errdefer inline for (info.fields, 0..) |field, i| {
if (i < initialized) freeOwned(field.type, allocator, @field(out, field.name));
errdefer inline for (info.field_names, info.field_types, 0..) |field_name, field_type, i| {
if (i < initialized) freeOwned(field_type, allocator, @field(out, field_name));
};
inline for (info.fields) |field| {
@field(out, field.name) = try cloneOwned(field.type, allocator, @field(source, field.name));
inline for (info.field_names, info.field_types) |field_name, field_type| {
@field(out, field_name) = try cloneOwned(field_type, allocator, @field(source, field_name));
initialized += 1;
}
return out;
Expand All @@ -1073,8 +1073,8 @@ fn freeOwned(comptime T: type, allocator: std.mem.Allocator, value: T) void {
for (value) |item| freeOwned(ptr.child, allocator, item);
allocator.free(value);
},
.@"struct" => |info| inline for (info.fields) |field| {
freeOwned(field.type, allocator, @field(value, field.name));
.@"struct" => |info| inline for (info.field_names, info.field_types) |field_name, field_type| {
freeOwned(field_type, allocator, @field(value, field_name));
},
.@"union" => switch (value) {
inline else => |payload| freeOwned(@TypeOf(payload), allocator, payload),
Expand Down
2 changes: 1 addition & 1 deletion src/core/session.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ const SessionEventCapture = struct {
last_navigation_completed_cause: ?types.NavigationCause = null,
last_navigation_failed_error: ?[]const u8 = null,
last_navigation_failed_cause: ?types.NavigationCause = null,
reload_url_buf: [512]u8 = [_]u8{0} ** 512,
reload_url_buf: [512]u8 = @splat(0),
last_reload_url: ?[]const u8 = null,
last_reload_failed_error: ?[]const u8 = null,
last_wait_target: ?types.WaitTargetTag = null,
Expand Down
2 changes: 1 addition & 1 deletion src/runtime.zig
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ fn waitForDebugEndpointReady(
fn childExitedPosixNoHang(child: *std.process.Child) bool {
if (@import("builtin").os.tag == .windows or @import("builtin").os.tag == .wasi) return false;
const pid = child.id orelse return true;
var status: if (@import("builtin").link_libc) c_int else u32 = undefined;
var status: i32 = undefined;
const result = std.posix.system.waitpid(pid, &status, std.posix.W.NOHANG);
switch (std.posix.errno(result)) {
.SUCCESS => {
Expand Down
18 changes: 9 additions & 9 deletions src/session_cache/store.zig
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ fn cookiesToJson(allocator: std.mem.Allocator, cookies: []const types.Cookie) !s
try obj.put(allocator, "sameSite", .{ .string = @tagName(cookie.same_site) });
try arr.append(allocator, .{ .object = obj });
}
return .{ .array = .{ .items = try arr.toOwnedSlice(allocator), .capacity = arr.items.len, .allocator = allocator } };
return .{ .array = .fromOwnedSlice(allocator, try arr.toOwnedSlice(allocator)) };
}

fn storageToJson(allocator: std.mem.Allocator, values: []const types.StorageValue) !std.json.Value {
Expand All @@ -424,7 +424,7 @@ fn storageToJson(allocator: std.mem.Allocator, values: []const types.StorageValu
try obj.put(allocator, "value", .{ .string = item.value });
try arr.append(allocator, .{ .object = obj });
}
return .{ .array = .{ .items = try arr.toOwnedSlice(allocator), .capacity = arr.items.len, .allocator = allocator } };
return .{ .array = .fromOwnedSlice(allocator, try arr.toOwnedSlice(allocator)) };
}

fn headersToJson(allocator: std.mem.Allocator, headers: []const types.Header) !std.json.Value {
Expand All @@ -436,7 +436,7 @@ fn headersToJson(allocator: std.mem.Allocator, headers: []const types.Header) !s
try obj.put(allocator, "value", .{ .string = h.value });
try arr.append(allocator, .{ .object = obj });
}
return .{ .array = .{ .items = try arr.toOwnedSlice(allocator), .capacity = arr.items.len, .allocator = allocator } };
return .{ .array = .fromOwnedSlice(allocator, try arr.toOwnedSlice(allocator)) };
}

fn parseCookies(allocator: std.mem.Allocator, value: std.json.Value) ![]types.Cookie {
Expand Down Expand Up @@ -538,11 +538,11 @@ fn cloneOwned(comptime T: type, allocator: std.mem.Allocator, source: T) !T {
.@"struct" => |info| {
var out: T = undefined;
var initialized: usize = 0;
errdefer inline for (info.fields, 0..) |field, i| {
if (i < initialized) freeOwned(field.type, allocator, @field(out, field.name));
errdefer inline for (info.field_names, info.field_types, 0..) |field_name, field_type, i| {
if (i < initialized) freeOwned(field_type, allocator, @field(out, field_name));
};
inline for (info.fields) |field| {
@field(out, field.name) = try cloneOwned(field.type, allocator, @field(source, field.name));
inline for (info.field_names, info.field_types) |field_name, field_type| {
@field(out, field_name) = try cloneOwned(field_type, allocator, @field(source, field_name));
initialized += 1;
}
return out;
Expand All @@ -558,8 +558,8 @@ fn freeOwned(comptime T: type, allocator: std.mem.Allocator, value: T) void {
for (value) |item| freeOwned(ptr.child, allocator, item);
allocator.free(value);
},
.@"struct" => |info| inline for (info.fields) |field| {
freeOwned(field.type, allocator, @field(value, field.name));
.@"struct" => |info| inline for (info.field_names, info.field_types) |field_name, field_type| {
freeOwned(field_type, allocator, @field(value, field_name));
},
.optional => |info| if (value) |item| {
freeOwned(info.child, allocator, item);
Expand Down
6 changes: 3 additions & 3 deletions src/tools/dispatch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ const DetectionSignals = struct {

fn signalCount(self: DetectionSignals) usize {
var count: usize = 0;
inline for (std.meta.fields(DetectionSignals)) |field| {
if (@field(self, field.name)) count += 1;
inline for (@typeInfo(DetectionSignals).@"struct".field_names) |field_name| {
if (@field(self, field_name)) count += 1;
}
return count;
}
Expand Down Expand Up @@ -2248,7 +2248,7 @@ fn cmdReleaseBundle(allocator: Allocator, root: []const u8, args: []const []cons
try cmdMatrixCollect(allocator, root, &.{ "--strict-ga", "--matrix-root", matrix_root, "--out", summary_path });
}

try runInherit(allocator, &.{ "zig", "build", "-Doptimize=ReleaseSafe" }, root, &env);
try runInherit(allocator, &.{ "zig", "build", "-Doptimize=safe" }, root, &env);

const bundle_dir = try path_util.pathJoin(allocator, &.{ root, "artifacts", "release", release_id.? });
defer allocator.free(bundle_dir);
Expand Down
8 changes: 4 additions & 4 deletions src/util/compat.zig
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,15 @@ pub const CwdDir = struct {
pub fn createFile(
self: CwdDir,
sub_path: []const u8,
flags: std.Io.File.CreateFlags,
flags: std.Io.Dir.CreateFileOptions,
) std.Io.File.OpenError!std.Io.File {
return self.inner.createFile(io(), sub_path, flags);
}

pub fn openFile(
self: CwdDir,
sub_path: []const u8,
flags: std.Io.File.OpenFlags,
flags: std.Io.Dir.OpenFileOptions,
) std.Io.File.OpenError!std.Io.File {
return self.inner.openFile(io(), sub_path, flags);
}
Expand Down Expand Up @@ -190,11 +190,11 @@ pub fn openDirAbsolute(path: []const u8, options: std.Io.Dir.OpenOptions) std.Io
return std.Io.Dir.openDirAbsolute(io(), path, options);
}

pub fn openFileAbsolute(path: []const u8, flags: std.Io.File.OpenFlags) std.Io.File.OpenError!std.Io.File {
pub fn openFileAbsolute(path: []const u8, flags: std.Io.Dir.OpenFileOptions) std.Io.File.OpenError!std.Io.File {
return std.Io.Dir.openFileAbsolute(io(), path, flags);
}

pub fn createFileAbsolute(path: []const u8, flags: std.Io.File.CreateFlags) std.Io.File.OpenError!std.Io.File {
pub fn createFileAbsolute(path: []const u8, flags: std.Io.Dir.CreateFileOptions) std.Io.File.OpenError!std.Io.File {
return std.Io.Dir.createFileAbsolute(io(), path, flags);
}

Expand Down
Loading