An experiment in requesting permissions and some related fixes.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3937 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -270,7 +270,7 @@ static void _export_record_release_for_task(tf_task_t* task, taskid_t task_id)
|
||||
}
|
||||
}
|
||||
|
||||
void tf_task_send_error_to_parent(tf_task_t* task, JSValue error)
|
||||
bool tf_task_send_error_to_parent(tf_task_t* task, JSValue error)
|
||||
{
|
||||
if (task && task->_parent)
|
||||
{
|
||||
@ -279,7 +279,9 @@ void tf_task_send_error_to_parent(tf_task_t* task, JSValue error)
|
||||
tf_serialize_store(task, task->_parent, &buffer, &size, error);
|
||||
tf_packetstream_send(tf_taskstub_get_stream(task->_parent), kTaskError, buffer, size);
|
||||
tf_free(buffer);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static const char* _task_loadFile(const char* fileName)
|
||||
@ -337,7 +339,10 @@ int tf_task_execute(tf_task_t* task, const char* fileName)
|
||||
if (source)
|
||||
{
|
||||
JSValue result = JS_Eval(task->_context, source, strlen(source), fileName, JS_EVAL_TYPE_MODULE);
|
||||
tf_util_report_error(task->_context, result);
|
||||
if (tf_util_report_error(task->_context, result))
|
||||
{
|
||||
printf("Reported an error.\n");
|
||||
}
|
||||
if (!JS_IsError(task->_context, result) && !JS_IsException(result))
|
||||
{
|
||||
executed = true;
|
||||
|
@ -73,4 +73,4 @@ void tf_task_report_error(tf_task_t* task, JSValue error);
|
||||
JSValue tf_try_get_typed_array_buffer(JSContext *ctx, JSValueConst obj, size_t *pbyte_offset, size_t *pbyte_length, size_t *pbytes_per_element);
|
||||
uint8_t *tf_try_get_array_buffer(JSContext *ctx, size_t *psize, JSValueConst obj);
|
||||
|
||||
void tf_task_send_error_to_parent(tf_task_t* task, JSValue error);
|
||||
bool tf_task_send_error_to_parent(tf_task_t* task, JSValue error);
|
||||
|
@ -123,20 +123,16 @@ bool tf_util_report_error(JSContext* context, JSValue value)
|
||||
JS_FreeValue(context, stack);
|
||||
|
||||
tf_task_t* task = tf_task_get(context);
|
||||
if (task)
|
||||
if (!task || !tf_task_send_error_to_parent(task, value))
|
||||
{
|
||||
tf_task_send_error_to_parent(task, value);
|
||||
js_std_dump_error(context);
|
||||
}
|
||||
is_error = true;
|
||||
}
|
||||
else if (JS_IsException(value))
|
||||
{
|
||||
tf_task_t* task = tf_task_get(context);
|
||||
if (task)
|
||||
{
|
||||
tf_task_send_error_to_parent(task, value);
|
||||
}
|
||||
else
|
||||
if (!task || !tf_task_send_error_to_parent(task, value))
|
||||
{
|
||||
js_std_dump_error(context);
|
||||
}
|
||||
|
Reference in New Issue
Block a user