diff options
author | Einar Egilsson | 2009-12-21 21:40:09 +0000 |
---|---|---|
committer | Einar Egilsson | 2009-12-21 21:40:09 +0000 |
commit | a77582e3dd9b2d1be28eeda6a197e80d68267a53 (patch) | |
tree | 35a98e1803d9ca3693521f5c097edce775958df9 | |
parent | 87d382ce8b58b8439d33101829b46ff2efd91474 (diff) |
Fixed bug where newly added redirects couldn't be edited the next time the Settings window was opened within the same session.
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@345 119bf307-c92d-0410-89bd-8f53e6181181
-rw-r--r-- | chrome/content/code/redirector.prototype.js | 7 | ||||
-rw-r--r-- | chrome/content/code/settings.xul.js | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/chrome/content/code/redirector.prototype.js b/chrome/content/code/redirector.prototype.js index d5d78f9..bed05dc 100644 --- a/chrome/content/code/redirector.prototype.js +++ b/chrome/content/code/redirector.prototype.js @@ -18,7 +18,12 @@ Redirector.prototype = { },
addRedirect : function(redirect) {
- this._list.push(redirect);
+ //This runaround is necessary because the redirect
+ //that was created somewhere up in the GUI doesn't
+ //have the Redirect function in scope.
+ var rx = new Redirect();
+ rx.copyValues(redirect);
+ this._list.push(rx);
this.save();
},
diff --git a/chrome/content/code/settings.xul.js b/chrome/content/code/settings.xul.js index 4fa65a2..4ec306d 100644 --- a/chrome/content/code/settings.xul.js +++ b/chrome/content/code/settings.xul.js @@ -141,8 +141,10 @@ var Settings = { var args = { saved : false, redirect : new Redirect() };
window.openDialog("chrome://redirector/content/ui/editRedirect.xul", "redirect", "chrome,dialog,modal,centerscreen", args);
if (args.saved) {
- this.addItemsToListBox([args.redirect]);
Redirector.addRedirect(args.redirect);
+ //Get it from redirector since it has processed it and it's no longer the same
+ //object as the one we added.
+ this.addItemsToListBox([Redirector.getRedirectAt(Redirector.redirectCount-1)]);
this.selectionChange();
}
},
|