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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2ce6616967d7e98c759d616464d2fbec0ba6963cc064e52115ca6a584146347f
4
- data.tar.gz: 1ba756125068a24321117502d7cef0924d0274dcc07572ff6c6832106aea28f9
3
+ metadata.gz: 95d674410910d349e2516908eb9856497e150d762b43d4ef8166fa057735164b
4
+ data.tar.gz: 4f605447ac29745e811f6892d0328b1423b8e3d456d278ed4ad0358273a581c5
5
5
  SHA512:
6
- metadata.gz: f1da19a035c69f89bbcad61f094943b79b0c39a454418996d43e0696cb8433a96173bcc89bfa3d96bdea43fe7f1a7e50a6048f9f5808c1c8db45b7f60ef637b9
7
- data.tar.gz: 9a7fc4b6e69a82e8d363dc4138b46e1d2d7e94d31bddbfbec09ea9167f92d5a373058b6b47b5250817b57ce2d6a051ae38734127309fce53f075e930b2a6a074
6
+ metadata.gz: d135b91487315a81758b37550bb3213a3ec9b565f552ad670b07420bbb06733fc635446b82e89a2f7dd79c7d4bfe3228933655874829f3c8f76d4b3b9f96c3ff
7
+ data.tar.gz: acad0e1cd26f6f8b55e2596bdb616d6c93ed49190af6ff3e9e4bc4b886fd6756c51f98a8d9b40e8bb442f70521f0fc283e375eb682dd75036d3436581a7f285f
@@ -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
- rb_ary_push(r_argv, to_rb_value(ctx, argv[i]));
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
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Quickjs
4
- VERSION = "0.6.1"
4
+ VERSION = "0.6.3"
5
5
  end
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.1
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-23 00:00:00.000000000 Z
11
+ date: 2025-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json