summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-11-01 11:35:20 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-11-01 11:36:40 (EDT)
commit573a8cc72599ec460d390b7bb1d896b6af269a6b (patch)
tree5e33c2b12baf530af05c648d24a045c872dad6d1 /src
parent445993e974fc72cf2c9634bfe7f37e3b6171549e (diff)
downloadmarquee-573a8cc72599ec460d390b7bb1d896b6af269a6b.zip
marquee-573a8cc72599ec460d390b7bb1d896b6af269a6b.tar.gz
marquee-573a8cc72599ec460d390b7bb1d896b6af269a6b.tar.bz2
mq_web_view_view_source_scheme_methods.initialize(): Use MqSettings with JS enabled
Prism and only Prism runs in "view-source" pages.
Diffstat (limited to 'src')
-rw-r--r--src/web-view-schemes/view-source.c24
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);