From 594012ef52a6237995d1100d1a3315470b191cbe Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 21 Jan 2016 14:11:36 +0000 Subject: Ensure constant javascript_enabled for HTML contents. Now we take the value of the javascript_enabled option when the content is created. We then use the content's script_enabled boolean everywhere else. This prevents us getting inconsistent values for javascript_enabled if a user toggles the setting while a page is loading. It was read frequently during box construction, and also the parser's script enabled setting could change where we handled a change of encoding. Now we only care about the setting of the javascript_enabled option at time of html_content creation. --- render/html.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'render/html.c') 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; -- cgit v1.2.3