diff options
-rw-r--r-- | chrome/content/code/redirector.prototype.js | 8 | ||||
-rw-r--r-- | components/redirector.component.js | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/chrome/content/code/redirector.prototype.js b/chrome/content/code/redirector.prototype.js index 74f7e61..a20a46a 100644 --- a/chrome/content/code/redirector.prototype.js +++ b/chrome/content/code/redirector.prototype.js @@ -10,10 +10,10 @@ Redirector.prototype = { init : function() {
this.prefs = new Prefs();
//Check if we need to update existing redirects
-
- var data = this.prefs.redirects;
+ var data = this.prefs.redirects;
var version = this.prefs.version;
this.loadStrings();
+
//Here update checks are handled
if (version == 'undefined') { //Either a fresh install of Redirector, or first time install of v2.0
if (data) { //There is some data in redirects, we are upgrading from a previous version, need to upgrade data
@@ -46,6 +46,10 @@ 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);
diff --git a/components/redirector.component.js b/components/redirector.component.js index 6dce455..e5f20f4 100644 --- a/components/redirector.component.js +++ b/components/redirector.component.js @@ -6,6 +6,7 @@ Cr = Components.results; Cc = Components.classes;
const loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
+var redirector = null;
function Redirector() {
this.init();
this.wrappedJSObject = this;
@@ -31,6 +32,9 @@ xpcomInfo.QueryInterface = XPCOMUtils.generateQI([Ci.nsIContentPolicy, Ci.nsICh xpcomInfo._xpcom_factory = {
createInstance: function(outer, iid) {
if (outer) throw Cr.NS_ERROR_NO_AGGREGATION;
+ if (redirector == null) {
+ redirector = new Redirector();
+ }
return redirector.QueryInterface(iid);
}
};
@@ -38,5 +42,3 @@ xpcomInfo._xpcom_factory = { function NSGetModule(compMgr, fileSpec) {
return XPCOMUtils.generateModule([Redirector]);
}
-
-const redirector = new Redirector();
|