aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chrome/content/overlay.js7
-rw-r--r--chrome/content/redirectList.js30
-rw-r--r--chrome/content/redirector.js4
-rw-r--r--install.rdf2
4 files changed, 28 insertions, 15 deletions
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index ca198e6..7795372 100644
--- a/chrome/content/overlay.js
+++ b/chrome/content/overlay.js
@@ -82,7 +82,7 @@ var RedirectorOverlay = {
if (redirectUrl.url && oHttp.notificationCallbacks) {
const NS_BINDING_ABORTED = 0x804b0002;
aRequest.cancel(NS_BINDING_ABORTED);
- var newStateFlags = Ci.nsIWebProgressListener.STATE_STOP | Ci.nsIWebProgressListener.STATE_IS_NETWORK;
+ var newStateFlags = Ci.nsIWebProgressListener.STATE_STOP | Ci.nsIWebProgressListener.STATE_IS_NETWORK | Ci.nsIWebProgressListener.STATE_IS_REQUEST;
origOnStateChange.call(this, aWebProgress, aRequest, newStateFlags, "");
var interfaceRequestor = oHttp.notificationCallbacks.QueryInterface(Ci.nsIInterfaceRequestor);
var targetDoc = interfaceRequestor.getInterface(Ci.nsIDOMWindow).document;
@@ -92,7 +92,10 @@ var RedirectorOverlay = {
origOnStateChange.apply(this, arguments);
}
+ } else {
+ origOnStateChange.apply(this, arguments);
}
+
};
},
@@ -111,6 +114,8 @@ var RedirectorOverlay = {
onUnload : function(event) {
+ RedirectorOverlay.prefObserver.unregister();
+ Redirector.prefObserver.unregister();
//Clean up here
RedirLib.debug("Finished cleanup");
},
diff --git a/chrome/content/redirectList.js b/chrome/content/redirectList.js
index 159bc8a..4680075 100644
--- a/chrome/content/redirectList.js
+++ b/chrome/content/redirectList.js
@@ -24,18 +24,18 @@ var RedirectList = {
row.appendChild(cell);
},
- createRow : function(item) {
- var row = document.createElement('listitem');
+ createRow : function(item) {
+ var row = document.createElement('listitem');
- this.createCell(row, item.pattern);
- this.createCell(row, item.exampleUrl);
- this.createCell(row, item.redirectUrl);
- this.createCell(row, item.onlyIfLinkExists);
- this.createCell(row, item.patternType);
+ this.createCell(row, item.pattern);
+ this.createCell(row, item.exampleUrl);
+ this.createCell(row, item.redirectUrl);
+ this.createCell(row, item.onlyIfLinkExists);
+ this.createCell(row, item.patternType);
- row.item = item;
- return row;
- },
+ row.item = item;
+ return row;
+ },
onLoad : function() {
try {
@@ -63,9 +63,9 @@ var RedirectList = {
"chrome,dialog,modal,centerscreen", item);
if (item.saved) {
- var row = this.createRow(item);
- $('lstRedirects').appendChild(row);
- Redirector.addRedirect(item);
+ var row = this.createRow(item);
+ $('lstRedirects').appendChild(row);
+ Redirector.addRedirect(item);
}
},
@@ -118,3 +118,7 @@ var RedirectList = {
}
};
+
+window.addEventListener('unload', function() {
+ Redirector.unload();
+}, false); \ No newline at end of file
diff --git a/chrome/content/redirector.js b/chrome/content/redirector.js
index cab38c3..1c77ed6 100644
--- a/chrome/content/redirector.js
+++ b/chrome/content/redirector.js
@@ -11,6 +11,10 @@ var Redirector = {
this.load();
this.prefObserver.register();
},
+
+ unload : function() {
+ this.prefObserver.unregister();
+ },
save : function() {
var r
diff --git a/install.rdf b/install.rdf
index fa1fe63..2b96523 100644
--- a/install.rdf
+++ b/install.rdf
@@ -5,7 +5,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>redirector@einaregilsson.com</em:id>
<em:name>Redirector</em:name>
- <em:version>1.0</em:version>
+ <em:version>1.0.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://tech.einaregilsson.com/projects/redirector/</em:homepageURL>