mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
Merge pull request #757 from lightpanda-io/window_target_crash
Some checks failed
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-test / zig build release (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Some checks failed
nightly build / build-linux-x86_64 (push) Has been cancelled
nightly build / build-linux-aarch64 (push) Has been cancelled
nightly build / build-macos-aarch64 (push) Has been cancelled
nightly build / build-macos-x86_64 (push) Has been cancelled
wpt / web platform tests json output (push) Has been cancelled
wpt / perf-fmt (push) Has been cancelled
e2e-test / zig build release (push) Has been cancelled
zig-test / zig build dev (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
e2e-test / puppeteer-perf (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
zig-test / browser fetch (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled
Fix crash when event target is the window.
This commit is contained in:
@@ -71,6 +71,8 @@ pub fn Union(comptime interfaces: anytype) type {
|
||||
var FT = @field(tuple, field.name);
|
||||
if (@hasDecl(FT, "Self")) {
|
||||
FT = *(@field(FT, "Self"));
|
||||
} else if (!@hasDecl(FT, "union_make_copy")) {
|
||||
FT = *FT;
|
||||
}
|
||||
union_fields[index] = .{
|
||||
.type = FT,
|
||||
@@ -171,7 +173,7 @@ fn filterMap(comptime count: usize, interfaces: [count]type) struct { usize, [co
|
||||
return .{ unfiltered_count, map };
|
||||
}
|
||||
|
||||
test "generate.Union" {
|
||||
test "generate: Union" {
|
||||
const Astruct = struct {
|
||||
pub const Self = Other;
|
||||
const Other = struct {};
|
||||
@@ -188,15 +190,15 @@ test "generate.Union" {
|
||||
const value = Union(.{ Astruct, Bstruct, .{Cstruct} });
|
||||
const ti = @typeInfo(value).@"union";
|
||||
try std.testing.expectEqual(3, ti.fields.len);
|
||||
try std.testing.expectEqualStrings("*runtime.generate.test.generate.Union.Astruct.Other", @typeName(ti.fields[0].type));
|
||||
try std.testing.expectEqualStrings("*runtime.generate.test.generate: Union.Astruct.Other", @typeName(ti.fields[0].type));
|
||||
try std.testing.expectEqualStrings(ti.fields[0].name, "Astruct");
|
||||
try std.testing.expectEqual(Bstruct, ti.fields[1].type);
|
||||
try std.testing.expectEqual(*Bstruct, ti.fields[1].type);
|
||||
try std.testing.expectEqualStrings(ti.fields[1].name, "Bstruct");
|
||||
try std.testing.expectEqual(Cstruct, ti.fields[2].type);
|
||||
try std.testing.expectEqual(*Cstruct, ti.fields[2].type);
|
||||
try std.testing.expectEqualStrings(ti.fields[2].name, "Cstruct");
|
||||
}
|
||||
|
||||
test "generate.Tuple" {
|
||||
test "generate: Tuple" {
|
||||
const Astruct = struct {};
|
||||
|
||||
const Bstruct = struct {
|
||||
|
||||
Reference in New Issue
Block a user