aboutsummaryrefslogtreecommitdiff
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/js/component.js2
-rw-r--r--chrome/js/redirector.js21
-rw-r--r--chrome/unittest/run.html9
3 files changed, 11 insertions, 21 deletions
diff --git a/chrome/js/component.js b/chrome/js/component.js
index 7b19109..c0ec562 100644
--- a/chrome/js/component.js
+++ b/chrome/js/component.js
@@ -7,7 +7,7 @@ Components.utils.import("chrome://redirector/content/js/redirector.js");
function RedirectorComponent() { }
RedirectorComponent.prototype = {
- classDescription: "My Hello World Javascript XPCOM Component",
+ classDescription: "Redirector",
classID: Components.ID("{b7a7a54f-0581-47ff-b086-d6920cb7a3f7}"),
contractID: "@einaregilsson.com/redirector;1",
QueryInterface: function(iid) {
diff --git a/chrome/js/redirector.js b/chrome/js/redirector.js
index 0250438..d2bcc51 100644
--- a/chrome/js/redirector.js
+++ b/chrome/js/redirector.js
@@ -3,11 +3,7 @@ Components.utils.import("chrome://redirector/content/js/redirect.js");
Components.utils.import("chrome://redirector/content/js/redirectorprefs.js");
//Components.utils.import("chrome://redirector/content/js/proxyserver.js");
-var EXPORTED_SYMBOLS = ['Redirector', 'rdump'];
-
-function rdump(msg) {
- Redirector.debug(msg);
-}
+var EXPORTED_SYMBOLS = ['Redirector'];
Redirector = {
@@ -81,12 +77,11 @@ Redirector = {
//check for loops...
result = redirect.getMatch(redirectUrl);
if (result.isMatch) {
- var title = this._getString('invalidRedirectTitle');
var msg = this._getFormattedString('invalidRedirectText', [redirect.includePattern, url, redirectUrl]);
this.debug(msg);
redirect.disabled = true;
- this.save();
- this._msgBox(title, msg);
+ this.save();
+ ConsoleService.logStringMessage('Redirector: ' + msg);
} else {
this.debug('Redirecting ' + url + ' to ' + redirectUrl);
return redirectUrl;
@@ -110,7 +105,7 @@ Redirector = {
},
handleUpgrades : function(){
- var currentVersion = '2.7';
+ var currentVersion = '2.7.1';
this._list = [];
if (this._prefs.version == currentVersion) {
@@ -297,8 +292,8 @@ Redirector = {
if (this._prefs) {
this._prefs.dispose();
}
- ConsoleService.logStringMessage('REDIRECTOR CREATED');
this._prefs = new RedirectorPrefs();
+ this.debug('REDIRECTOR CREATED');
//Check if we need to update existing redirects
var data = this._prefs.redirects;
var version = this._prefs.version;
@@ -311,7 +306,7 @@ Redirector = {
}
//RedirectorProxy.start(this._prefs.proxyServerPort);
- //rdump('Registering as Proxy Filter');
+ //Redirector.debug('Registering as Proxy Filter');
//var pps = Cc["@mozilla.org/network/protocol-proxy-service;1"].getService(Ci.nsIProtocolProxyService);
//pps.registerFilter(this, 0);
},
@@ -339,10 +334,6 @@ Redirector = {
return this._strings.formatStringFromName(name, params, params.length);
},
- _msgBox : function(title, text) {
- PromptService.alert(null, title, text);
- },
-
_makeAbsoluteUrl : function(currentUrl, relativeUrl) {
if (relativeUrl.match(/https?:/)) {
diff --git a/chrome/unittest/run.html b/chrome/unittest/run.html
index cc178aa..1c056d5 100644
--- a/chrome/unittest/run.html
+++ b/chrome/unittest/run.html
@@ -15,8 +15,9 @@
<script type="text/javascript">
//Global variables
- var subscriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
- var redirector = Components.classes["@einaregilsson.com/redirector;1"].getService(Components.interfaces.rdIRedirector);
+ Components.utils.import("chrome://redirector/content/js/redirect.js");
+ Components.utils.import("chrome://redirector/content/js/redirector.js");
+ var redirector = Redirector;
function setupTest(name, testcase) {
var table = document.createElement('table');
@@ -48,9 +49,6 @@
function setup() {
//quick and dirty cleanup
document.getElementById('tests').innerHTML = '';
- subscriptLoader.loadSubScript('chrome://redirector/content/code/redirect.js');
- subscriptLoader.loadSubScript('chrome://redirector/content/unittest/testcases.js');
- redirector.reload();
var sorted = [];
for (var name in tests) {
@@ -88,6 +86,7 @@
}
</script>
+ <script type="text/javascript" src="testcases.js"></script>
</head>
<body onload="setup();">
<h1>Redirector Unit Tests</h1>