Previous to adding user scripts to the content manager, we should always
clear existing scripts. Otherwise, e.g. in the sequence
:set user-scripts=off
:set user-scripts=on
we'd end up with the same global scripts injected twice.
Fix the issue by unconditionally clearing all user scripts previous to
adding scripts.
gboolean enabled = *(gboolean*)value;
ucm = webkit_web_view_get_user_content_manager(c->webview);
+ webkit_user_content_manager_remove_all_scripts(ucm);
if (enabled) {
if (vb.files[FILES_SCRIPT]
webkit_user_script_unref(script);
g_free(source);
}
- } else {
- webkit_user_content_manager_remove_all_scripts(ucm);
}
/* Inject the global scripts. */