diff options
-rw-r--r-- | src/web-view-schemes/view-source.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/web-view-schemes/view-source.c b/src/web-view-schemes/view-source.c index e87c69c..3d72195 100644 --- a/src/web-view-schemes/view-source.c +++ b/src/web-view-schemes/view-source.c @@ -29,10 +29,13 @@ #include "../application.h" #include "../config.h" +#include "../settings.h" #include "../string-utils.h" #include "../tab-page.h" #include "../web-view.h" +static MqSettings *settings = NULL; + static gboolean match_uri(const gchar *uri) { @@ -40,12 +43,31 @@ match_uri(const gchar *uri) } static void -initialize(MqWebView G_GNUC_UNUSED *web_view, MqWebViewScheme *scheme, +init_settings(MqConfig *config) +{ + if (settings) { + return; + } + + settings = mq_settings_new(); + mq_settings_set_web_context(settings, webkit_web_context_get_default()); + mq_settings_override_bool(settings, "permissions.javascript.enable", + TRUE); + mq_settings_connect_config(settings, config); +} + +static void +initialize(MqWebView *web_view, MqWebViewScheme *scheme, const gchar *uri) { gchar *query_str; GHashTable *query; + init_settings(mq_web_view_get_config(web_view)); + + webkit_web_view_set_settings(WEBKIT_WEB_VIEW(web_view), + WEBKIT_SETTINGS(settings)); + query_str = g_strdup(uri + strlen("view-source:")); query = mq_parse_query_string(query_str); |