Closed Bug 351138 Opened 18 years ago Closed 18 years ago

documentCharsetInfo is always null

Categories

(Core :: Internationalization, defect)

1.8 Branch
x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: effie.nadiv, Assigned: smontagu)

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b2) Gecko/20060821 Firefox/2.0b2

When i use "addProgressListener" to trap pages being loaded, the "nsIWebProgress" being passed to "onStateChange" always points to a null "documentCharsetInfo".



Reproducible: Always

Steps to Reproduce:
1. add a progress listner (.getService(Components.interfaces.nsIWebProgress)
          .addProgressListener(...
2. Implement onStateChange (onStateChange : function(aWebProgress, aRequest,
3. Inspect the value of aWebProgress.documentCharsetInfo 
I've found it is always null

Actual Results:  
aWebProgress.documentCharsetInfo == null

Expected Results:  
aWebProgress.documentCharsetInfo should contain a valid instance exposing nsIDocumentCharsetInfo
Is there any way you can provide a testcase for this?
Assignee: nobody → smontagu
Component: General → Internationalization
Product: Firefox → Core
QA Contact: general → amyy
Version: unspecified → 1.8 Branch
(In reply to comment #1)
> Is there any way you can provide a testcase for this?
> 

var AtomService = Components.classes["@mozilla.org/atom-service;1"].
            getService(Components.interfaces.nsIAtomService);
var gConsoleService = Components.classes['@mozilla.org/consoleservice;1'].
						getService(Components.interfaces.nsIConsoleService);

function registerAdvStatusListener()
{
  Components.classes["@mozilla.org/docloaderservice;1"]
          .getService(Components.interfaces.nsIWebProgress)
          .addProgressListener(pageStatusListener,
                               Components.interfaces.nsIWebProgress
                                                    .NOTIFY_STATE_DOCUMENT);
}

function unregisterAdvStatusListener()
{
    Components.classes["@mozilla.org/docloaderservice;1"]
          .getService(Components.interfaces.nsIWebProgress)
          .removeProgressListener(pageStatusListener);
}

window.addEventListener("load",registerAdvStatusListener,false);
window.addEventListener("unload",unregisterAdvStatusListener,false);

var pageStatusListener =
{
  initiated: null,
  
  QueryInterface : function(aIID){
    if (aIID.equals(Components.interfaces.nsIWebProgressListener) ||
        aIID.equals(Components.interfaces.nsISupportsWeakReference) ||
        aIID.equals(Components.interfaces.nsIXULBrowserWindow) ||
        aIID.equals(Components.interfaces.nsISupports) ||
        aIID.equals(Components.interfaces.nsIHttpNotify) ||
        aIID.equals(Components.interfaces.nsIObserver))
      return this;
    throw Components.results.NS_NOINTERFACE;
  },

  init : function(){
    this.initiated = true;
  },

  destroy : function() {
    ;
  },

  
  onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus){
    //at this point aWebProgress.documentCharsetInfo is always null
    gConsoleService.logStringMessage(aWebProgress.documentCharsetInfo? "Good" : "bad");
  },

  onProgressChange : function (a,b,c,d,e,f){},
onLocationChange:function(a,b,c){/*window.XULBrowserWindow.onLocationChange(a,b,c)*/},
  onStatusChange:function(a,b,c,d){},
  onSecurityChange:function(a,b,c){},
  onLinkIconAvailable:function(a){}
}

When i run this code on b1 or prior FF (1.5 - 2.0b1) i get the documentCharsetInfo as expected. On FF 2.0b2 it's always null.

I got reports from some of my users that the same code runs well in their 2.0b2 installation. 
Release 2.0 rc1 seems to fix this problem. You may cancel this bug report
Great. Thanks for the help testing.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.