1818
1919const std = @import ("std" );
2020
21+ const builtin = @import ("builtin" );
2122const parser = @import ("netsurf" );
2223const jsruntime = @import ("jsruntime" );
2324const Callback = jsruntime .Callback ;
@@ -35,11 +36,38 @@ const storage = @import("../storage/storage.zig");
3536pub const Navigator = struct {
3637 pub const mem_guarantied = true ;
3738
38- agent : []const u8 = "" ,
39+ agent : []const u8 = "Lightpanda/1.0" ,
40+ version : []const u8 = "1.0" ,
41+ vendor : []const u8 = "" ,
42+ platform : []const u8 = std .fmt .comptimePrint ("{any} {any}" , .{ builtin .os .tag , builtin .cpu .arch }),
3943
4044 pub fn get_userAgent (self : * Navigator ) []const u8 {
4145 return self .agent ;
4246 }
47+ pub fn get_appCodeName (_ : * Navigator ) []const u8 {
48+ return "Mozilla" ;
49+ }
50+ pub fn get_appName (_ : * Navigator ) []const u8 {
51+ return "Netscape" ;
52+ }
53+ pub fn get_appVersion (self : * Navigator ) []const u8 {
54+ return self .version ;
55+ }
56+ pub fn get_platform (self : * Navigator ) []const u8 {
57+ return self .platform ;
58+ }
59+ pub fn get_product (_ : * Navigator ) []const u8 {
60+ return "Gecko" ;
61+ }
62+ pub fn get_productSub (_ : * Navigator ) []const u8 {
63+ return "20030107" ;
64+ }
65+ pub fn get_vendor (self : * Navigator ) []const u8 {
66+ return self .vendor ;
67+ }
68+ pub fn get_vendorSub (_ : * Navigator ) []const u8 {
69+ return "" ;
70+ }
4371};
4472
4573// Tests
@@ -50,7 +78,8 @@ pub fn testExecFn(
5078 js_env : * jsruntime.Env ,
5179) anyerror ! void {
5280 var navigator = [_ ]Case {
53- .{ .src = "navigator.userAgent" , .ex = "" },
81+ .{ .src = "navigator.userAgent" , .ex = "Lightpanda/1.0" },
82+ .{ .src = "navigator.appVersion" , .ex = "1.0" },
5483 };
5584 try checkCases (js_env , & navigator );
5685}
0 commit comments