summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-05-05 21:05:27 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-05-05 22:17:10 +0100
commit8474c5d4c0b59e74e2ef001b5033b78d7a99fcad (patch)
tree7263eabd9bcd9c8093a822e4f051d7bd9fc45830 /content
parent6952a239465811c26838e177d35222fd5229e393 (diff)
downloadnetsurf-8474c5d4c0b59e74e2ef001b5033b78d7a99fcad.tar.gz
netsurf-8474c5d4c0b59e74e2ef001b5033b78d7a99fcad.tar.bz2
Logging: migrate and provide content interface
Migrate the console enums into netsurf/console.h and add support so that contents can raise a message to log to the console. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content')
-rw-r--r--content/content.h9
-rw-r--r--content/handlers/html/html.c2
2 files changed, 10 insertions, 1 deletions
diff --git a/content/content.h b/content/content.h
index 77cc60574..417fb7b95 100644
--- a/content/content.h
+++ b/content/content.h
@@ -33,6 +33,7 @@
#include "content/content_factory.h"
#include "desktop/search.h" /* search flags enum */
#include "netsurf/mouse.h" /* mouse state enums */
+#include "netsurf/console.h" /* console state and flags enums */
struct browser_window;
struct browser_window_features;
@@ -56,6 +57,7 @@ typedef enum {
/** Used in callbacks to indicate what has occurred. */
typedef enum {
+ CONTENT_MSG_LOG, /**< Content wishes to log something */
CONTENT_MSG_LOADING, /**< fetching or converting */
CONTENT_MSG_READY, /**< may be displayed */
CONTENT_MSG_DONE, /**< finished */
@@ -95,6 +97,13 @@ struct content_rfc5988_link {
/** Extra data for some content_msg messages. */
union content_msg_data {
+ /** CONTENT_MSG_LOG - Information for logging */
+ struct {
+ browser_window_console_source src; /**< The source of the logging */
+ const char *msg; /**< The message to log */
+ size_t msglen; /**< The length of that message */
+ browser_window_console_flags flags; /**< The flags of the logging */
+ } log;
/** CONTENT_MSG_ERROR - Error message */
const char *error;
/** CONTENT_MSG_ERRORCODE - Error code */
diff --git a/content/handlers/html/html.c b/content/handlers/html/html.c
index a47725ba4..4ffdb396a 100644
--- a/content/handlers/html/html.c
+++ b/content/handlers/html/html.c
@@ -2514,7 +2514,7 @@ static bool html_exec(struct content *c, const char *src, size_t srclen)
dom_text *text_node;
dom_node *spare_node;
dom_html_script_element *script_node;
-
+
if (htmlc->document == NULL) {
NSLOG(netsurf, DEEPDEBUG, "Unable to exec, no document");
goto out_no_string;