Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestNewJsToGoErr(t *testing.T) {

ctx := rt.Context()

t.Run("JSONStringify failure path", func(t *testing.T) {
t.Run("JSONStringifyFailure", func(t *testing.T) {
// Create a value that will cause JSONStringify to fail
circularValue := createCircularValue(ctx)
defer circularValue.Free()
Expand All @@ -211,7 +211,7 @@ func TestNewJsToGoErr(t *testing.T) {
assert.Contains(t, result.Error(), "[object Object]")
})

t.Run("successful JSONStringify", func(t *testing.T) {
t.Run("JSONStringifySuccess", func(t *testing.T) {
value := ctx.NewString("hello")
defer value.Free()

Expand Down
Binary file modified qjs.wasm
Binary file not shown.
22 changes: 7 additions & 15 deletions qjswasm/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,25 +91,17 @@ static JSValue js_navigator_get_userAgent(JSContext *ctx, JSValue this_val)
return JS_NewString(ctx, version);
}

// static const JSCFunctionListEntry global_obj[] = {
// JS_CFUNC_DEF("gc", 0, js_gc),
// };
static const JSCFunctionListEntry global_obj[] = {
JS_CFUNC_DEF("gc", 0, js_gc),
};

// static const JSCFunctionListEntry navigator_proto_funcs[] = {
// JS_CGETSET_DEF2("userAgent", js_navigator_get_userAgent, NULL, JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE),
// JS_PROP_STRING_DEF("[Symbol.toStringTag]", "Navigator", JS_PROP_CONFIGURABLE),
// };
static const JSCFunctionListEntry navigator_proto_funcs[] = {
JS_CGETSET_DEF2("userAgent", js_navigator_get_userAgent, NULL, JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE),
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "Navigator", JS_PROP_CONFIGURABLE),
};

void js_set_global_objs(JSContext *ctx)
{
const JSCFunctionListEntry global_obj[] = {
JS_CFUNC_DEF("gc", 0, js_gc),
};
const JSCFunctionListEntry navigator_proto_funcs[] = {
JS_CGETSET_DEF2("userAgent", js_navigator_get_userAgent, NULL, JS_PROP_CONFIGURABLE | JS_PROP_ENUMERABLE),
JS_PROP_STRING_DEF("[Symbol.toStringTag]", "Navigator", JS_PROP_CONFIGURABLE),
};

JSValue global = JS_GetGlobalObject(ctx);
JS_SetPropertyFunctionList(
ctx,
Expand Down
2 changes: 0 additions & 2 deletions qjswasm/qjswasm.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


macro(add_qjs_libc_if_needed target)
if(NOT QJS_BUILD_LIBC)
target_sources(${target} PRIVATE quickjs-libc.c)
Expand Down
2 changes: 1 addition & 1 deletion qjswasm/quickjs
Loading