summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/content.c8
-rw-r--r--content/content.h16
-rw-r--r--content/handlers/css/css.c1
-rw-r--r--content/handlers/html/html_css.c4
-rw-r--r--content/handlers/html/html_object.c8
-rw-r--r--content/handlers/html/html_script.c12
-rw-r--r--content/handlers/image/jpeg.c3
-rw-r--r--content/hlcache.c14
8 files changed, 33 insertions, 33 deletions
diff --git a/content/content.c b/content/content.c
index af4cdaac3..367a0e5d1 100644
--- a/content/content.c
+++ b/content/content.c
@@ -173,7 +173,8 @@ nserror content_llcache_callback(llcache_handle *llcache,
case LLCACHE_EVENT_ERROR:
/** \todo Error page? */
c->status = CONTENT_STATUS_ERROR;
- msg_data.error = event->data.msg;
+ msg_data.errordata.errorcode = NSERROR_UNKNOWN;
+ msg_data.errordata.errormsg = event->data.msg;
content_broadcast(c, CONTENT_MSG_ERROR, &msg_data);
break;
case LLCACHE_EVENT_PROGRESS:
@@ -816,12 +817,13 @@ void content_broadcast_errorcode(struct content *c, nserror errorcode)
assert(c);
- data.errorcode = errorcode;
+ data.errordata.errorcode = errorcode;
+ data.errordata.errormsg = NULL;
for (user = c->user_list->next; user != 0; user = next) {
next = user->next; /* user may be destroyed during callback */
if (user->callback != 0) {
- user->callback(c, CONTENT_MSG_ERRORCODE,
+ user->callback(c, CONTENT_MSG_ERROR,
&data, user->pw);
}
}
diff --git a/content/content.h b/content/content.h
index 304384b8f..4fdcaf2c0 100644
--- a/content/content.h
+++ b/content/content.h
@@ -65,7 +65,6 @@ typedef enum {
CONTENT_MSG_READY, /**< may be displayed */
CONTENT_MSG_DONE, /**< finished */
CONTENT_MSG_ERROR, /**< error occurred */
- CONTENT_MSG_ERRORCODE, /**< error occurred return nserror */
CONTENT_MSG_REDIRECT, /**< fetch url redirect occured */
CONTENT_MSG_STATUS, /**< new status string */
CONTENT_MSG_REFORMAT, /**< content_reformat done */
@@ -112,10 +111,17 @@ union content_msg_data {
const struct llcache_query_msg *query_msg;
/** CONTENT_MSG_QUERY_FINISHED - Query from underlying object finished */
void *query_finished_pw;
- /** CONTENT_MSG_ERROR - Error message */
- const char *error;
- /** CONTENT_MSG_ERRORCODE - Error code */
- nserror errorcode;
+ /** CONTENT_MSG_ERROR - Error from content or underlying fetch */
+ struct {
+ nserror errorcode; /**< The error code to convey meaning */
+ const char *errormsg; /**< The message.
+ * if NSERROR_UNKNOWN then this is the
+ * direct message, otherwise is some
+ * kind of metadata (e.g. a message name
+ * or somesuch) but always a nul
+ * terminated string.
+ */
+ } errordata;
/** CONTENT_MSG_REDIRECT - Redirect info */
struct {
struct nsurl *from; /**< Redirect origin */
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;
}
diff --git a/content/hlcache.c b/content/hlcache.c
index 92bf690ed..ca0e47907 100644
--- a/content/hlcache.c
+++ b/content/hlcache.c
@@ -361,7 +361,8 @@ static nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
hlcache_event hlevent;
hlevent.type = CONTENT_MSG_ERROR;
- hlevent.data.error = messages_get("MiscError");
+ hlevent.data.errordata.errorcode = NSERROR_UNKNOWN;
+ hlevent.data.errordata.errormsg = messages_get("MiscError");
ctx->handle->cb(ctx->handle, &hlevent,
ctx->handle->pw);
@@ -393,7 +394,8 @@ static nserror hlcache_migrate_ctx(hlcache_retrieval_ctx *ctx,
hlcache_event hlevent;
hlevent.type = CONTENT_MSG_ERROR;
- hlevent.data.error = messages_get("UnacceptableType");
+ hlevent.data.errordata.errorcode = NSERROR_UNKNOWN;
+ hlevent.data.errordata.errormsg = messages_get("UnacceptableType");
ctx->handle->cb(ctx->handle, &hlevent,
ctx->handle->pw);
@@ -489,8 +491,9 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
if (ctx->handle->cb != NULL) {
hlcache_event hlevent;
- hlevent.type = CONTENT_MSG_ERRORCODE;
- hlevent.data.errorcode = error;
+ hlevent.type = CONTENT_MSG_ERROR;
+ hlevent.data.errordata.errorcode = error;
+ hlevent.data.errordata.errormsg = NULL;
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
}
@@ -500,7 +503,8 @@ static nserror hlcache_llcache_callback(llcache_handle *handle,
hlcache_event hlevent;
hlevent.type = CONTENT_MSG_ERROR;
- hlevent.data.error = event->data.msg;
+ hlevent.data.errordata.errorcode = NSERROR_UNKNOWN;
+ hlevent.data.errordata.errormsg = event->data.msg;
ctx->handle->cb(ctx->handle, &hlevent, ctx->handle->pw);
}