js 2.9.3 → 2.10.0
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/js/js-core.c +13 -3
- data/ext/js/types.h +1 -0
- data/lib/js/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c0e622364135cef14eeb1950bc03d2ecb307bec7be4f132578a65dca3c3d6a7e
|
|
4
|
+
data.tar.gz: f9593ab2121d2e3149565f2bca1cfb2f2a1747b92e08352aed36bd59b7c077a5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 897bfea7a5582eccb5b89eb7dd55ef0f847c08c3e146fe4357c5727582ffc350ae1cb35fa3dbe92dae5ce1c2e1cb3e1a5f4f0ca0a6589b7e4c08eda1611be066
|
|
7
|
+
data.tar.gz: '0870befd10a735f357b57c49952160343439b0cfc5784fda79e3cf8ed4f731520f2a28ffddc96b2d69460bc04a4aaba94e1f295a9c7fe1dd14224e6e5445650a'
|
data/ext/js/js-core.c
CHANGED
|
@@ -101,6 +101,7 @@ static VALUE _rb_js_eval_js(VALUE _, VALUE code_str) {
|
|
|
101
101
|
rstring_to_abi_string(code_str, &abi_str);
|
|
102
102
|
rb_js_abi_host_js_abi_result_t ret;
|
|
103
103
|
rb_js_abi_host_eval_js(&abi_str, &ret);
|
|
104
|
+
rb_js_abi_host_string_free(&abi_str);
|
|
104
105
|
raise_js_error_if_failure(&ret);
|
|
105
106
|
return jsvalue_s_new(ret.val.success);
|
|
106
107
|
}
|
|
@@ -197,6 +198,7 @@ static VALUE _rb_js_obj_aref(VALUE obj, VALUE key) {
|
|
|
197
198
|
rstring_to_abi_string(key, &key_abi_str);
|
|
198
199
|
rb_js_abi_host_js_abi_result_t ret;
|
|
199
200
|
rb_js_abi_host_reflect_get(p->abi, &key_abi_str, &ret);
|
|
201
|
+
rb_js_abi_host_string_free(&key_abi_str);
|
|
200
202
|
raise_js_error_if_failure(&ret);
|
|
201
203
|
return jsvalue_s_new(ret.val.success);
|
|
202
204
|
}
|
|
@@ -224,6 +226,7 @@ static VALUE _rb_js_obj_aset(VALUE obj, VALUE key, VALUE val) {
|
|
|
224
226
|
rstring_to_abi_string(key, &key_abi_str);
|
|
225
227
|
rb_js_abi_host_js_abi_result_t ret;
|
|
226
228
|
rb_js_abi_host_reflect_set(p->abi, &key_abi_str, v->abi, &ret);
|
|
229
|
+
rb_js_abi_host_string_free(&key_abi_str);
|
|
227
230
|
raise_js_error_if_failure(&ret);
|
|
228
231
|
rb_js_abi_host_js_abi_value_free(&ret.val.success);
|
|
229
232
|
RB_GC_GUARD(rv);
|
|
@@ -346,7 +349,9 @@ static VALUE _rb_js_obj_typeof(VALUE obj) {
|
|
|
346
349
|
struct jsvalue *p = check_jsvalue(obj);
|
|
347
350
|
rb_js_abi_host_string_t ret0;
|
|
348
351
|
rb_js_abi_host_js_value_typeof(p->abi, &ret0);
|
|
349
|
-
|
|
352
|
+
VALUE typeof_str = rb_str_new((const char *)ret0.ptr, ret0.len);
|
|
353
|
+
rb_js_abi_host_string_free(&ret0);
|
|
354
|
+
return typeof_str;
|
|
350
355
|
}
|
|
351
356
|
|
|
352
357
|
/*
|
|
@@ -366,7 +371,9 @@ static VALUE _rb_js_obj_to_s(VALUE obj) {
|
|
|
366
371
|
struct jsvalue *p = check_jsvalue(obj);
|
|
367
372
|
rb_js_abi_host_string_t ret0;
|
|
368
373
|
rb_js_abi_host_js_value_to_string(p->abi, &ret0);
|
|
369
|
-
|
|
374
|
+
VALUE to_s_str = rb_utf8_str_new((const char *)ret0.ptr, ret0.len);
|
|
375
|
+
rb_js_abi_host_string_free(&ret0);
|
|
376
|
+
return to_s_str;
|
|
370
377
|
}
|
|
371
378
|
|
|
372
379
|
/*
|
|
@@ -494,7 +501,10 @@ static VALUE _rb_js_float_to_js(VALUE obj) {
|
|
|
494
501
|
static VALUE _rb_js_string_to_js(VALUE obj) {
|
|
495
502
|
rb_js_abi_host_string_t abi_str;
|
|
496
503
|
rstring_to_abi_string(obj, &abi_str);
|
|
497
|
-
|
|
504
|
+
rb_js_abi_host_own_js_abi_value_t js_str =
|
|
505
|
+
rb_js_abi_host_string_to_js_string(&abi_str);
|
|
506
|
+
rb_js_abi_host_string_free(&abi_str);
|
|
507
|
+
return jsvalue_s_new(js_str);
|
|
498
508
|
}
|
|
499
509
|
|
|
500
510
|
/*
|
data/ext/js/types.h
CHANGED
|
@@ -44,6 +44,7 @@ typedef ext_list_string_t rb_abi_guest_list_string_t;
|
|
|
44
44
|
ruby_js_js_runtime_export_js_value_to_host(borrow_js_value(value))
|
|
45
45
|
# define rb_js_abi_host_raw_integer_free(ptr) \
|
|
46
46
|
ruby_js_js_runtime_raw_integer_free(ptr)
|
|
47
|
+
# define rb_js_abi_host_string_free(ptr) ext_string_free(ptr)
|
|
47
48
|
# define rb_js_abi_host_rb_object_to_js_rb_value(val) \
|
|
48
49
|
ruby_js_js_runtime_rb_object_to_js_rb_value(val)
|
|
49
50
|
# define rb_js_abi_host_int_to_js_number(val) \
|
data/lib/js/version.rb
CHANGED