summaryrefslogtreecommitdiff
path: root/render/html.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2016-01-21 14:11:36 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2016-01-21 14:11:36 +0000
commit594012ef52a6237995d1100d1a3315470b191cbe (patch)
treea87c4caf156b6b37073110962a507954b0598d90 /render/html.c
parent3dcf7d80a140d5c02a56423dbc3575bbdf51ff82 (diff)
downloadnetsurf-594012ef52a6237995d1100d1a3315470b191cbe.tar.gz
netsurf-594012ef52a6237995d1100d1a3315470b191cbe.tar.bz2
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.
Diffstat (limited to 'render/html.c')
-rw-r--r--render/html.c5
1 files changed, 3 insertions, 2 deletions
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;