summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2010-01-25 14:21:10 -0600
committerShaun McCance <shaunm@gnome.org>2010-01-25 14:21:10 -0600
commita5588114ed94d00ca64913aa5b248e09a5e13edc (patch)
tree3bcf93febfa726b25b8fbb80ddd739abf3fd8541
parentb41e7afdd87539c0f6719d08a03b87d3a277dd05 (diff)
downloadyelp-a5588114ed94d00ca64913aa5b248e09a5e13edc.tar.gz
Fixing issues introduced by xulrunner 1.9.2
API changes in a stable release are not fun. With 1.9.2, setting the base URI when opening a stream causes a uri_selected callback. So we compare the URI to what we know we're loading to prevent an infinite loop. Also, #fragment links no longer trigger a uri_selected callback. So I've halfway backported the xref: method used in the yelp-3-0 branch. It's not pervasive. We rewrite it pretty much immediately. So we still use the slash hack, instead of the nicer method in yelp-3-0. This should be enough to keep 2.x alive.
-rw-r--r--src/yelp-html.cpp11
-rw-r--r--src/yelp-window.c9
-rw-r--r--stylesheets/db2html.xsl.in2
-rw-r--r--stylesheets/mal2html.xsl.in4
4 files changed, 21 insertions, 5 deletions
diff --git a/src/yelp-html.cpp b/src/yelp-html.cpp
index edd87888..aa9371da 100644
--- a/src/yelp-html.cpp
+++ b/src/yelp-html.cpp
@@ -24,6 +24,8 @@
#include <mozilla-config.h>
#include <config.h>
+#include <string.h>
+
#include "yelp-gecko-services.h"
#include "yelp-gecko-utils.h"
#include "yelp-marshal.h"
@@ -90,13 +92,20 @@ static gint
html_open_uri (GtkMozEmbed *embed, const gchar *uri)
{
YelpHtml *html = YELP_HTML (embed);
- gboolean block_load;
+ gboolean block_load = FALSE;
g_return_val_if_fail (uri != NULL, FALSE);
debug_print (DB_FUNCTION, "entering\n");
debug_print (DB_ARG, " uri = \"%s\"\n", uri);
+ if (g_str_equal (html->priv->base_uri, uri)) {
+ /* As of xulrunner 1.6.2, open_uri is called in response
+ to the base URI we pass in.
+ */
+ return FALSE;
+ }
+
if (!html->priv->frames_enabled) {
g_signal_emit (html, signals[URI_SELECTED], 0, uri, FALSE);
block_load = TRUE;
diff --git a/src/yelp-window.c b/src/yelp-window.c
index d436f24e..401e0599 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -1849,14 +1849,21 @@ html_uri_selected_cb (YelpHtml *html,
gboolean handled,
gpointer user_data)
{
+ gchar *new_uri = uri;
YelpWindow *window = YELP_WINDOW (user_data);
debug_print (DB_FUNCTION, "entering\n");
debug_print (DB_ARG, " uri = \"%s\"\n", uri);
+ if (g_str_has_prefix (uri, "xref:"))
+ new_uri = g_strconcat (window->priv->base_uri, "#", uri + 5, NULL);
+
if (!handled) {
- yelp_window_load (window, uri);
+ yelp_window_load (window, new_uri);
}
+
+ if (new_uri != uri)
+ g_free (new_uri);
}
static gboolean
diff --git a/stylesheets/db2html.xsl.in b/stylesheets/db2html.xsl.in
index 1ebf44ea..b68f153a 100644
--- a/stylesheets/db2html.xsl.in
+++ b/stylesheets/db2html.xsl.in
@@ -68,7 +68,7 @@ FIXME: yelp:cache no longer works
<!-- == db.xref.target == -->
<xsl:template name="db.xref.target">
<xsl:param name="linkend"/>
- <xsl:value-of select="concat('#', $linkend)"/>
+ <xsl:value-of select="concat('xref:', $linkend)"/>
</xsl:template>
<!-- == db2html.css.custom == -->
diff --git a/stylesheets/mal2html.xsl.in b/stylesheets/mal2html.xsl.in
index 37560a71..9a55fccc 100644
--- a/stylesheets/mal2html.xsl.in
+++ b/stylesheets/mal2html.xsl.in
@@ -44,10 +44,10 @@
<xsl:when test="contains($xref, '#')">
<xsl:variable name="pageid" select="substring-before($xref, '#')"/>
<xsl:variable name="sectionid" select="substring-after($xref, '#')"/>
- <xsl:value-of select="concat('#', $pageid, '/', $sectionid)"/>
+ <xsl:value-of select="concat('xref:', $pageid, '/', $sectionid)"/>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="concat('#', $xref)"/>
+ <xsl:value-of select="concat('xref:', $xref)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>