quickjs 0.6.1 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/quickjsrb/quickjsrb.c +11 -2
- data/lib/quickjs/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95d674410910d349e2516908eb9856497e150d762b43d4ef8166fa057735164b
|
4
|
+
data.tar.gz: 4f605447ac29745e811f6892d0328b1423b8e3d456d278ed4ad0358273a581c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d135b91487315a81758b37550bb3213a3ec9b565f552ad670b07420bbb06733fc635446b82e89a2f7dd79c7d4bfe3228933655874829f3c8f76d4b3b9f96c3ff
|
7
|
+
data.tar.gz: acad0e1cd26f6f8b55e2596bdb616d6c93ed49190af6ff3e9e4bc4b886fd6756c51f98a8d9b40e8bb442f70521f0fc283e375eb682dd75036d3436581a7f285f
|
data/ext/quickjsrb/quickjsrb.c
CHANGED
@@ -101,6 +101,10 @@ VALUE find_ruby_error(JSContext *ctx, JSValue j_error)
|
|
101
101
|
return rb_funcall(rb_const_get(rb_cClass, rb_intern("ObjectSpace")), rb_intern("_id2ref"), 1, INT2NUM(errorOriginalRubyObjectId));
|
102
102
|
}
|
103
103
|
}
|
104
|
+
else
|
105
|
+
{
|
106
|
+
JS_FreeValue(ctx, j_errorOriginalRubyObjectId);
|
107
|
+
}
|
104
108
|
return Qnil;
|
105
109
|
}
|
106
110
|
|
@@ -339,7 +343,9 @@ static JSValue js_quickjsrb_call_global(JSContext *ctx, JSValueConst _this, int
|
|
339
343
|
VALUE r_argv = rb_ary_new();
|
340
344
|
for (int i = 0; i < argc; i++)
|
341
345
|
{
|
342
|
-
|
346
|
+
JSValue j_v = JS_DupValue(ctx, argv[i]);
|
347
|
+
rb_ary_push(r_argv, to_rb_value(ctx, j_v));
|
348
|
+
JS_FreeValue(ctx, j_v);
|
343
349
|
}
|
344
350
|
rb_ary_push(r_call_args, r_argv);
|
345
351
|
rb_ary_push(r_call_args, ULONG2NUM(data->eval_time->limit * 1000 / CLOCKS_PER_SEC));
|
@@ -399,11 +405,12 @@ static JSValue js_quickjsrb_log(JSContext *ctx, JSValueConst _this, int argc, JS
|
|
399
405
|
VALUE r_row = rb_ary_new();
|
400
406
|
for (int i = 0; i < argc; i++)
|
401
407
|
{
|
402
|
-
JSValue j_logged = argv[i];
|
408
|
+
JSValue j_logged = JS_DupValue(ctx, argv[i]);
|
403
409
|
VALUE r_raw = JS_VALUE_GET_NORM_TAG(j_logged) == JS_TAG_OBJECT && JS_PromiseState(ctx, j_logged) != -1 ? rb_str_new2("Promise") : to_rb_value(ctx, j_logged);
|
404
410
|
const char *body = JS_ToCString(ctx, j_logged);
|
405
411
|
VALUE r_c = rb_str_new2(body);
|
406
412
|
JS_FreeCString(ctx, body);
|
413
|
+
JS_FreeValue(ctx, j_logged);
|
407
414
|
|
408
415
|
rb_ary_push(r_row, r_log_body_new(r_raw, r_c));
|
409
416
|
}
|
@@ -587,6 +594,8 @@ static VALUE vm_m_defineGlobalFunction(int argc, VALUE *argv, VALUE r_self)
|
|
587
594
|
data->context, j_global, funcName,
|
588
595
|
JS_NewCFunctionData(data->context, js_quickjsrb_call_global, 1, 0, 2, ruby_data));
|
589
596
|
JS_FreeValue(data->context, j_global);
|
597
|
+
JS_FreeValue(data->context, ruby_data[0]);
|
598
|
+
JS_FreeValue(data->context, ruby_data[1]);
|
590
599
|
|
591
600
|
return rb_funcall(r_name, rb_intern("to_sym"), 0, NULL);
|
592
601
|
}
|
data/lib/quickjs/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quickjs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmsk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-01-
|
11
|
+
date: 2025-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|