diff options
Diffstat (limited to 'chrome/content/code')
-rw-r--r-- | chrome/content/code/redirect.js | 19 | ||||
-rw-r--r-- | chrome/content/code/redirector.prototype.js | 4 |
2 files changed, 11 insertions, 12 deletions
diff --git a/chrome/content/code/redirect.js b/chrome/content/code/redirect.js index dcd3596..439dd92 100644 --- a/chrome/content/code/redirect.js +++ b/chrome/content/code/redirect.js @@ -1,7 +1,9 @@ //// $Id$
-function Redirect(exampleUrl, includePattern, excludePattern, patternType, unescapeMatches, disabled) {
- this._init(exampleUrl, includePattern, excludePattern, patternType, unescapeMatches, disabled);
+ exampleUrl,pattern,redirectUrl,patternType,excludePattern
+
+function Redirect(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled) {
+ this._init(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled);
}
//Static
@@ -68,7 +70,7 @@ Redirect.prototype = { return new RegExp(this._preparePattern(pattern),"gi");
},
- _init : function(exampleUrl, includePattern, excludePattern, redirectUrl, patternType, unescapeMatches, disabled) {
+ _init : function(exampleUrl, includePattern, redirectUrl, patternType, excludePattern, unescapeMatches, disabled) {
this.exampleUrl = exampleUrl || '';
this.includePattern = includePattern || '';
this.excludePattern = excludePattern || '';
@@ -101,24 +103,25 @@ Redirect.prototype = { test : function() {
return this.getMatch(this.exampleUrl);
},
+ exampleUrl,pattern,redirectUrl,patternType,excludePattern
serialize : function() {
return [ this.exampleUrl
, this.includePattern
- , this.excludePattern
, this.redirectUrl
, this.patternType
+ , this.excludePattern
, this.unescapeMatches
, this.disabled ].join(',,,');
},
deserialize : function(str) {
if (!str || !str.split) {
- //TODO: THROW ERROR
+ throw Error("Invalid serialized redirect: " + str);
}
var parts = str.split(',,,');
if (parts.length < 5) {
- ///TODO: throw
+ throw Error("Invalid serialized redirect, too few fields: " + str);
}
this._init.apply(this, parts);
},
@@ -172,8 +175,8 @@ Redirect.prototype = { clone : function() {
return new Redirect(this.exampleUrl, this.includePattern,
- this.excludePattern, this.redirectUrl,
- this.patternType, this.unescapeMatches,
+ this.redirectUrl, this.patternType,
+ this.excludePattern, this.unescapeMatches,
this.disabled);
},
diff --git a/chrome/content/code/redirector.prototype.js b/chrome/content/code/redirector.prototype.js index a20a46a..9135e50 100644 --- a/chrome/content/code/redirector.prototype.js +++ b/chrome/content/code/redirector.prototype.js @@ -46,10 +46,6 @@ Redirector.prototype = { }
},
- observe : function(topic, subject, data) {
- dump("HEEEEEEEEEEEEEEEEEEEEE");
- },
-
loadStrings : function() {
var src = 'chrome://redirector/locale/redirector.properties';
var localeService = Cc["@mozilla.org/intl/nslocaleservice;1"].getService(Ci.nsILocaleService);
|