Closed Bug 11580 Opened 25 years ago Closed 25 years ago

[code] nsMsgIdentity::getCharPref (and other methods) use m_prefs even if it is null

Categories

(MailNews Core :: Backend, defect, P2)

defect

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jband_mozilla, Assigned: alecf)

Details

It is painful to bulletproof everything. But...

Components expxosed to JS can be instantiated and have methods called and
attributes twiddled even if their 'normal' custom initilization has not been
run.

This will crash if the following code is run using xpcshell...

var name = "component://netscape/messenger/identity";

try {
    var foo = Components.classes[name].createInstance();
    print(foo);
    print(name);
    for(p in Components.interfaces) {
        try {
            iface = foo.QueryInterface(Components.interfaces[p]);
            if(typeof(iface) == 'undefined')
                continue;
            print("\t"+p);
            for(m in iface) {
                print("\t\t"+m+" = "+typeof(iface[m]));
            }
        } catch(e) {

        }
    }

    foo = null;
    gc();
} catch(e) {
    print("caught+e");
}
Same story for nsMsgIncomingServer using the above code with:

var name = "component://netscape/messenger/server&type=pop3";
Status: NEW → ASSIGNED
Priority: P3 → P2
Target Milestone: M10
yeah, this is kind of what prefService() was supposed to handle in that other
bug you filed.

Once again, I should just be using NS_WITH_SERVICE..
Summary: nsMsgIdentity::getCharPref (and other methods) use m_prefs even if it is null → [code] nsMsgIdentity::getCharPref (and other methods) use m_prefs even if it is null
OS: Windows NT → All
Hardware: PC → All
Target Milestone: M10 → M9
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
ok, nsMsgIdentity was actually fixed for M9.
QA Contact: lchiang → ppandit
Changing QA contact to ppandit
Status: RESOLVED → VERIFIED
Ran the sample code in xpcshell using a debug build on Windows NT from today
(10/11/99). Since all of the objects were defined, the problem has been
resolved. Confirmed with Alec.

VERIFIED


  D:\mozilla\dist\WIN32_D.OBJ\bin>xpcshell
  nsNativeComponentLoader: autoregistering D:\mozilla\dist\WI
  nts
  nsNativeComponentLoader: autoregistering succeeded
  js> var name = "component://netscape/messenger/identity";
  js>
  js> try {
      var foo = Components.classes[name].createInstance();
      print(foo);
      print(name);
      for(p in Components.interfaces) {
          try {
              iface = foo.QueryInterface(Components.interface
              if(typeof(iface) == 'undefined')
                  continue;
              print("\t"+p);
              for(m in iface) {
                  print("\t\t"+m+" = "+typeof(iface[m]));
              }
          } catch(e) {

          }
      }

      foo = null;
      gc();
  } catch(e) {
      print("caught+e");
  }
  [xpconnect wrapped nsISupports]
  component://netscape/messenger/identity
          nsISupports
                  QueryInterface = function
          nsIMsgIdentity
                  QueryInterface = function
                  key = string
                  identityName = string
                  fullName = object
                  email = object
                  replyTo = object
                  organization = object
                  composeHtml = boolean
                  attachSignature = boolean
                  attachVCard = boolean
                  signature = object
                  vCard = object
                  doFcc = boolean
                  fccFolder = object
                  bccSelf = boolean
                  bccOthers = boolean
                  bccList = object
                  draftFolder = object
                  stationaryFolder = object
                  junkMailFolder = object
                  toString = function
  before 23184, after 8262, break 00000000
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.