mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 07:03:29 +00:00
initialize ICU
This makes functions like new Intl.DateTimeFormat() not crash.
This commit is contained in:
2
.github/actions/install/action.yml
vendored
2
.github/actions/install/action.yml
vendored
@@ -17,7 +17,7 @@ inputs:
|
|||||||
zig-v8:
|
zig-v8:
|
||||||
description: 'zig v8 version to install'
|
description: 'zig v8 version to install'
|
||||||
required: false
|
required: false
|
||||||
default: 'v0.1.18'
|
default: 'v0.1.19'
|
||||||
v8:
|
v8:
|
||||||
description: 'v8 version to install'
|
description: 'v8 version to install'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ ARG ZIG=0.14.0
|
|||||||
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
|
ARG ZIG_MINISIG=RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U
|
||||||
ARG ARCH=x86_64
|
ARG ARCH=x86_64
|
||||||
ARG V8=11.1.134
|
ARG V8=11.1.134
|
||||||
ARG ZIG_V8=v0.1.18
|
ARG ZIG_V8=v0.1.19
|
||||||
|
|
||||||
RUN apt-get update -yq && \
|
RUN apt-get update -yq && \
|
||||||
apt-get install -yq xz-utils \
|
apt-get install -yq xz-utils \
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
.hash = "tigerbeetle_io-0.0.0-ViLgxpyRBAB5BMfIcj3KMXfbJzwARs9uSl8aRy2OXULd",
|
.hash = "tigerbeetle_io-0.0.0-ViLgxpyRBAB5BMfIcj3KMXfbJzwARs9uSl8aRy2OXULd",
|
||||||
},
|
},
|
||||||
.v8 = .{
|
.v8 = .{
|
||||||
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/97bcfb61da8c97de1321d677a6727a927a9db9a4.tar.gz",
|
.url = "https://github.com/lightpanda-io/zig-v8-fork/archive/5d46f159ca44535cfb4fccd9d46f719eb7eac5fc.tar.gz",
|
||||||
.hash = "v8-0.0.0-xddH69DoIADZ8YXZ_EIx_tKdQKEoGsgob_3_ZIi0O_nV",
|
.hash = "v8-0.0.0-xddH66zuIADu8FcQx2kkczC0yhqBY7LoA08-GRWF_zMA",
|
||||||
},
|
},
|
||||||
//.v8 = .{ .path = "../zig-v8-fork" },
|
//.v8 = .{ .path = "../zig-v8-fork" },
|
||||||
//.tigerbeetle_io = .{ .path = "../tigerbeetle-io" },
|
//.tigerbeetle_io = .{ .path = "../tigerbeetle-io" },
|
||||||
|
|||||||
@@ -940,3 +940,14 @@ fn timestamp() u32 {
|
|||||||
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
|
const ts = std.posix.clock_gettime(std.posix.CLOCK.MONOTONIC) catch unreachable;
|
||||||
return @intCast(ts.sec);
|
return @intCast(ts.sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const testing = @import("../testing.zig");
|
||||||
|
test "Browser" {
|
||||||
|
var runner = try testing.jsRunner(testing.tracking_allocator, .{});
|
||||||
|
defer runner.deinit();
|
||||||
|
|
||||||
|
// this will crash if ICU isn't properly configured / ininitialized
|
||||||
|
try runner.testCases(&.{
|
||||||
|
.{ "new Intl.DateTimeFormat()", "[object Intl.DateTimeFormat]" },
|
||||||
|
}, .{});
|
||||||
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ pub fn main() !void {
|
|||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
const platform = Platform.init();
|
const platform = try Platform.init();
|
||||||
defer platform.deinit();
|
defer platform.deinit();
|
||||||
|
|
||||||
var app = try App.init(alloc, .{
|
var app = try App.init(alloc, .{
|
||||||
@@ -423,7 +423,7 @@ var test_wg: std.Thread.WaitGroup = .{};
|
|||||||
test "tests:beforeAll" {
|
test "tests:beforeAll" {
|
||||||
try parser.init();
|
try parser.init();
|
||||||
test_wg.startMany(3);
|
test_wg.startMany(3);
|
||||||
_ = Platform.init();
|
_ = try Platform.init();
|
||||||
|
|
||||||
{
|
{
|
||||||
const address = try std.net.Address.parseIp("127.0.0.1", 9582);
|
const address = try std.net.Address.parseIp("127.0.0.1", 9582);
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ pub fn main() !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialize VM JS lib.
|
// initialize VM JS lib.
|
||||||
const platform = Platform.init();
|
const platform = try Platform.init();
|
||||||
defer platform.deinit();
|
defer platform.deinit();
|
||||||
|
|
||||||
// prepare libraries to load on each test case.
|
// prepare libraries to load on each test case.
|
||||||
|
|||||||
@@ -34,7 +34,10 @@ const SCOPE_ARENA_RETAIN = 1024 * 64;
|
|||||||
pub const Platform = struct {
|
pub const Platform = struct {
|
||||||
inner: v8.Platform,
|
inner: v8.Platform,
|
||||||
|
|
||||||
pub fn init() Platform {
|
pub fn init() !Platform {
|
||||||
|
if (v8.initV8ICU() == false) {
|
||||||
|
return error.FailedToInitializeICU;
|
||||||
|
}
|
||||||
const platform = v8.Platform.initDefault(0, true);
|
const platform = v8.Platform.initDefault(0, true);
|
||||||
v8.initV8Platform(platform);
|
v8.initV8Platform(platform);
|
||||||
v8.initV8();
|
v8.initV8();
|
||||||
|
|||||||
Reference in New Issue
Block a user