blob: 90fcf01940bb88e09c4929825f444085e4da85e7 [file] [log] [blame]
From a5588114ed94d00ca64913aa5b248e09a5e13edc Mon Sep 17 00:00:00 2001
From: Shaun McCance <shaunm@gnome.org>
Date: Mon, 25 Jan 2010 20:21:10 +0000
Subject: 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.
---
diff --git a/src/yelp-html.cpp b/src/yelp-html.cpp
index edd8788..aa9371d 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 d436f24..401e059 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 1ebf44e..b68f153 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 37560a7..9a55fcc 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>
--
cgit v0.8.3.1