summaryrefslogtreecommitdiff
path: root/content/handlers/html
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2019-05-04 17:32:17 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2019-05-04 17:32:17 +0100
commited829a477222f169e4ff0727db920e8029fd0c7d (patch)
tree02972aa43de616e3f307754e661d92b22860b675 /content/handlers/html
parent8009444918b167e8499c8abb06e406d9769c38e8 (diff)
downloadnetsurf-ed829a477222f169e4ff0727db920e8029fd0c7d.tar.gz
netsurf-ed829a477222f169e4ff0727db920e8029fd0c7d.tar.bz2
JS: Attribute external JS to the URI it came from in backtraces
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'content/handlers/html')
-rw-r--r--content/handlers/html/html_script.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/content/handlers/html/html_script.c b/content/handlers/html/html_script.c
index 6f62fb989..405f6d43c 100644
--- a/content/handlers/html/html_script.c
+++ b/content/handlers/html/html_script.c
@@ -42,7 +42,7 @@
#include "html/html.h"
#include "html/html_internal.h"
-typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size) ;
+typedef bool (script_handler_t)(struct jscontext *jscontext, const char *data, size_t size, const char *name);
static script_handler_t *select_script_handler(content_type ctype)
@@ -91,10 +91,11 @@ nserror html_script_exec(html_content *c, bool allow_defer)
CONTENT_STATUS_DONE) {
/* external script is now available */
const char *data;
- unsigned long size;
+ size_t size;
data = content_get_source_data(
s->data.handle, &size );
- script_handler(c->jscontext, data, size);
+ script_handler(c->jscontext, data, size,
+ nsurl_access(hlcache_handle_get_url(s->data.handle)));
s->already_started = true;
@@ -307,7 +308,8 @@ convert_script_sync_cb(hlcache_handle *script,
const char *data;
unsigned long size;
data = content_get_source_data(s->data.handle, &size );
- script_handler(parent->jscontext, data, size);
+ script_handler(parent->jscontext, data, size,
+ nsurl_access(hlcache_handle_get_url(s->data.handle)));
}
/* continue parse */
@@ -531,7 +533,8 @@ exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
if (script_handler != NULL) {
script_handler(c->jscontext,
dom_string_data(script),
- dom_string_byte_length(script));
+ dom_string_byte_length(script),
+ "?inline script?");
}
return DOM_HUBBUB_OK;
}