[Xfce4-commits] <midori:master> Re-use JSContextRef for about:version scripts
Christian Dywan
noreply at xfce.org
Wed Apr 4 22:56:02 CEST 2012
Updating branch refs/heads/master
to d7aafda6db9a39307ae9663202d95901e7895467 (commit)
from 1f56e0af6fac0099de16f02fe3837ca029f4d2d5 (commit)
commit d7aafda6db9a39307ae9663202d95901e7895467
Author: Christian Dywan <christian at twotoasts.de>
Date: Wed Apr 4 22:36:00 2012 +0200
Re-use JSContextRef for about:version scripts
midori/midori-view.c | 20 ++++++++------------
wscript | 2 +-
2 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/midori/midori-view.c b/midori/midori-view.c
index 6d392f7..5217605 100644
--- a/midori/midori-view.c
+++ b/midori/midori-view.c
@@ -3788,13 +3788,11 @@ midori_view_construct_web_view (MidoriView* view)
NULL);
}
-static gchar* list_netscape_plugins ()
+static gchar*
+list_netscape_plugins (JSContextRef js_context)
{
if (midori_web_settings_has_plugin_support ())
{
- GtkWidget* web_view = webkit_web_view_new ();
- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
/* Joins available plugins like this: URI1|title1,URI2|title2 */
gchar* value = sokoke_js_script_eval (js_context,
"function plugins (l) { var f = new Array (); for (var i in l) "
@@ -3824,7 +3822,6 @@ static gchar* list_netscape_plugins ()
g_string_append (ns_plugins, "</table>");
g_strfreev (items);
g_free (value);
- gtk_widget_destroy (web_view);
return g_string_free (ns_plugins, FALSE);
}
else
@@ -3832,11 +3829,9 @@ static gchar* list_netscape_plugins ()
}
static gchar*
-list_video_formats ()
+static gchar*
+list_video_formats (JSContextRef js_context)
{
- GtkWidget* web_view = webkit_web_view_new ();
- WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (web_view));
- JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
gchar* value = sokoke_js_script_eval (js_context,
"var supported = function (format) { "
"var video = document.createElement('video');"
@@ -3849,7 +3844,6 @@ list_video_formats ()
"' WebM [' + "
"supported('video/webm; codecs=\"vp8, vorbis\"') + ']' "
"", NULL);
- gtk_widget_destroy (web_view);
return value;
}
@@ -4134,8 +4128,10 @@ midori_view_set_uri (MidoriView* view,
const gchar* sys_name = midori_web_settings_get_system_name (
&architecture, &platform);
gchar* ident = katze_object_get_string (view->settings, "user-agent");
- gchar* netscape_plugins = list_netscape_plugins ();
- gchar* video_formats = list_video_formats ();
+ WebKitWebFrame* web_frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view->web_view));
+ JSContextRef js_context = webkit_web_frame_get_global_context (web_frame);
+ gchar* netscape_plugins = list_netscape_plugins (js_context);
+ gchar* video_formats = list_video_formats (js_context);
katze_assign (view->uri, g_strdup (uri));
data = g_strdup_printf (
diff --git a/wscript b/wscript
index 737f9bf..4ac7043 100644
--- a/wscript
+++ b/wscript
@@ -45,7 +45,7 @@ except:
pass
srcdir = '.'
-blddir = '_build_'
+blddir = '_build' # recognized by ack
def option_enabled (option):
if getattr (Options.options, 'enable_' + option):
More information about the Xfce4-commits
mailing list