If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

documentCharsetInfo is always null

RESOLVED WORKSFORME

Status

()

Core
Internationalization
RESOLVED WORKSFORME
11 years ago
11 years ago

People

(Reporter: Effie Nadiv, Assigned: smontagu)

Tracking

1.8 Branch
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
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

Comment 1

11 years ago
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
(Reporter)

Comment 2

11 years ago
(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. 
(Reporter)

Comment 3

11 years ago
Release 2.0 rc1 seems to fix this problem. You may cancel this bug report

Comment 4

11 years ago
Great. Thanks for the help testing.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.