diff options
author | Einar Egilsson | 2008-01-23 22:22:35 +0000 |
---|---|---|
committer | Einar Egilsson | 2008-01-23 22:22:35 +0000 |
commit | bcbcd61eb9fc91a9ed1b3096ce9f2b686a2114b9 (patch) | |
tree | 3d79e540332aa12ae71e94c150c71fd7f890f8ff /chrome/content/redirector.js | |
parent | abc92ba06bb84d544a0d1deb065eb608cac8190e (diff) |
Version 1.5.1
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@104 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/redirector.js')
-rw-r--r-- | chrome/content/redirector.js | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/chrome/content/redirector.js b/chrome/content/redirector.js index 62966d6..98d1c4b 100644 --- a/chrome/content/redirector.js +++ b/chrome/content/redirector.js @@ -67,11 +67,11 @@ var Redirector = { //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)); + if (redirect.redirectUrl.startsWith('xpath:')) { + RedirLib.msgBox(this.strings.getString('extensionName'), this.strings.getString('xpathDeprecated')); + } else if (!redirect.onlyIfLinkExists) { + RedirLib.debug('%1 matches %2, and it\'s not only if link exists. 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)); } @@ -148,29 +148,11 @@ var Redirector = { goto : function(redirectUrl, pattern, url, doc) { - - if (redirectUrl.startsWith('xpath:')) { - - var xpath = redirectUrl.substr('xpath:'.length); - RedirLib.debug('Evaluating xpath: ' + xpath); - xpathResult = doc.evaluate(redirectUrl.substr('xpath:'.length), doc, null, XPathResult.STRING_TYPE,null); - if (!xpathResult) { - //fail silently - RedirLib.debug('%1 returned nothing on url %2'._(xpath, url)); - return; - } else { - RedirLib.debug('%1 evaluated to %2'._(redirectUrl, xpathResult.stringValue)); - redirectUrl = xpathResult.stringValue; - if (redirectUrl == '') { - RedirLib.debug('XPath failed, no redirection will be made'); - return; - } - } - } - redirectUrl = this.makeAbsoluteUrl(url, redirectUrl); - if (redirectUrl == url) { + if (redirectUrl.startsWith('xpath:')) { + //Do nothing, the instant redirect will have popped up a message + } else if (redirectUrl == url) { RedirLib.msgBox(this.strings.getString('extensionName'), this.strings.getFormattedString('recursiveError', [pattern, redirectUrl])); } else { doc.location.href = redirectUrl; |