aboutsummaryrefslogtreecommitdiff
path: root/chrome/content/code
diff options
context:
space:
mode:
authorEinar Egilsson2009-10-26 08:13:15 +0000
committerEinar Egilsson2009-10-26 08:13:15 +0000
commit88a382a54500d6572446b453a560ef072128a393 (patch)
tree178d15aff278eebbfa98f3b743023d054ac13fc8 /chrome/content/code
parent7a35fcd096f1fc4f81fc9cbc5d41ced28b752a89 (diff)
Ready for final test
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@288 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'chrome/content/code')
-rw-r--r--chrome/content/code/editRedirect.xul.js20
1 files changed, 17 insertions, 3 deletions
diff --git a/chrome/content/code/editRedirect.xul.js b/chrome/content/code/editRedirect.xul.js
index 72513e8..0902645 100644
--- a/chrome/content/code/editRedirect.xul.js
+++ b/chrome/content/code/editRedirect.xul.js
@@ -34,6 +34,7 @@ var EditRedirect = {
onAccept : function() {
var args = window.arguments[0];
+ var msg, title;
args.saved = true;
this.saveValues(args.redirect);
@@ -42,12 +43,25 @@ var EditRedirect = {
if (!/^\s*$/.test(args.redirect.exampleUrl)) {
var result = args.redirect.getMatch(args.redirect.exampleUrl);
if (!result.isMatch) {
- //TODO: warn about match
+ title = this.strings.getString('warningExampleUrlDoesntMatchPatternTitle');
+ msg = this.strings.getString('warningExampleUrlDoesntMatchPattern');
+ var ps = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService(Components.interfaces.nsIPromptService);
+ var rv = ps.confirmEx(window, title, msg, ps.STD_YES_NO_BUTTONS, ps.BUTTON_TITLE_YES, ps.BUTTON_TITLE_NO, null, null, {});
+ return rv == 0;
} else {
- var resultUrl = '';
+ var resultUrl = result.redirectTo;
+ if (!resultUrl.match(/https?:/)) {
+ var ioService = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
+ var uri = ioService.newURI(args.redirect.exampleUrl, null, null);
+ resultUrl = uri.resolve(resultUrl);
+ }
+
var secondResult = args.redirect.getMatch(resultUrl);
if (secondResult.isMatch) {
- //TODO: Warn about recursive match...
+ title = this.strings.getString('errorExampleUrlMatchesRecursiveTitle');
+ msg = this.strings.getFormattedString('errorExampleUrlMatchesRecursive', [args.redirect.exampleUrl, resultUrl]);
+ this.msgBox(title, msg);
+ return false;
}
}
}