aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Egilsson2009-05-10 21:09:07 +0000
committerEinar Egilsson2009-05-10 21:09:07 +0000
commitbbac2eea1f052dbfa203b46cd5e84be57b38371b (patch)
tree5a491df2c88988c69656fd99ed0cc5fa64531c91
parent0226cb6655cdf0948be1e91d0876925c0b7cb72c (diff)
1.7
git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@211 119bf307-c92d-0410-89bd-8f53e6181181
-rw-r--r--Redirector.csproj4
-rw-r--r--components/redirector.js11
2 files changed, 8 insertions, 7 deletions
diff --git a/Redirector.csproj b/Redirector.csproj
index ef3b3fd..e1158aa 100644
--- a/Redirector.csproj
+++ b/Redirector.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<!-- $Id$ -->
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
@@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
+ <OutputPath>.\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
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;
}