diff options
author | Einar Egilsson | 2012-01-08 06:41:57 +0100 |
---|---|---|
committer | Einar Egilsson | 2012-01-08 06:41:57 +0100 |
commit | 5a68a9c070e45f4a8366f0baed90befe685f2824 (patch) | |
tree | 470fbb8ac4e54a3776bac0b4e6e15ded34691ae1 | |
parent | 53846831aecade74980349949f24d88f33a55c04 (diff) |
2.7.1
-rw-r--r-- | build.py | 2 | ||||
-rw-r--r-- | chrome/js/component.js | 2 | ||||
-rw-r--r-- | chrome/js/redirector.js | 21 | ||||
-rw-r--r-- | chrome/unittest/run.html | 9 | ||||
-rw-r--r-- | defaults/preferences/redirector.preferences.js | 4 | ||||
-rw-r--r-- | install.rdf | 2 | ||||
-rw-r--r-- | locale/en-US/redirector.properties | 2 |
7 files changed, 13 insertions, 29 deletions
@@ -1,6 +1,6 @@ import os, os.path, zipfile
-xpi = zipfile.ZipFile('redirector-2.7.xpi','w')
+xpi = zipfile.ZipFile('redirector-2.7.1.xpi','w')
for (root, folders, files) in os.walk('.'):
if 'unittest' in root:
continue
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> diff --git a/defaults/preferences/redirector.preferences.js b/defaults/preferences/redirector.preferences.js index 66f0cdd..4464a8a 100644 --- a/defaults/preferences/redirector.preferences.js +++ b/defaults/preferences/redirector.preferences.js @@ -6,7 +6,3 @@ pref("extensions.redirector.showStatusBarIcon", true); pref("extensions.redirector.version", 'undefined'); pref("extensions.redirector.defaultDir", ''); pref("extensions.redirector.proxyServerPort", 4815); - -// See http://kb.mozillazine.org/Localize_extension_descriptions -pref("extensions.redirector@einaregilsson.com.description", "chrome://redirector/locale/redirector.properties"); - diff --git a/install.rdf b/install.rdf index 813af8c..059caf9 100644 --- a/install.rdf +++ b/install.rdf @@ -4,7 +4,7 @@ <Description about="urn:mozilla:install-manifest"> <em:id>redirector@einaregilsson.com</em:id> <em:name>Redirector</em:name> - <em:version>2.7</em:version> + <em:version>2.7.1</em:version> <em:creator>Einar Egilsson</em:creator> <em:description>Automatically redirects to user-defined urls on certain pages</em:description> <em:homepageURL>http://einaregilsson.com/projects/redirector/</em:homepageURL> diff --git a/locale/en-US/redirector.properties b/locale/en-US/redirector.properties index a868161..09e4910 100644 --- a/locale/en-US/redirector.properties +++ b/locale/en-US/redirector.properties @@ -1,5 +1,4 @@ initError=Failed to initialize Redirector. -extensions.redirector@einaregilsson.com.description=Automatically redirects to user-defined urls on certain pages extensionName=Redirector addCurrentUrl=Add current url to Redirector addLinkUrl=Add link url to Redirector @@ -24,7 +23,6 @@ allExistedMessage=All %S redirects in the file were identical to existing redire allExistedMessageSingular=The single redirect in the file was identical to an existing redirect and was therefore not imported. importedNone=There were no usable redirects in the given file, no redirects were imported. importResult=Import results -invalidRedirectTitle=Redirector Add-on: Invalid Redirect detected invalidRedirectText=The pattern "%S" redirected the url %S to %S which also matches the pattern. This will cause an endless loop and so the redirect has been disabled to prevent this from happening. You should edit this redirect to fix it. warningExampleUrlDoesntMatchPatternTitle=Warning: Example url does not match redirect warningExampleUrlDoesntMatchPattern=The example url does not match the redirect specified. Are you sure you want to save this redirect? |