From d30ede45e7ff0624ca4a1bcc565c344a6df23ee2 Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Fri, 5 Oct 2007 21:10:42 +0000 Subject: Redirector 1.0.2.1 git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@94 119bf307-c92d-0410-89bd-8f53e6181181 --- chrome/content/redirector.js | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) (limited to 'chrome/content/redirector.js') diff --git a/chrome/content/redirector.js b/chrome/content/redirector.js index 1c77ed6..cc09300 100644 --- a/chrome/content/redirector.js +++ b/chrome/content/redirector.js @@ -57,25 +57,23 @@ var Redirector = { getRedirectUrlForInstantRedirect : function(url) { var redirect, link, links, redirectUrl; - if (!this.enabled) { - return null; - } - - for each (redirect in this.list) { - - redirectUrl = this.getRedirectUrl(url, redirect); - //Can't do fast redirect if it requires that link exists - //we need the original page to verify that it exists. - //Slow redirect will be done automatically. - if (redirectUrl) { - - if (!redirect.onlyIfLinkExists && !redirect.redirectUrl.startsWith('xpath:')) { - RedirLib.debug('%1 matches %2, and it\'s not only if link exists and not an xpath expression. Can do instant redirect.'._(redirect.pattern, url)); - return { 'url' : redirectUrl, 'pattern' : redirect.pattern}; - } else if (redirect.redirectUrl.startsWith('xpath:')) { - RedirLib.debug('%1 matches %2, but the redirect is a xpath expression and so has to be a slow redirect'._(redirect.pattern, url)); - } else { - RedirLib.debug('%1 matches %2, but it\'s "only if link exists" and so has to be a slow redirect'._(redirect.pattern, url)); + if (this.enabled) { + + for each (redirect in this.list) { + + redirectUrl = this.getRedirectUrl(url, redirect); + //Can't do fast redirect if it requires that link exists + //we need the original page to verify that it exists. + //Slow redirect will be done automatically. + if (redirectUrl) { + if (!redirect.onlyIfLinkExists && !redirect.redirectUrl.startsWith('xpath:')) { + RedirLib.debug('%1 matches %2, and it\'s not only if link exists and not an xpath expression. Can do instant redirect.'._(redirect.pattern, url)); + return { 'url' : redirectUrl, 'pattern' : redirect.pattern}; + } else if (redirect.redirectUrl.startsWith('xpath:')) { + RedirLib.debug('%1 matches %2, but the redirect is a xpath expression and so has to be a slow redirect'._(redirect.pattern, url)); + } else { + RedirLib.debug('%1 matches %2, but it\'s "only if link exists" and so has to be a slow redirect'._(redirect.pattern, url)); + } } } } -- cgit v1.2.3-70-g09d2