From bbac2eea1f052dbfa203b46cd5e84be57b38371b Mon Sep 17 00:00:00 2001 From: Einar Egilsson Date: Sun, 10 May 2009 21:09:07 +0000 Subject: 1.7 git-svn-id: http://einaregilsson.googlecode.com/svn/mozilla/redirector/trunk@211 119bf307-c92d-0410-89bd-8f53e6181181 --- components/redirector.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'components') 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; } -- cgit v1.2.3-70-g09d2