diff --git a/render/box_construct.c b/render/box_construct.c index ad39684a1..6a363166f 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1627,7 +1627,7 @@ bool box_image(BOX_SPECIAL_PARAMS) bool box_noscript(BOX_SPECIAL_PARAMS) { /* If scripting is enabled, do not display the contents of noscript */ - if (nsoption_bool(enable_javascript)) + if (content->enable_scripting) *convert_children = false; return true; @@ -3025,7 +3025,7 @@ bool box_extract_link(const html_content *content, } s[j] = 0; - if (nsoption_bool(enable_javascript) == false) { + if (content->enable_scripting == false) { /* extract first quoted string out of "javascript:" link */ if (strncmp(s, "javascript:", 11) == 0) { apos0 = strchr(s, '\''); diff --git a/render/html.c b/render/html.c index a21901775..06e2e0673 100644 --- a/render/html.c +++ b/render/html.c @@ -850,6 +850,7 @@ html_create_html_data(html_content *c, const http_parameter *params) c->scripts = NULL; c->jscontext = NULL; + c->enable_scripting = nsoption_bool(enable_javascript); c->base.active = 1; /* The html content itself is active */ if (lwc_intern_string("*", SLEN("*"), &c->universal) != lwc_error_ok) { @@ -876,7 +877,7 @@ html_create_html_data(html_content *c, const http_parameter *params) /* Create the parser binding */ parse_params.enc = c->encoding; parse_params.fix_enc = true; - parse_params.enable_script = nsoption_bool(enable_javascript); + parse_params.enable_script = c->enable_scripting; parse_params.msg = NULL; parse_params.script = html_process_script; parse_params.ctx = c; @@ -1019,7 +1020,7 @@ html_process_encoding_change(struct content *c, parse_params.enc = html->encoding; parse_params.fix_enc = true; - parse_params.enable_script = nsoption_bool(enable_javascript); + parse_params.enable_script = html->enable_scripting; parse_params.msg = NULL; parse_params.script = html_process_script; parse_params.ctx = html; diff --git a/render/html_internal.h b/render/html_internal.h index e5740dbda..aaecb7823 100644 --- a/render/html_internal.h +++ b/render/html_internal.h @@ -97,6 +97,9 @@ typedef struct html_content { /** Whether a layout (reflow) is in progress */ bool reflowing; + /** Whether scripts are enabled for this content */ + bool enable_scripting; + /* Title element node */ dom_node *title;