[devhelp/webkit2] assistant: Use data uris for css and javascript instead of local uris
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devhelp/webkit2] assistant: Use data uris for css and javascript instead of local uris
- Date: Fri, 10 Feb 2012 11:58:00 +0000 (UTC)
commit 0cb37d2148564ce243f3753efa14d7e8afe285b0
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Fri Feb 10 11:04:42 2012 +0100
assistant: Use data uris for css and javascript instead of local uris
This fixes a crash in the WebProcess. In WebKit2, all local uris used in
html loaded with load_html() must be in the same directory of the
base_uri passed to load_html().
src/dh-assistant-view.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/dh-assistant-view.c b/src/dh-assistant-view.c
index b2022c0..f5b111b 100644
--- a/src/dh-assistant-view.c
+++ b/src/dh-assistant-view.c
@@ -275,7 +275,9 @@ dh_assistant_view_set_link (DhAssistantView *view,
gboolean break_line;
const gchar *function;
gchar *stylesheet;
+ gchar *stylesheet_uri;
gchar *javascript;
+ gchar *javascript_uri;
gchar *html;
buf = g_strndup (start, end-start);
@@ -312,16 +314,23 @@ dh_assistant_view_set_link (DhAssistantView *view,
"assistant",
"assistant.css",
NULL);
+ stylesheet_uri = dh_util_create_data_uri_for_filename (stylesheet,
+ "text/css");
+ g_free (stylesheet);
+
javascript = dh_util_build_data_filename ("devhelp",
"assistant",
"assistant.js",
NULL);
+ javascript_uri = dh_util_create_data_uri_for_filename (javascript,
+ "application/javascript");
+ g_free (javascript);
html = g_strdup_printf (
"<html>"
"<head>"
- "<link rel=\"stylesheet\" type=\"text/css\" href=\"file://%s\"/>"
- "<script src=\"file://%s\"></script>"
+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\"/>"
+ "<script src=\"%s\"></script>"
"</head>"
"<body %s>"
"<div class=\"title\">%s: <a href=\"%s\">%s</a></div>"
@@ -329,8 +338,8 @@ dh_assistant_view_set_link (DhAssistantView *view,
"<div class=\"content\">%s</div>"
"</body>"
"</html>",
- stylesheet,
- javascript,
+ stylesheet_uri,
+ javascript_uri,
function,
dh_link_get_type_as_string (link),
dh_link_get_uri (link),
@@ -340,8 +349,8 @@ dh_assistant_view_set_link (DhAssistantView *view,
buf);
g_free (buf);
- g_free (stylesheet);
- g_free (javascript);
+ g_free (stylesheet_uri);
+ g_free (javascript_uri);
priv->snippet_loaded = FALSE;
webkit_web_view_load_html (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]