target: mbedos5: Improve setInterval and setTimeout (#1931)

In setInterval and setTimeout there must be a reference increase to the given function.
If you use `jerry_acquire` and you want to cleanup the engine,
you get an assertion, because this value is released nowhere in the code.
In my opinion it is better to set the function as a property, so it is released automatically.

In launcher.cpp there is bad error handle. If `returned_value` has error flag, `parsed_code` is not released.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
This commit is contained in:
fbmrk
2017-08-25 15:01:53 +02:00
committed by László Langó
parent fe32b5c5d1
commit 1a18766488
3 changed files with 37 additions and 3 deletions
@@ -45,19 +45,21 @@ static int load_javascript() {
if (jerry_value_has_error_flag(parsed_code)) {
LOG_PRINT_ALWAYS("jerry_parse failed [%s]\r\n", js_codes[src].name);
jerry_release_value(parsed_code);
jsmbed_js_exit();
return -1;
}
jerry_value_t returned_value = jerry_run(parsed_code);
jerry_release_value(parsed_code);
if (jerry_value_has_error_flag(returned_value)) {
LOG_PRINT_ALWAYS("jerry_run failed [%s]\r\n", js_codes[src].name);
jerry_release_value(returned_value);
jsmbed_js_exit();
return -1;
}
jerry_release_value(parsed_code);
jerry_release_value(returned_value);
}