[Pkg-mozext-commits] [sage-extension] 48/54: Fixing linkVisitor to work in Firefox 0.8

David Prévot taffit at moszumanska.debian.org
Fri May 1 03:10:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to tag sage_1_3
in repository sage-extension.

commit 53bbac0b197e46bb6f4085ec3ac907e4c5995113
Author: Erik Arvidsson <erik.arvidsson at gmail.com>
Date:   Fri Oct 15 16:24:42 2004 +0000

    Fixing linkVisitor to work in Firefox 0.8
---
 src/sage/content/sage.js | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/sage/content/sage.js b/src/sage/content/sage.js
index 3903db5..ef9a4f9 100755
--- a/src/sage/content/sage.js
+++ b/src/sage/content/sage.js
@@ -602,8 +602,6 @@ function openListItem(oType) {
 
 var linkVisitor = {
 	_uriFixup : Components.classes["@mozilla.org/docshell/urifixup;1"].getService(Components.interfaces.nsIURIFixup),
-	_globalHistory : Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIGlobalHistory2),
-	_browserHistory : Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory),
 
 	setVisited:	function (sURI, bRead) {
 		if (!sURI)
@@ -613,8 +611,12 @@ var linkVisitor = {
 		var fixupURI = this._getFixupURI(sURI);
 		if (fixupURI == null)
 			return;
-		if (bRead)
-			this._globalHistory.addURI(fixupURI, false, true);
+		if (bRead) {
+			if (this._ff08)
+				this._globalHistory.addPage(fixupURI);
+			else
+				this._globalHistory.addURI(fixupURI, false, true);
+		}
 		else
 			this._browserHistory.removePage(fixupURI);
 	},
@@ -634,9 +636,25 @@ var linkVisitor = {
 			logMessage("Could not fixup URI: " + sURI);
 			return null;
 		}
+	},
+
+	init : function () {
+		// Firefox 0.8 does not support @mozilla.org/browser/global-history;2 or
+		// nsIGlobalHistory2
+		this._ff08 = !("@mozilla.org/browser/global-history;2" in Components.classes);
+		var gh;
+		if (this._ff08) {
+			gh = Components.classes["@mozilla.org/browser/global-history;1"];
+			linkVisitor._globalHistory = gh.getService(Components.interfaces.nsIGlobalHistory);
+		}
+		else {
+			gh = Components.classes["@mozilla.org/browser/global-history;2"];
+			linkVisitor._globalHistory = gh.getService(Components.interfaces.nsIGlobalHistory2);
+		}
+		linkVisitor._browserHistory = gh.getService(Components.interfaces.nsIBrowserHistory);
 	}
 };
-
+linkVisitor.init();
 
 
 // RSS Item Context Menu

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/sage-extension.git



More information about the Pkg-mozext-commits mailing list