diff options
author | Einar Egilsson | 2009-05-10 21:09:07 +0000 |
---|---|---|
committer | Einar Egilsson | 2009-05-10 21:09:07 +0000 |
commit | bbac2eea1f052dbfa203b46cd5e84be57b38371b (patch) | |
tree | 5a491df2c88988c69656fd99ed0cc5fa64531c91 /components | |
parent | 0226cb6655cdf0948be1e91d0876925c0b7cb72c (diff) |
1.7
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@211 119bf307-c92d-0410-89bd-8f53e6181181
Diffstat (limited to 'components')
-rw-r--r-- | components/redirector.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/components/redirector.js b/components/redirector.js index 6949cdb..aa86bea 100644 --- a/components/redirector.js +++ b/components/redirector.js @@ -9,7 +9,6 @@ const kRedirectorWildcard = 'W'; const kRedirectorRegex= 'R';
const nsIContentPolicy = Ci.nsIContentPolicy;
-
function RedirectorPolicy() {
this.prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefService).getBranch("extensions.redirector.");
@@ -59,7 +58,8 @@ RedirectorPolicy.prototype = { prefBranch : null,
list : null,
strings : null,
-
+ cout : Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService),
+
loadStrings : function() {
var src = 'chrome://redirector/locale/redirector.properties';
var localeService = Cc["@mozilla.org/intl/nslocaleservice;1"].getService(Ci.nsILocaleService);
@@ -70,7 +70,7 @@ RedirectorPolicy.prototype = { debug : function(msg) {
if (this.debugEnabled) {
- dump("REDIRECTOR: " + msg + "\n");
+ this.cout.logStringMessage('REDIRECTOR: ' + msg);
}
},
@@ -83,14 +83,14 @@ RedirectorPolicy.prototype = { return nsIContentPolicy.ACCEPT;
}
- if (contentType != nsIContentPolicy.TYPE_DOCUMENT && contentType != nsIContentPolicy.TYPE_SUBDOCUMENT) {
+ if (contentType != nsIContentPolicy.TYPE_DOCUMENT) {
return nsIContentPolicy.ACCEPT;
}
if (!aContext || !aContext.loadURI) {
return nsIContentPolicy.ACCEPT;
}
- this.debug("CHECK: " + contentLocation.spec + "\n");
+ this.debug("CHECK: " + contentLocation.spec);
var url = contentLocation.spec;
@@ -98,6 +98,7 @@ RedirectorPolicy.prototype = { var redirectUrl = this.getRedirectUrl(url, redirect);
if (redirectUrl) {
redirectUrl = this.makeAbsoluteUrl(url, redirectUrl);
+ this.debug('Redirecting ' + url + ' to ' + redirectUrl);
aContext.loadURI(redirectUrl, requestOrigin, null);
return nsIContentPolicy.REJECT_REQUEST;
}
|