[gnome-builder] webkit: disable webkit local storage



commit 7038e57ae3054bb24e35b9c9271aa0d54fec9245
Author: Christian Hergert <christian hergert me>
Date:   Thu Sep 3 22:59:02 2015 -0700

    webkit: disable webkit local storage
    
    Until the bug is fixed upstream, keep this disabled.

 plugins/devhelp/gb-devhelp-view.c                  |   21 +++++++++++++++++--
 .../html-preview/html_preview_plugin/__init__.py   |    7 +++--
 2 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/plugins/devhelp/gb-devhelp-view.c b/plugins/devhelp/gb-devhelp-view.c
index f0b932b..107d80b 100644
--- a/plugins/devhelp/gb-devhelp-view.c
+++ b/plugins/devhelp/gb-devhelp-view.c
@@ -22,7 +22,6 @@
 #include <webkit2/webkit2.h>
 
 #include "gb-devhelp-view.h"
-#include "gb-webkit.h"
 #include "gb-widget.h"
 
 struct _GbDevhelpView
@@ -48,6 +47,22 @@ enum {
 
 static GParamSpec *gParamSpecs [LAST_PROP];
 
+static void
+apply_settings (WebKitWebView *view)
+{
+  g_return_if_fail (WEBKIT_IS_WEB_VIEW (view));
+
+  /*
+   * TODO: Consider whether HTML5 local storage should be enabled. It could only
+   * possibly be useful for complex web sites, but if you're building a web site
+   * with Builder then it might be useful to have. But leave disabled until
+   * https://bugs.webkit.org/show_bug.cgi?id=143245 has been fixed.
+   */
+  g_object_set (webkit_web_view_get_settings (view),
+                "enable-html5-local-storage", FALSE,
+                NULL);
+}
+
 GbView *
 gb_devhelp_view_new (GbDevhelpDocument *document)
 {
@@ -152,7 +167,7 @@ gb_devhelp_view_set_split_view (GbView   *view,
       self->web_view2 = g_object_new (WEBKIT_TYPE_WEB_VIEW,
                                       "visible", TRUE,
                                       NULL);
-      gb_webkit_web_view_apply_settings (self->web_view2);
+      apply_settings (self->web_view2);
       gtk_container_add_with_properties (GTK_CONTAINER (self->paned), GTK_WIDGET (self->web_view2),
                                          "shrink", FALSE,
                                          "resize", TRUE,
@@ -267,5 +282,5 @@ gb_devhelp_view_init (GbDevhelpView *self)
 {
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  gb_webkit_web_view_apply_settings (self->web_view1);
+  apply_settings (self->web_view1);
 }
diff --git a/plugins/html-preview/html_preview_plugin/__init__.py 
b/plugins/html-preview/html_preview_plugin/__init__.py
index 179c28e..600fc30 100644
--- a/plugins/html-preview/html_preview_plugin/__init__.py
+++ b/plugins/html-preview/html_preview_plugin/__init__.py
@@ -44,9 +44,6 @@ class HtmlPreviewData(GObject.Object, Builder.ApplicationAddin):
     MARKDOWN_VIEW_JS = None
 
     def do_load(self, app):
-        settings = WebKit2.Settings()
-        settings.enable_html5_local_storage = False
-
         HtmlPreviewData.MARKDOWN_CSS = self.get_data('markdown.css')
         HtmlPreviewData.MARKED_JS = self.get_data('marked.js')
         HtmlPreviewData.MARKDOWN_VIEW_JS = self.get_data('markdown-view.js')
@@ -106,6 +103,10 @@ class HtmlPreviewView(Builder.View):
         self.webview = WebKit2.WebView(visible=True, expand=True)
         self.add(self.webview)
 
+        settings = self.webview.get_settings()
+        settings.enable_html5_local_storage = False
+
+
         language = document.get_language()
         if language and language.get_id() == 'markdown':
             self.markdown = True


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]