diff options
| -rw-r--r-- | Redirector.csproj | 4 | ||||
| -rw-r--r-- | components/redirector.js | 11 | 
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;
              }
 | 
