Skip to content

Commit 19ec848

Browse files
committed
Propagate set return
1 parent 0ed3fc0 commit 19ec848

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/browser/html/document.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ test "Browser.HTML.Document" {
337337
.{ "document.cookie = 'name=Oeschger; SameSite=None; Secure'", "name=Oeschger; SameSite=None; Secure" },
338338
.{ "document.cookie = 'favorite_food=tripe; SameSite=None; Secure'", "favorite_food=tripe; SameSite=None; Secure" },
339339
.{ "document.cookie", "name=Oeschger; favorite_food=tripe" },
340-
.{ "document.cookie = 'IgnoreMy=Ghost; HttpOnly'", null }, // "" should be returned, but the framework overrules it atm
340+
.{ "document.cookie = 'IgnoreMy=Ghost; HttpOnly'", "" },
341341
.{ "document.cookie", "name=Oeschger; favorite_food=tripe" },
342342
}, .{});
343343

src/runtime/js.zig

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,13 +2475,9 @@ fn Caller(comptime E: type, comptime State: type) type {
24752475
else => @compileError(named_function.full_name ++ " setter with more than 3 parameters, why?"),
24762476
}
24772477

2478-
if (@typeInfo(Setter).@"fn".return_type) |return_type| {
2479-
if (@typeInfo(return_type) == .error_union) {
2480-
_ = try @call(.auto, func, args);
2481-
return;
2482-
}
2483-
}
2484-
_ = @call(.auto, func, args);
2478+
// TODO: Do not set res for void type to allow default input return behavior, but how to allow get to return undefined?
2479+
const res = @call(.auto, func, args);
2480+
info.getReturnValue().set(try js_context.zigValueToJs(res));
24852481
}
24862482

24872483
fn getIndex(self: *Self, comptime Struct: type, comptime named_function: NamedFunction, idx: u32, info: v8.PropertyCallbackInfo) !u8 {

0 commit comments

Comments
 (0)