mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
web ui: fix not sending initial context sometimes
This would cause the web ui to crash in js or wasm.
This commit is contained in:
parent
2da8ec9865
commit
52a13f6a7f
@ -257,7 +257,12 @@ pub fn serveSourcesTar(fuzz: *Fuzz, req: *std.http.Server.Request) !void {
|
||||
pub const Previous = struct {
|
||||
unique_runs: usize,
|
||||
entry_points: usize,
|
||||
pub const init: Previous = .{ .unique_runs = 0, .entry_points = 0 };
|
||||
sent_source_index: bool,
|
||||
pub const init: Previous = .{
|
||||
.unique_runs = 0,
|
||||
.entry_points = 0,
|
||||
.sent_source_index = false,
|
||||
};
|
||||
};
|
||||
pub fn sendUpdate(
|
||||
fuzz: *Fuzz,
|
||||
@ -280,7 +285,8 @@ pub fn sendUpdate(
|
||||
const n_runs = @atomicLoad(usize, &cov_header.n_runs, .monotonic);
|
||||
const unique_runs = @atomicLoad(usize, &cov_header.unique_runs, .monotonic);
|
||||
{
|
||||
if (unique_runs != 0 and prev.unique_runs == 0) {
|
||||
if (!prev.sent_source_index) {
|
||||
prev.sent_source_index = true;
|
||||
// We need to send initial context.
|
||||
const header: abi.SourceIndexHeader = .{
|
||||
.directories_len = @intCast(coverage_map.coverage.directories.entries.len),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user