From 6ba199c7d7bee1909107ee0b8cbaf749c575b310 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Mon, 5 Aug 2019 14:29:53 +0100 Subject: Content messages: Remove ERRORCODE, rework ERROR This reworks CONTENT_MSG_ERROR to be structured data and removes the CONTENT_MSG_ERRORCODE message kind. Signed-off-by: Daniel Silverstone --- content/handlers/css/css.c | 1 - content/handlers/html/html_css.c | 4 +--- content/handlers/html/html_object.c | 8 ++------ content/handlers/html/html_script.c | 12 +++--------- content/handlers/image/jpeg.c | 3 ++- 5 files changed, 8 insertions(+), 20 deletions(-) (limited to 'content/handlers') diff --git a/content/handlers/css/css.c b/content/handlers/css/css.c index 3e00879f3..af7aafc60 100644 --- a/content/handlers/css/css.c +++ b/content/handlers/css/css.c @@ -634,7 +634,6 @@ nserror nscss_import(hlcache_handle *handle, error = nscss_import_complete(ctx); break; - case CONTENT_MSG_ERRORCODE: case CONTENT_MSG_ERROR: hlcache_handle_release(handle); ctx->css->imports[ctx->index].c = NULL; diff --git a/content/handlers/html/html_css.c b/content/handlers/html/html_css.c index 70ed83f3d..9d7cc7132 100644 --- a/content/handlers/html/html_css.c +++ b/content/handlers/html/html_css.c @@ -116,10 +116,8 @@ html_convert_css_callback(hlcache_handle *css, case CONTENT_MSG_ERROR: NSLOG(netsurf, INFO, "stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), - event->data.error); - /* fall through */ + event->data.errordata.errormsg); - case CONTENT_MSG_ERRORCODE: hlcache_handle_release(css); s->sheet = NULL; parent->base.active--; diff --git a/content/handlers/html/html_object.c b/content/handlers/html/html_object.c index f49af6505..dc8524499 100644 --- a/content/handlers/html/html_object.c +++ b/content/handlers/html/html_object.c @@ -137,9 +137,7 @@ html_object_callback(hlcache_handle *object, struct box *box; box = o->box; - if (box == NULL && - event->type != CONTENT_MSG_ERROR && - event->type != CONTENT_MSG_ERRORCODE) { + if (box == NULL && event->type != CONTENT_MSG_ERROR) { return NSERROR_OK; } @@ -195,7 +193,6 @@ html_object_callback(hlcache_handle *object, } break; - case CONTENT_MSG_ERRORCODE: case CONTENT_MSG_ERROR: hlcache_handle_release(object); @@ -472,8 +469,7 @@ html_object_callback(hlcache_handle *object, c->base.active == 0 && (event->type == CONTENT_MSG_LOADING || event->type == CONTENT_MSG_DONE || - event->type == CONTENT_MSG_ERROR || - event->type == CONTENT_MSG_ERRORCODE)) { + event->type == CONTENT_MSG_ERROR)) { /* all objects have arrived */ content__reformat(&c->base, false, c->base.available_width, c->base.available_height); diff --git a/content/handlers/html/html_script.c b/content/handlers/html/html_script.c index 5af4750ff..14e291ae1 100644 --- a/content/handlers/html/html_script.c +++ b/content/handlers/html/html_script.c @@ -183,10 +183,8 @@ convert_script_async_cb(hlcache_handle *script, case CONTENT_MSG_ERROR: NSLOG(netsurf, INFO, "script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), - event->data.error); - /* fall through */ + event->data.errordata.errormsg); - case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; @@ -259,10 +257,8 @@ convert_script_defer_cb(hlcache_handle *script, case CONTENT_MSG_ERROR: NSLOG(netsurf, INFO, "script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), - event->data.error); - /* fall through */ + event->data.errordata.errormsg); - case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; @@ -350,10 +346,8 @@ convert_script_sync_cb(hlcache_handle *script, case CONTENT_MSG_ERROR: NSLOG(netsurf, INFO, "script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), - event->data.error); - /* fall through */ + event->data.errordata.errormsg); - case CONTENT_MSG_ERRORCODE: hlcache_handle_release(script); s->data.handle = NULL; parent->base.active--; diff --git a/content/handlers/image/jpeg.c b/content/handlers/image/jpeg.c index 52cdb2201..9df084b74 100644 --- a/content/handlers/image/jpeg.c +++ b/content/handlers/image/jpeg.c @@ -329,7 +329,8 @@ static bool nsjpeg_convert(struct content *c) if (setjmp(setjmp_buffer)) { jpeg_destroy_decompress(&cinfo); - msg_data.error = nsjpeg_error_buffer; + msg_data.errordata.errorcode = NSERROR_UNKNOWN; + msg_data.errordata.errormsg = nsjpeg_error_buffer; content_broadcast(c, CONTENT_MSG_ERROR, &msg_data); return false; } -- cgit v1.2.3